I am a total coding virgin
I have a very useful utility ea ( for me anyway ) that simply places an order in the selected diretion at the open of the next candle ( every candle )
I have looked everywhere on the web for a revised version that meets my requirements, with no luck
I have also tried my hamfisted cut and paste coding from other ea's but can not get the darn thing to work as I need
I would like the ea to place orders as follows :-
If OpenShort is selected - only place order if the previous candle was a BULL candle
If OpenLong is selected - only place order if the previous candle was a BEAR candle
Can some kind soul help me please
Thank you
Code: Select all
extern double LotSize = 0.5;
extern bool OpenShort = true;
extern bool OpenLong = true;
extern int Slippage = 3;
extern double StopLoss = 100;
extern double TakeProfit = 100;
int init() { return(0); }
int deinit() { return(0); }
int start()
{
static datetime prevTime = 0;
if (prevTime==Time[0] || prevTime==0)
{
prevTime=Time[0];
return(0);
}
double point = Point*MathPow(10,MathMod(Digits,2));
if (OpenLong) OrderSend(Symbol(),OP_BUY ,LotSize,Ask,Slippage,Ask-StopLoss*point,Ask+TakeProfit*point,"",0,0,CLR_NONE);
if (OpenShort) OrderSend(Symbol(),OP_SELL,LotSize,Bid,Slippage,Bid+StopLoss*point,Bid-TakeProfit*point,"",0,0,CLR_NONE);
prevTime=Time[0];
return(0);
}