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 pvincent, 06-23-2022, 12:53 PM
              14 responses
              238 views
              0 likes
              Last Post Nyman
              by Nyman
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              9 responses
              382 views
              1 like
              Last Post Gavini
              by Gavini
               
              Started by oviejo, Today, 12:28 AM
              0 responses
              1 view
              0 likes
              Last Post oviejo
              by oviejo
               
              Started by pechtri, 06-22-2023, 02:31 AM
              10 responses
              125 views
              0 likes
              Last Post Leeroy_Jenkins  
              Started by judysamnt7, 03-13-2023, 09:11 AM
              4 responses
              59 views
              0 likes
              Last Post DynamicTest  
              Working...
              X