EA with 3 Moving Averages New comment Blancomi 2018.08.16 17:22 Hi Everyone! i'm a beginner and i'm trying to create an EA which uses 3 Moving Averages. First i was using 2 MA, no Problem. But there a Problems with 3 MA. The Code: if(timestamp == iTime(Symbol(),Timeframe,0)) return; timestamp = iTime(Symbol(),Timeframe,0); double maFast = iMA(Symbol(),Timeframe,PeriodsMAFast,0,MethodMAFast,PRICE_CLOSE,1); double maSlow = iMA(Symbol(),Timeframe,PeriodsMASlow,0,MethodMASlow,PRICE_CLOSE,1); double maSlower = iMA(Symbol(),Timeframe,PeriodsMASlower,0,MethodMASlower,PRICE_CLOSE,1); double maFastLast = iMA(Symbol(),Timeframe,PeriodsMAFast,0,MethodMAFast,PRICE_CLOSE,2); double maSlowLast = iMA(Symbol(),Timeframe,PeriodsMASlow,0,MethodMASlow,PRICE_CLOSE,2); double maSlowerLast = iMA(Symbol(),Timeframe,PeriodsMASlower,0,MethodMASlower,PRICE_CLOSE,2); if(maFast > maSlow && maFast > maSlower && maSlow > maSlower && maFastLast < maSlowLast && maFastLast < maSlowerLast && maSlowLast < maSlowerLast){ Print("Long"); int ticket = executeLong(); Print(IntegerToString(ticket)); }else if (maFast < maSlow && maFast < maSlower && maSlow < maSlower && maFastLast > maSlowLast && maFastLast > maSlowerLast && maSlowLast > maSlowerLast){ Print("Short"); int ticket = executeShort(); Print(IntegerToString(ticket)); } } Sometimes it works: Sometimes it doesn't work: The EA should open Positions, if the 3 MA a Crossing. Thank you for your help! Ea doesn t open a new position on another symbol EA's don't show Indicators? Martingale MA Carl Schreiber 2018.08.16 19:03 #1 Search first before you try - there is almost nothing that has not been coded for Mt4/5 - I am sure there are quite a lot of EA like yours - without error! RSI Automated New memeber...Deposit by paypal I need to code Blancomi 2018.08.16 19:54 #2 You're Right. But i want to learn how it works New comment
Hi Everyone!
i'm a beginner and i'm trying to create an EA which uses 3 Moving Averages.
First i was using 2 MA, no Problem.
But there a Problems with 3 MA.
The Code:
Sometimes it works:
Sometimes it doesn't work:
The EA should open Positions, if the 3 MA a Crossing.
Thank you for your help!