Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Highest of n. bars

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

    Highest of n. bars

    Hi

    I'm not sure if (pls remember i'm using Strategy Builder not coding myself) I have this condition:

    Low 0 bars ago, cross below, look back period 1, Donchian Channel 1 bar 1 lower

    I would receive a signal when the Low of this bar cross the lower limit of the Dochian channel set 1 bar ago (for what ever period I set the Donchian Channel).

    ----

    On the same topic, If I use

    Low 0 bars ago, cross below, look back period 1, Low 'n' bars ago

    the n bars ago would mean that the Prices is compared to ALL the prices included in the period from now till 'n'? or just the price of now vs THE (only) price that did happen at the close of 'n' bars ago?

    many thanks as usual
    m

    #2
    Hello percma,

    Thank you for your note.

    The n you pass to Low, for example Low[n], would be assigned an int number, for example 10. So, Low[n] would mean Low[10] or the low 10 bars ago, not everything between.

    If Low[n] was within a loop, then you could loop through everything inbetween. You could see the following post for an example of using a while loop which adds each high to a running total, highValue.



    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply.
      It means I won't be able to loop through everything in between using the Strategy Builder?

      Comment


        #4
        Originally posted by percma View Post
        Thank you for your reply.
        It means I won't be able to loop through everything in between using the Strategy Builder?
        You will not be able to do so. That is the abiding weakness of all code generators: they can only generate that which the developer precodes into them.

        Comment


          #5


          but if I use a Donchian channel like this?

          Low 0 bars ago, cross below, look back period 1, Donchian Channel (n period) bar 1 ago lower

          ...i'm trying to get a signal is the price now (0 bars ago), cross below the lower level of the Donchian channel as it was 1 bar ago. (since now the lower band would be the one set by the price now).

          Comment


            #6
            Hello percma,

            Rather than using cross below, you could check if the low of the current bar is above Donchian 1 bar ago, and the low 1 bar ago was above the Donchian of that bar, which would translate into a cross.

            I attached a screen shot of how you could set this up.

            Please let us know if you need further assistance.
            Attached Files
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              ok. I think what you sent was the low crossing above..but yes. I understand what you were suggesting. many thanks

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Aviram Y, Today, 05:29 AM
              0 responses
              3 views
              0 likes
              Last Post Aviram Y  
              Started by quantismo, 04-17-2024, 05:13 PM
              3 responses
              27 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by ScottWalsh, 04-16-2024, 04:29 PM
              7 responses
              36 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by cls71, Today, 04:45 AM
              0 responses
              6 views
              0 likes
              Last Post cls71
              by cls71
               
              Started by mjairg, 07-20-2023, 11:57 PM
              3 responses
              218 views
              1 like
              Last Post PaulMohn  
              Working...
              X