EMA strategy 3 candles
Forums › ProRealTime English forum › ProOrder support › EMA strategy 3 candles
- This topic has 7 replies, 4 voices, and was last updated 5 months ago by GraHal.
-
-
06/10/2024 at 8:36 PM #233712
Hello,
I would like to ask a strategy that works this way:
EMA50<EMA100<EMA200 and with a distance between them that can be defined
buy if close crosses over ema 200 and the close of three candle before is lower than EMA50 (so price needs to crosse the three EMA in not more than 3 candles)
the opposite for short.
thank’s in advance
Alessio
06/10/2024 at 8:39 PM #233713I did something like this but it opens also position when it shouldn’t.
EMA strategy1234567891011121314151617181920212223DEFPARAM CumulateOrders = falseEma50= ExponentialAverage[50](close)ema100= ExponentialAverage[100](close)Ema200= ExponentialAverage[200](close)c1= close crosses under ema200 and close[barindex-3]>=ema50c2= close crosses over ema200 and close[barindex-3]<=ema50c3=ema50>ema100c4=ema100>ema200c5=ema50<ema100c6=ema100<ema200If not longonmarket and c2 and c5 and c6 thenBuy 1 contract at MarketendifIf longOnMarket AND (BarIndex - TradeIndex) >= 4 ThenSell at MarketEndifIf not shortonmarket and c1 and c3 and c4 thensellshort 1 contract at MarketendifIf shortOnMarket AND (BarIndex - TradeIndex) >= 4 Thenexitshort at MarketEndifexit is just to try, nothing defined
06/11/2024 at 7:35 AM #23371806/11/2024 at 7:56 AM #23372006/11/2024 at 7:57 AM #233721I didn’t see your answer…
As Roberto says, better 2 than… 🙂2 users thanked author for this post.
06/11/2024 at 10:27 PM #23377206/12/2024 at 7:33 AM #233778Hi,
Maybe you should check the Probuilder’s manual or at least here https://www.prorealcode.com/documentation/close/
I think doing that will clarify your doubts.
06/12/2024 at 9:48 AM #233794why close[barindex–3] was not correct.
barindex increases by 1 for every new candle and so if your Algo has been running for 600 candles then you would have close[barindex–3] = close[597]
-
AuthorPosts
Find exclusive trading pro-tools on