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

Trades trigger sending late

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

    Trades trigger sending late

    The actual order is just sent later than anticipated

    Example condition running OnBarClose

    // Cross over trigger
    && (SMA1[1] < SMA2[1])
    && (SMA1[0] > SMA2[0])

    && (StocktasticRSI[0] >= .50

    the expected is if RSI on last bar closed was >= 0.50 and the CrossOver occurred on the last bar ENTER LONG MARKET ORDER

    WHAT is happening is Cross over occurs but the RSI condition is < .50 and a random number of bars later the (SMA1[0] > SMA2[0]) is still true and the RSI crosses over .50, then it takes the trade but it has been multiple bars since the SMA Cross over

    THIS IS NOT THE EXPECTED TRADE

    Thanks

    #2
    Hello DTSSTS,

    Thanks for your post.

    How are you testing the strategy, in the strategy analyzer, or in a chart with historical data, or on live data, or on Playback with Market replay data?

    What is the calculate setting of the strategy? (Calculate.OnBarClose, Calculate.OnEachTick, Calculate.OnPriceChange)

    Does the strategy have additional data series?

    What bar type, bar size, and instrument are you using?

    Can you provide a screenshot of the unexpected trade? (That shows the entire chart)

    Have you printed out a bar-by-bar examination of the values involved to understand why the condition is evaluated as true even though you say it is not all true?

    Does the partial condition statement shown have as part its full context an "or" statement?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Testing on Live Data, OnBarClose - Yes multiple data series, Trades Conditions are on Primary

      BarType is 28 (renko style brick) 20 Primary Data , Instrument MNQ Micro, no screen shot at this time, I would have to reset resolution for screen shot to be large enough to see, but I could save chart as image i suppose

      The Condition is actually NOT true, the Cross Over did not just occur when the trade is made, the Condtions of bar[0] are both true when order is sent, but the condition of the PRE cross over bar[1] is NOT true any more that is the issue

      NOT or regarding the conditions in question

      Thanks

      I really do not think this makes a difference, but would it
      the conditions are of course a part of a larger group of other conditions as would be built in a strategy builder in ( ) like below is just part of the bigger set of conditions, these are the ones I wish to be considered together and trigger the trade or NOT. I do not want to wait on the RSI to become true later after the cross over

      // Cross over trigger
      && (SMA1[1] < SMA2[1])
      && (SMA1[0] > SMA2[0])

      && (StocktasticRSI[0] >= .50)

      WOULD ENCLOSING THESE TOGETHER FIX MY ISSUE with an Extra set of ( ) around the 3 lines

      // Cross over trigger
      && ((SMA1[1] < SMA2[1])
      && (SMA1[0] > SMA2[0])

      && (StocktasticRSI[0] >= .50))

      Thanks
      Last edited by DTSSTS; 01-28-2022, 05:52 AM. Reason: additional information

      Comment


        #4
        Hello DTSSTS,

        Thanks for your reply.

        My recommendation would be to create another strategy to test with and focus on those three conditions to verify their functionality together.

        I would also add drawing a dot on the chart below the bar where the conditions are true as this will show you every bar where it is true compared to entering an order. This would also be a good debugging technique to use with the current strategy.




        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Yes I like drawings or a backbrush to show when true or false, I use that often, in this case I would get the drawing when the actually order is being sent, how would I isolate the drawing to the trigger of the Crossover and then the group of 3 conditions, would i place the 3 in brackets as I have show above and place the drawing in those brackets as well.

          Not sure how to isolate to that part of the conditions Thanks

          Comment


            #6
            Hello DTSSTS,

            Thanks for your reply.

            My recommendation was to take those conditions to a new strategy and test in that manner first to verify expected functionality.

            If you want to do something like that with your existing strategy then I would suggest adding another set that has just those conditions and when true have that set draw as you wish.
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            44 views
            0 likes
            Last Post jeronymite  
            Started by Barry Milan, Yesterday, 10:35 PM
            7 responses
            20 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by AttiM, 02-14-2024, 05:20 PM
            10 responses
            179 views
            0 likes
            Last Post jeronymite  
            Started by ghoul, Today, 06:02 PM
            0 responses
            9 views
            0 likes
            Last Post ghoul
            by ghoul
             
            Started by DanielSanMartin, Yesterday, 02:37 PM
            2 responses
            13 views
            0 likes
            Last Post DanielSanMartin  
            Working...
            X