Hey guys, have a little question here.
So basically I have an EA that enters a trade immediately after two previous candle bars are the same color. For example, buy trade if there are two green candles, it opens right after the second candle end, here are some basic code:
if( Close[1]>Open[1] && Close[2]>Open[2]){ tradetype= OP_BUY; }
if(tradetype== OP_BUY){ priceenter = Ask;}
OrderSend(Symbol(), tradetype,Lot,priceenter ,20,SL,0,NULL,0,0,clrNONE};
However, due to the high spread when the news came out, I usually got a big slippage in price. To avoid this, I want to add some code lines that open the trade ~10s sooner when the 2nd candle closes or maybe open the trade at a designated time. Can anyone plz help me with some ideal functions that can solve this issue?
So basically I have an EA that enters a trade immediately after two previous candle bars are the same color. For example, buy trade if there are two green candles, it opens right after the second candle end, here are some basic code:
if( Close[1]>Open[1] && Close[2]>Open[2]){ tradetype= OP_BUY; }
if(tradetype== OP_BUY){ priceenter = Ask;}
OrderSend(Symbol(), tradetype,Lot,priceenter ,20,SL,0,NULL,0,0,clrNONE};
However, due to the high spread when the news came out, I usually got a big slippage in price. To avoid this, I want to add some code lines that open the trade ~10s sooner when the 2nd candle closes or maybe open the trade at a designated time. Can anyone plz help me with some ideal functions that can solve this issue?