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

Candle reference onpricechange

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

    Candle reference onpricechange

    when using onpricechange and you wish to know when the Current Bar High exceeds the Open of the bar 1 bar ago

    Are you stating the High[0] > Open[1]
    or since this is intrabar is this consider the current close before the bar actually closes

    Close[0] > Open[1]

    thanks

    #2
    Hello DTSSTS,

    Thanks for your post.

    With Calculate.OnPriceChange, High[0] will be the current high of the current forming bar.
    With Calculate.OnPriceChange, Close[0] will be the current price of the current forming bar, which also may be the High of the bar (or not) at that moment.

    If you want the High of the currently forming bar, then use High[0].

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      thanks that is how i was looking at it as well. The reason for the Question is I have sometimes the High[0] > Open[1] will not be true, but my exits are triggering, I may substitue Close for High and see if I can eliminate that issue

      Comment


        #4
        Hello DTSSTS,

        Thanks for your reply.

        I would suggest using print statements to prove the condition.

        Print (Time[0]+" High[0] = "+High[0]+ " Open[1] = "+Open[1]+ " High[0] > Open[1] condition is: "+(High[0] > Open[1] ? "True" : "False"));
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          thanks for the statement, I never know what the Print statement should say, THANKS ALOT

          Comment


            #6
            I HAVE this strategy in Strategy Builder, I will have to unlock the code to add this print Correct? I also do not know where to put the Print in the Code, is there a video showing that



            It just happen here the tops of those RED bars is the Open and the High, the stop out occurred and the price was never close to High 0 exceeding Open1

            Comment


              #7
              Issue is why does it work 2 times then randomly NOT



              3 exits on ths image, all same conditions for exit, also most like Dark Pool Data or something that is not actually plotted on chart but that was an actual real time print

              Comment


                #8
                Hello DTSSTS,

                Thanks for your replies.

                You can construct a print statement in the strategy builder, however, you cannot print the logic of High[0]>Open[1] ? True: False. However, printing the values of High[0] and Low[1] will still allow you to see their values and you can make the comparison.

                Here is a short generic video (looking to see when a condition is true or false) that shows how to construct a print statement in the strategy builder. As shown in the video I think it best if you use an empty set which will provide a lot of data but should allow you to work back through to see when the logic is or is not true. https://paul-ninjatrader.tinytake.co...NV8xMDk5MDc5Nw


                Paul H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by mmenigma, Today, 02:22 PM
                0 responses
                1 view
                0 likes
                Last Post mmenigma  
                Started by frankthearm, Today, 09:08 AM
                9 responses
                34 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by NRITV, Today, 01:15 PM
                2 responses
                9 views
                0 likes
                Last Post NRITV
                by NRITV
                 
                Started by maybeimnotrader, Yesterday, 05:46 PM
                5 responses
                26 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by quantismo, Yesterday, 05:13 PM
                2 responses
                20 views
                0 likes
                Last Post quantismo  
                Working...
                X