Hi!
I have a MT5 EA that open/close orders at first closed candle reversion. I need to modify it to open/close orders at second closed candle.
The original code is:
//---
FastMAPrevious = iClose(_Symbol,0,2);
FastMACurrent = iClose(_Symbol,0,1);
SlowMAPrevious = iOpen(_Symbol,0,2);
SlowMACurrent = iOpen(_Symbol,0,1);
}
else
{
FastMAPrevious = iClose(_Symbol,0,1);
FastMACurrent = iClose(_Symbol,0,0);
SlowMAPrevious = iOpen(_Symbol,0,1);
SlowMACurrent = iOpen(_Symbol,0,0);
}
//--- CONDITION CHECK
if(!ReverseCondition)
{
//--- BUY CONDITION
BuyCondition=(FastMAPrevious<SlowMAPrevious && FastMACurrent > SlowMACurrent);
//--- SELL CONDITION
SellCondition=(FastMAPrevious>SlowMAPrevious && FastMACurrent<SlowMACurrent);
}
else
{
//--- BUY CONDITION
SellCondition=(FastMAPrevious<SlowMAPrevious && FastMACurrent>SlowMACurrent);
//--- SELL CONDITION
BuyCondition=(FastMAPrevious>SlowMAPrevious && FastMACurrent<SlowMACurrent );
}
Can anyone help me?
- Universal MA Cross EA
- How to code?
- additional timeframe condition
ZeduTrader:vI have a MT5 EA that open/close orders at first closed candle reversion. I
need to modify it to open/close orders at second closed candle.
- Please edit your (original) post and use the CODE
button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor -
FastMAPrevious = iClose(_Symbol,0,2); FastMACurrent = iClose(_Symbol,0,1); SlowMAPrevious = iOpen(_Symbol,0,2); SlowMACurrent = iOpen(_Symbol,0,1);
1) your code is not a moving average (MA) 2) is not a fast or slow. - Your posted code does not open/close any orders.
William Roeder:
Yes! It was an MA cross code, but not now. Just the name remained MA. Not consider it.- Please edit your (original) post and use the CODE
button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor - 1) your code is not a moving average (MA) 2) is not a fast or slow.
- Your posted code does not open/close any orders.
This EA is workink very well and open/close order at reversal candle. I just want to modify it to open after close of second candle.
ZeduTrader:
Yes! It was an MA cross code, but not now. Just the name remained MA. Not consider it.
Yes! It was an MA cross code, but not now. Just the name remained MA. Not consider it.
This EA is workink very well and open/close order at reversal candle. I just want to modify it to open after close of second candle.
Set a GLOBAL FLAG and open/close later after close of second candle, then CLEAR the flag.
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