Please help for a forloop scan

Forums ProRealTime English forum ProScreener support Please help for a forloop scan

Viewing 6 posts - 1 through 6 (of 6 total)
  • #159748
    Ha

    Hi,

    I’m trying to scan that N number of consecutive candles are bullish and above 20EMA.

    I used a forloop to scan and I’m not getting a correct result.

    Can someone please tell me if you see a problem with my code? or is there other way to code it?

    Thank you.

    #159751

    I can’t read your code now (you’d better always post also the code, unless it’s over hundreds of lines).

    This is the code:

    x is true whenever N consecutive bullish candles above ema20 are met.

     

    #159764
    Ha

    Hi

    Thank you for the help.

    I’d already tried the summation fonction before, it doesn’t work well.

    That’s why I tried a forloop.

    Here’s my entire code.

     

    #159780

    My fault, I coded an SMA instead of EMA. Replace line 2 with:

     

    1 user thanked author for this post.
    avatar Ha
    #159827
    Ha

    Hi Roberto

    Your code works, thank you.

    Would  you mind explain how the last line works ?

    Can’t get my head around how you can give a condition in a price constant () then an arithmetic sum of that condition can bring back what I want.

    #159837

    It sums up the condition for the last N bars and the result must be N, otherwise it would mean that the condition is not true for all N bars.

     

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

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