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 NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    127 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X