Why don't you take the sample EA "Moving Average.mq4" from your expert folder and change this acc. to you needs?
int SMA5,SMA34,CurrentDirection,TotalOrdersOpened=0; TotalOrdersOpened=OrdersTotal(); SMA5=iMA(MarketSymbol,TimeFrame,5,0,MODE_SMMA,PRICE_CLOSE,0); SMA34=iMA(MarketSymbol,TimeFrame,34,0,MODE_SMMA,PRICE_CLOSE,0); if(SMA5>SMA34)
- In the current bar, how high, must the market move before the sma's differ by at least 1.0000?
- Don't use the SMMA The Smoothed Moving Average or SMMA - How to Avoid It - NinjaTrader Programming | Big Mike Trading SMMA(x) == EMA(2x-1) Use EMA and you have twice the resolution and more efficiencies.
- In the current bar, how high, must the market move before the sma's differ by at least 1.0000?
- Don't use the SMMA The Smoothed Moving Average or SMMA - How to Avoid It - NinjaTrader Programming | Big Mike Trading SMMA(x) == EMA(2x-1) Use EMA and you have twice the resolution and more efficiencies.
much appreciate your feedback. what you've mentioned makes perfect sense.
I'm quite new to this. what I'm trying to do is its a strategy I do manually. I’d like to automate it and do back tests though.
Vice versa for short, if 5sma crosses below the 34sma, go short on the first price touch of the 34sma after the cross, if you are not already in a trade.
would appreciate your help
- In the current bar, how high, must the market move before the sma's differ by at least 1.0000?
- Don't use the SMMA The Smoothed Moving Average or SMMA - How to Avoid It - NinjaTrader Programming | Big Mike Trading SMMA(x) == EMA(2x-1) Use EMA and you have twice the resolution and more efficiencies.
Also I was under impression that iMA(MarketSymbol,TimeFrame,5,0,MODE_SMMA,PRICE_CLOSE,0); will give me the current SMA on 10 minute chart as TimeFrame=10, regardless of the open/close price of that last candle.
Am I wrong?
Traditionally mt4 only supports M1, M5, M15, M30, ...
In the Reference they now write that more TimeFrames seems to exists and you might get some values. But at least you can't open any chart with these new TimeFrames.
Hi floater!
I think there is a misunderstanding in the condition. I have put the MA 5 and 34 with SMMA,close settings on the eurusd chart.
if(SMA5>SMA34) { Print("sma(5): "+IntegerToString(SMA5)+" sma(34): "+IntegerToString(SMA34)+ " (Time Frame "+IntegerToString(TimeFrame)+") ***** UP Trend ****"); if (Ask<=SMA34)
And I see misunderstanding in the 2 if conditions. If sma5>sma34 then the price is always higher than sma34. If yes it is higher, than your 2nd if condition never meets. Positions will not open. And vica versa.
Please check it one more times.
Cheers
Hi floater!
I think there is a misunderstanding in the condition. I have put the MA 5 and 34 with SMMA,close settings on the eurusd chart.
And I see misunderstanding in the 2 if conditions. If sma5>sma34 then the price is always higher than sma34. If yes it is higher, than your 2nd if condition never meets. Positions will not open. And vica versa.
Please check it one more times.
Cheers
If indeed he wants this, I can see how very limited number of trades would occur if any.
Not sure the OP wants this or not. Perhaps he wanted 5 crosses above 34 && ask also > 34/above then trade. ? and vice versa
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
would appreciate your help and feedback
I wrote the following EA and it's a very simple strategy, but it doesn't when apply to the a chart and there fore when I do back testing it doesn't open or close any trades
Thanks