Why is EMA20 different in Indicator program and Screener program ?

Forums ProRealTime English forum ProScreener support Why is EMA20 different in Indicator program and Screener program ?

  • This topic has 3 replies, 2 voices, and was last updated 3 months ago by avatarJS.
Viewing 4 posts - 1 through 4 (of 4 total)
  • #226683

    Hi all,
    I modify and combine technical Indicators to compose a stock screener based on my preferences. So I first use the Indicator program and then transfer my Indicators to the Screener program part. Day candles is fine for me.

    Following an old suspicion, I created a “check” with an EMA, to see if Chart/Indicator program and in PRT Screener program really use the same calculation values. Therefore, I “stripped” an EMA Indicator and used the command lines both for screener and Indicator. A a tweak, I used the (…) in the last SCREENER line to display the EMA in the results list and thus, make it visible.

    Unfortunately, I found a mismatch for my results – which puts the feasability of using the scanner for my purposes into question… This is where I need your help.

    – What went wrong ?
    – Do I use the program appropiately; can I use the screener with selfmade indicators using EMA, RSI etc, which will be calculated over a series of candels at all ?

    This is my code plus results:
    // ———————————————-
    // Comparisation of PRT Screener and PRT Indicator program
    // by öse
    // for check of the same indicator ouput both in “Screener” and in “Indicators” program section
    // –> similar period & codelines used in both
    // Sample Indicator = EMA[N] periods –> Variable: N = EMAperiod
    // Sample Market = DAX40
    // MinPrice & MinVolume only in this case intentionally set to “0” for testing
    // Result A : Are indicator values the same ?
    // Result B : Is full stock list in output (eg. for export (50 lines))
    // Including (EMAline) in the screener output will display the EMAline value in output list to make it visible for comparisation
    // you can “play” by additionally activating line (2) in Screener & Indicator code (and adjusting SCREENER line accordingly)
    //
    // ——-Prerequsites————————–
    //
    // Variable: MinPrice , type = integer , default = 0 –> all stocks will be included 🙂
    // Variable: MinVolume , type = integer , default = 0 –> all stocks will be included 🙂
    // Variable: EMAperiod , type = integer , default = 20
    //
    TIMEFRAME(daily)
    //
    //——-calculations————————–
    //
    EMAline = ExponentialAverage[EMAperiod](close) // line (1)
    //
    //EMAslope = (EMAline – EMAline[1]) / EMAline[1] * 100 // line (2) … activate or deactivate for testing
    //
    PriceCondition = (close) > 0 // –> all stocks will match criteria 🙂
    //
    // Screener ——————————————————————————–
    SCREENER[PriceCondition AND close > MinPrice AND Volume > MinVolume ](EMAline)
    //

    ——————-

    This is what I found for the example Stock Addidas as per 22 Jan 2024 :

    Prerequisite: / Indicator: / Screener:
    line(1), EMAperiod = 1 / 164,68 / 164,68
    line(1), EMAperiod = 20 / 165,43 / 176,62
    line(1), EMAperiod = 100 / 172,48 / 177,71

    As you you see, except if I put [EMAperiod] down to [1] the results differ. It gets even worse if I add further calculations such as line (2)

    Prerequisite: / Indicator: / Screener:
    line(1,2), EMAperiod = 1 / 0,0729 / -0,17
    line(1,2), EMAperiod = 20 / -0,0475 / -0,71
    line(1,2), EMAperiod = 100 / -0,0913 / -0,15

    Thanks a lot in advance / meci

    #226730
    JS

    Hi @tomse

    When I compare the screener and the indicator, they are exactly the same… (see screenshot)

    Where the differences may come from is:

    When you use the free version of PRT, the screener is always 1 bar behind…

    When you use the complete version, the screener has a maximum memory of 256 bars, which is insufficient to properly calculate the EMA200…

    If you use the Premium version, you will have 1024 bars of memory, and this should be enough…

    #226815

    Hi @JS and dank u wel for your quick reply!
    Following your answer, I re-checked Monday evening and I found the results to be (almost)  similar, just as you found it. I did not change the code. See screenshot attached.

    Maybe this was related to testing at the weekend, I will need to check that the other weekend. I use the “complete” version, with realtime data. Thank you for the hint with the “professional” version, currently my max. EMA was 100, but maybe I will need to update in the future.

    Anyway, this gives me a relief 🙂 How did you manage to display the EMA “Name” at the top of the coulumn ? (“Kriterium” is only a default header name)

    Cheers, Tom

    #226817
    JS

    Hi Tom

    It’s great that it’s works again…

    If you want to change the name at the top of the column, use for example:

    EMA20=ExponentialAverage[20](Close)

    C1=Close>EMA20

    Screener[C1](EMA20 as “EMA20”)

    (In V12 you can add more names and columns)

    Regards, Jaap

    1 user thanked author for this post.
Viewing 4 posts - 1 through 4 (of 4 total)

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