Fetch exact value of Crossing EMA

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10207 quote
    Business Trader Pro
    Participant
    New

    Hello community,

    I am working on a automated strategy and would ask you, if you can help me at one point in my code.

    The strategy includes some EMA’s and i tried to figure out the exactly chartposition (value) when one EMA crosses the other EMA.
    I am still stuck at this point and couldnt even find anything in the code documentation.

    I would like to share my code after backtests here, but i need this parameter for clocking up the performance in real trading and not only in backtesting.

    Does someone knows the right coding?

    Thank you very much

    Trade Wolf

    #10215 quote
    Nicolas
    Keymaster
    Master

    Hello Trade Wolf,

    You can record the EMA value when you detect of the crossing of your 2 moving average:

    if EMA1 crosses over EMA2 then 
     value = EMA1[1]
    endif

    crosses over and crosses under refer to crosses that have already occurred, so you can get value of the EMA within a 1 period offset in the past: EMA1[1]

    I think it should make the trick. Please let us know.

    #10234 quote
    Business Trader Pro
    Participant
    New

    Hi Nicolas,

    this sounds very good and i think this will do the job.

    But now the problem is that the execution of the BUY/SELL-Order starts with the next candle, instead of the exact moment when the EMA’s are crossing. So i will miss the correct entry point for my orders  🙁

    I hope you can tell me the solution for this, if there is anyone.

    Thank you and sorry for my ignorance.

    #10236 quote
    Nicolas
    Keymaster
    Master

    Conditions are tested at bar close and trades are launched at next bar open. That’s how PRT deals with the code.

    It sounds logic since moving average are commonly calculated on price Close, so that’s why we need to wait the candlestick close to validate their crossing.

    #10238 quote
    Business Trader Pro
    Participant
    New

    Thanks Nicolas. This makes sense.

    I will try to go on with this conditions.

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

Fetch exact value of Crossing EMA


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Business Trader Pro
9 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/04/2016
Status: Active
Attachments: No files
Logo Logo
Loading...