Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with strategy in strategy builder

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

    Help with strategy in strategy builder

    Hi, I wanna build a strategy in builder strategy where if the current candle breaks the high of the previous it goes long and if the current candle breaks the low of the previous candle it enters a short position. I attached below what I currently have in the strategy, but every time I add the strategy to a chart no results show up. Is there something wrong with the one I have currently?


    #2
    Hi Dylan, thanks for posting.

    I don't see anything wrong with that strategy. It should produce signals. Are you sure you have enabled the strategy by checking the Enabled checkbox?

    Best regards,
    -ChrisL

    Comment


      #3
      Thanks Chris it works now, however, the strategy currently goes short and long once it breaks above or below the bar and not the actual low or highs. I want the strategy to only go long or short once the price breaks above or below the highest wick or lowest wick of the candle. How would I do this?

      Comment


        #4
        Hi Dylan, thanks for your reply.

        The strategy is processing the OnBarUpdate method OnBarClose (see the Calculate property), so it will evaluate your conditions on the first tick of the next bar. If you want it to enter the trade on the tick that Low < Low[1] or High > High[1] you must calculate OnEachTick. I would also recommend using the Print method to see the data the strategy is processing, this will help to debug and get expected behavior:

        https://ninjatrader.com/support/help...nt8/?print.htm

        Best regards,
        -ChrisL

        Comment


          #5
          I changed the calculation setting to each tick and its still going long and short on the high and low of the candle and not the wicks.

          Comment


            #6
            Hi Dylan, thanks for your reply.

            It's processing the historical data which will run OnBarClose unless you use Tick Replay. See here for documentation:

            https://ninjatrader.com/support/help...ick_replay.htm - Developing for tick replay

            https://ninjatrader.com/support/help...ime_vs_bac.htm - Real-Time vs historical discrepancies

            To test an OnEach tick strategy you can also use the Playback connection for backtests:
            https://ninjatrader.com/support/help...connection.htm

            Best regards,
            -ChrisL


            Comment


              #7
              Okay thank you! Just for confirmation, if I run the strategy with a live account and I have it calculating on each tick it should actually go long and short on the lowest and highest ticks and not the low and high of the candle itself correct?

              Comment


                #8
                Hi Dylan, thanks for your reply.

                Running OnEachTick will be more sensitive than OnBarClose, the best way to test the behavior will be to use the Playback connection. Running OnEachTick, the condition Low[0] <= Low[1] will evaluate to true the very instant that tick comes in, it is not going to take the final Low and evaluate it with the previous Low[1]. To evaluate the closing Low[0] with the previous Low[1] you would need to keep this running OnBarClose, but that would also mean the order is placed at the Close[0] price instead of the wick prices.

                Best regards,
                -ChrisL

                Comment

                Latest Posts

                Collapse

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