6 ema crossing strategy

Forums ProRealTime English forum ProOrder support 6 ema crossing strategy

This topic contains 10 replies, has 2 voices, and was last updated by avatar robertogozzi 1 year, 3 months ago.

Currently, there are 1 user and 1 guest visiting this topic.
View all attachments


Viewing 11 posts - 1 through 11 (of 11 total)
  • #84226

    Hi all, please help me with the code on this 6ema crossing strategy.

    set 1: ema 34/89/144 (LT ema)
    set 2: ema 8/13/21 (ST ema)

    for short term trading:

    1. determine trend
    when both sets of ema are in alignment, can go long or short in according to the alignment (small to big = long) (big to small = short)

    2. Determine Trigger
    when the 2 smallest EMA (8 cuts 13) in according to the alignment, then enter LONG or SHORT

    exit trade (take profit) also in accordance to the crossing of the 2 smallest ema (8 cuts 13)

    thanks in advance!


    Try this (tested only for syntax errors):


    1 user thanked author for this post.
    avatar rae

    hi robert, there is no syntax error but how can adjust the coding to get a better win/lose ratio? and also to avoid multiple entries.

    i tested in on EU 1h and it gave me the result in the attachment


    Apart from modifying the periods of the averages, you could add a trailing stop and have a try.

    What do you mean by “avoid multiple entries“?

    Line 1 and also lines 36 and 40 make sure there are not multiple entries at the same time.

    After a crossing occurs there will be no new entry till the next crossing, provided there is the correct alignement of MA’s.



    thanks robert.
    1. there is this case in one of the attachments below where it entered twice.

    2. and how is possible to code to capture entry after the STemas crossing but before LTemas are in alignments? (see attachment)

    thanks again


    As for question 1, I have experienced two almost adjacent crossings causing a long trade to enter twice on Oct. 16th (see attached pic), which is correct, but you may want to ban the strategy from entering again before, say, 10-15 bars, or till the next day!

    As for question 2, despite not requiring LTemas to be aligned do you want them ALL to still be above/below STemas & STemas to be aligned besides crossing?


    hi robert, perhaps this attachment is clearer of what the strategy is intended to be. thanks for your help


    Point 3 requires ALL STemas to crossover ALL LTemas?  If not, which LTemas needs to be crossed over by STemas and which one doesn’t?

    Unfortunately your pic is fine for trading manually while watching your charts, but coding that behaviour in an automated strategy is not that easy, for instance you, at point 2, say “approaching”, but a piece of software cannot understand, approaching is 10 pips away or maybe just 2, or crossing (which one of the six EMAs should approach or cross the other group to handle it properly)?

    You must TELL (pics don’t help me much in this case) me what those six EMAs have to do exactly.



    hi robert, replying to your questions:

    Point 3 requires ALL STemas to crossover ALL LTemas? All STemas has to first cross over Ema34 and subsequently all STemas together with Ema34 has to cross over Ema89 and Ema144

    STemas are for entry and exit and they react the fastest to trend change, hence they are also the trend determinant. When the smallest Ema crosses the middle one, it will signal a sign of trend change.

    LTemas are more for the long term trend change, they respond the slowest, hence the crossing of all STemas with LTemas will be the confirmation for trend change.

    So to consolidate my points:

    1. STemas crossing – (ema8 over ema13) or (ema8 over ema21)
    2. all STemas cross LTema1 (ema34) – to take action
    3. all STemas is above all LTemas



    Sorry for not being able to take a look at it today, I’ll have one tomorrow.

    1 user thanked author for this post.
    avatar rae

    Your last post differs considerably from your first one, this is the code:


    Due to multiple crossings on the same bar it generates very few trades.

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

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