Announcement

Collapse
No announcement yet.

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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    45 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    21 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    31 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X