Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Incorrect Syntax; Execution Ignored?

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

    Incorrect Syntax; Execution Ignored?

    Base Logic:

    if
    // All Variables Reset
    (BarsSinceExitExecution(0, "", 0) == 0)
    {
    EvalHold = false;
    Bar1Long = false;
    Bar2Long = false;
    Bar1Short = false;
    Bar2Short = false;
    }


    I suspect I've written the Bars Since Exit Execution incorrectly. These orders appear to be being ignored.

    Variables which were set to true prior to condition entry can stay that way through the trade and are then supposed to reset to false immediately upon trade completion...

    Lets say a long just successfully completed​...

    if
    // All Variables Reset
    (BarsSinceExitExecution(0, "Long", 0) == 0)
    {
    EvalHold = false;
    Bar1Long = false;
    Bar2Long = false;
    Bar1Short = false;
    Bar2Short = false;
    }




    I want variables to reset to false immediately so to properly wait for 2 variable conditions to become true AFTER the trade completed. What's happening is the conditions for variable one and 2 appear to be using evaluations from inside the active trade and if met are immediately firing on next bar after trade completion. The reset logic employed here appears to be ignored...

    Que Pasa??

    #2
    Hello johnMoss,

    The position will take time to change, so it would be on the next update of OnBarUpdate() where BarsSinceExitExecution() will return the number of bars since the last execution.

    Just to confirm, you are trying to reset these values when the exit order fills and not the entry, is this correct?
    The exit order signal name is "Long" is this correct?

    You could choose to immediately reset these variables at the time the execution fills from OnExecutionUpdate().
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea,

      Yes, The objective is to reset the variables when the trade exit order fills, i.e same bar. Idea is that conditional evaluation to set variables to true as may occur should not restart until the last trade is finished. I gather my logic is error or am missing something?
      Last edited by johnMoss; 11-16-2023, 12:32 PM.

      Comment


        #4
        Hi Chelsea,
        this question still stands... Where/How do I apply the OnExecution Update?: Help guide is not specific...

        Comment


          #5
          Hello johnMoss,

          The OnExecutionUpdate() override must be declared in the scope of the class (between the curly braces for the class) and can only be declared once.

          Below is a link to a reference sample that implements the OnExecutionUpdate() override.
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          44 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          124 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          65 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