Danilo Nascimento: ut the part that contains the condition for the candle to cross the
MA I think is not correct.
maHigh = iMA(Symbol(), 0, Period, 0, MODE_SMA, PRICE_HIGH, 0); maLow = iMA(Symbol(), 0, Period, 0, MODE_SMA, PRICE_LOW, 0);
- a) Don't post code that won't even compile. Period is a function. b) Do you really want a SMA(1) on the M1 and a SMA(86000) on the D1?
- Assuming your InitSystem is called only by OnInit, those variables never update.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi all,
I am trying to code a EA with two MAs; First will be a high and the second is a low, both with 20 periods. So the condition is when a candle crosses the upper MA it starts a buy order signal and this order closes when a candle crosses the lower MA. The same happens for a sell order; when a candle crosses the lower MA a sell order is issued and when an other candle crosses the upper MA it closes the order. It is a very simple. I've already coded it, but the part that contains the condition for the candle to cross the MA I think is not correct. It is the part shown below. It is actually not initiating any order. Can someone give me a tip?