code for previous low

Forums ProRealTime English forum ProScreener support code for previous low

Viewing 5 posts - 1 through 5 (of 5 total)
  • #136835

    Hi

    Apologies as I’m sure this is a simple piece of code but I can’t seem to work it out.

    I would like to code for the previous low, but not over a particular number of bars. just however long that previous low is before current price. I’ll then use that to create a signal at 20$% above that. I’ve tried to use:

    LOWEST [n] (low) but I can’t work out how to allow the flexibility of the time parameter.

    Thank you for your help.

     

    #136838

    n can be 254 bars maximum, be it on a 1-minute or a 1-week TF.

    #136904

    Hi

    Many thanks. I do understand that, but is there a way I can code for a previous low rather than set a ‘LOWEST’ point determined by a number of bars. Depending on how many bars you set, these 2 methods can give different results. The previous low could be only a few bars before the current bar or it could be 200 bars before, so I don’t want to restrict to a set number of bars. It sounds simple but I’m not sure how to do it.

     

    Many thanks

    #136909

    Once you have used

    to know what price that LOW is, you need an iteration (loop) to scan bars beackwards till you find the right one, which can be 4 or 253 bars away:

    at the end of the FOR…NEXT loop variable i (counter) will retain the index value of the bar retaining that low, can be 0 if it’s the current bar (LOW[0] or LOW) or any other value up to 253.

     

    #136913

    That’s great Roberto, many thanks for your time and help.

Viewing 5 posts - 1 through 5 (of 5 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login