Moving AVerage Crossover for Multiple days

Forums ProRealTime English forum ProScreener support Moving AVerage Crossover for Multiple days

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

    Good day,

    I was wondering if anyone can assist with with a moving average cross for a number of days. For example below is the bearish moving average which shows all the instruments where its 50 day moving average crosses below its 200 moving average for today. However, I don’t want just today’s bearish Moving average crossover , but I want to see the last 5 days. If anyone can assist I would really appreciate it.

    Thanks.

    #142631

    Hi, please find attached.

    I have set the field “DayCount = 4” covering five days, change it to any number (e.g., changing it to 9 will give crossover in last 10 days).

    Have fun …kaq52

     

    #142643

    Replace lines 17-22 with this ONE:

    As for your FOR…NEXT iterations, 0 TO DAYCOUNT will check the last 5 periods, while summation 4 (the last 4, not 0 to 4).

     

     

    1 user thanked author for this post.
    #142664

    Thanks RobertGozi, your solution looks much precise.

    My understanding so far is that “for i = 0 to daycount” with daycount=4 loop will get below five values, thus covering five days(including current one). Is this understanding not correct please?

    ma20[0] —current candle

    ma20[1]

    ma20[2]

    ma20[3]

    ma20[4]

    1 user thanked author for this post.
    #142669

    Yes, that’s correct.

    Summation, instead, with the same value for DayCount you’ll check one less bar, 0 to 3.

    #142798

    Thank you very much for assistance. Appreciated.

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