Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Strategy doesn't send orders

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Strategy doesn't send orders

    Really need your help. I can't understand what is wrong with the following code logic. Strategy just doesn't send orders. Can't undestand why.

    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 1)
    return;

    // Set 1
    if (Delta11.Buys[0] < Zero-900)
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "1");
    }

    // Set 2
    if (Delta11.Sells[0] > Zero+900)
    {
    EnterShort(Convert.ToInt32(DefaultQuantity), "1");
    }

    #2
    Hello Svasud,

    Thanks for your question.

    If the strategy is not making trades it would be because the logic is not allowing your order entry methods to be reached.

    To check your logic, we suggest reproducing the behavior with debugging prints to see why your conditions have not become true and allowed the order entry methods to be reached.

    For example:

    Code:
    Print("Delta11.Buys[0]: " + Delta11.Buys[0] + " Zero-900 " + (Zero-900));
    if (Delta11.Buys[0] < Zero-900)
    {
        EnterLong(Convert.ToInt32(DefaultQuantity), "1");
    }
    Prints can be added in the Strategy Builder in a new Condition Set that only has an action for the Prints, without a condition controlling the Print, so the values that are used to evaluate the condition are always printed in the NinjaScript Output Window..

    Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm

    Debugging in the Strategy Builder - https://drive.google.com/file/d/1mTq...w?usp=drivesdk

    Debugging Demo - https://drive.google.com/file/d/1rOz...w?usp=drivesdk

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by carnitron, Today, 08:42 PM
    0 responses
    5 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Today, 07:51 PM
    0 responses
    6 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,974 views
    3 likes
    Last Post jhudas88  
    Started by rbeckmann05, Today, 06:48 PM
    0 responses
    8 views
    0 likes
    Last Post rbeckmann05  
    Started by rhyminkevin, Today, 04:58 PM
    4 responses
    58 views
    0 likes
    Last Post dp8282
    by dp8282
     
    Working...
    X