I want my EA to enter BUY order if new Candle/Bar moves 1 pip higher than open price after all confirmations are met in previous candle.
I want my EA to enter SELL order if the new Candle/Bar moves 1 pip lower than the open price after all confirmations are met in previous candle.
How would you write that code? I want to add that to the EA below.
string TradeTrigger = “None”;
if(TradingTime != “Outside Trading Times” && (RSIDirection == “Long” || RSIDirection == “Not Used”) && (HADirection == “Long” || HADirection == “Not Used”) && (CCI35Direction == “Cross Long” || CCI35Direction == “Not Used”) && (CCI160Direction == “Long” || CCI160Direction == “Not Used”)) TradeTrigger = “Open Long”;
if(TradingTime != “Outside Trading Times” && (RSIDirection == “Short” || RSIDirection == “Not Used”) && (HADirection == “Short” || HADirection == “Not Used”) && (CCI35Direction == “Cross Short” || CCI35Direction == “Not Used”) && (CCI160Direction == “Short” || CCI160Direction == “Not Used”)) TradeTrigger = “Open Short”;
So the ea basically places pending buy order 1 pip above open, and pending sell order 1 pip below open.
Learning to code from scratch is quite a lot of work, if you want a quicker option learn to use a graphical ea builder. Fxdreema for example.
Try this way;
for buy if(Close[0]-Open[0]>=1Point)
for sell if(Open[0]-Close[0]>=1 Point)
if I make it
for buy if(Close[1]-Open[0]>=1*Point)
would [1] look back one candle?
Yes, Close[1] is last price in last finished candle, Close[0] - is last price in current candle. Open[0] - is first price in current candle
Keep in mind that 1 pip is very small value, especially with 5-digits broker.
1 pip is always the 4th decimal, fifth one is called a point.
1 point is always 1 point, last digit in price.
Alumitrader:
I want my EA to enter BUY order if new Candle/Bar moves 1 pip higher than open price after all confirmations are met in previous candle.
I want my EA to enter SELL order if the new Candle/Bar moves 1 pip lower than the open price after all confirmations are met in previous candle.
How would you write that code? I want to add that to the EA below.
extern int PointDiffer = 1 ;
string TradeTrigger = “None”;
if(TradingTime != “Outside Trading Times” && (RSIDirection == “Long” || RSIDirection == “Not Used”) && (HADirection == “Long” || HADirection == “Not Used”) && (CCI35Direction == “Cross Long” || CCI35Direction == “Not Used”) && (CCI160Direction == “Long” || CCI160Direction == “Not Used”)) TradeTrigger = “Open Long”;
if(TradingTime != “Outside Trading Times” && (RSIDirection == “Short” || RSIDirection == “Not Used”) && (HADirection == “Short” || HADirection == “Not Used”) && (CCI35Direction == “Cross Short” || CCI35Direction == “Not Used”) && (CCI160Direction == “Short” || CCI160Direction == “Not Used”)) TradeTrigger = “Open Short”;
string TradeTrigger = “None”;
if(TradingTime != “Outside Trading Times” && (RSIDirection == “Long” || RSIDirection == “Not Used”) && (HADirection == “Long” || HADirection == “Not Used”) && (CCI35Direction == “Cross Long” || CCI35Direction == “Not Used”) && (CCI160Direction == “Long” || CCI160Direction == “Not Used”)&& Close[0]-Open[0]>=PointDifferPoint) TradeTrigger = “Open Long”;
if(TradingTime != “Outside Trading Times” && (RSIDirection == “Short” || RSIDirection == “Not Used”) && (HADirection == “Short” || HADirection == “Not Used”) && (CCI35Direction == “Cross Short” || CCI35Direction == “Not Used”) && (CCI160Direction == “Short” || CCI160Direction == “Not Used”)&& Open[0]-Close[0]>=PointDiffer Point) TradeTrigger = “Open Short”;
I think you better make additional external parameter in order to optimise difference between open price of candle and new move.