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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X