help with loop testing for condition over time.

Forums ProRealTime English forum ProScreener support help with loop testing for condition over time.

Viewing 2 posts - 1 through 2 (of 2 total)
  • #36186

    I try to create a loop that will check the existence of a condition for a certain length of time.

    In this case, the short average is above the long average for the last 16 days.
    (Indicating an upward trend)

    At the moment there are at least two technical problems that I can not find a solution to,
    I would be very happy if anyone could explain or suggest a way to solve the problem.

    1. As you will see in the code, at the moment he can check the existence of the condition only in one candle (16 candles back)
    But he does not do that either – I checked and I get the wrong results.

    2. The second problem – I can not find a way to stop the loop if the program found one day when the condition is not met. (I’ve tried teaching BREAK in some variations, but without success)

    Maybe a loop does not work at the scanner?

    Could someone please help?

    #36253

    The “a” variable should be incremented each time you find that your SMA>LMA condition is true, to get the days quantity of this condition to be valid in the past.

    SMA and LMA variables should also been compared in the loop iteration, not at their actual values:

     

    2 users thanked author for this post.
Viewing 2 posts - 1 through 2 (of 2 total)

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