EMA value discrepancy between preset indicator and code

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #192047 quote
    jackjour
    Participant
    New

    Please help to solve the issue.

    I use the following code to graph EMA12, EMA144 and EMA169, it shows that the value of EMA12 is exactly the value with the default indicator in the PRT system (as shown in the attached jpg). However, there are discrepancy for EMA 144 and EMA169, so which one is the correct one?

    
    DEFPARAM CumulateOrders = False 
    
    
    indicator1 = ExponentialAverage[12](close)
    c1 = (close CROSSES OVER indicator1)
    indicator3 = ExponentialAverage[144](close)
    c2 = (indicator1 >= indicator3)
    indicator5 = ExponentialAverage[169](close)
    c3 = (indicator1 >= indicator5)
    
    IF c1 AND c2 AND c3 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    graph indicator1
    graph indicator3
    graph indicator5
    
    c4 = (close crosses under indicator1)
    
    if c4 then
    SELL AT MARKET
    endif
    
    EMA-comparision.jpg EMA-comparision.jpg
    #192049 quote
    robertogozzi
    Moderator
    Master

    I think it’s a rounding issue between ProOrder and ProBuilder; the longer the periods, the (slightly) higher the difference.

    Bear in mind that prices are plotted with only 1 decimal digit, while EMAs show more; if you only consider one decimal digit then they are identical.

    Such slightly differences do not usually affect operations.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

EMA value discrepancy between preset indicator and code


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
jackjour @jackjour Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
3 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/22/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...