I need to Modify some code that will enter an reverse order every opposite bar close..
I pasted the code below to use for order entry but the orders need to be added and reversed and pending option needs to be added...
If bar closes bullish/up in price when the bar before it was bearish we enter a sell order or sell limit
If bar closes bearish/down in price when the bar before it was bullish we enter a buy order or buy limit
Takeprofit = 200
Stoploss = 30
Pending orders = True/False
extern bool NO_opposite_bar_check=false;
extern int count_bar_entry=1;
bool valid_buy=false;
bool valid_sell=false;
int bar=1;
int timeframe=0;
double open,close;
int last_count_bar;
if(NO_opposite_bar_check) last_count_bar=bar+count_bar_entry-1;
else if(!NO_opposite_bar_check) last_count_bar=bar+count_bar_entry;
int x,y,j;
for(j=bar;j<=bar+count_bar_entry-1;j++)
{
open=iOpen(Symbol(),timeframe,j);
close=iClose(Symbol(),timeframe,j);
if(open<close) x++;
else if(open>close) y++;
}
if(NO_opposite_bar_check)
{
if(x==count_bar_entry) valid_buy=true;
else if(y==count_bar_entry) valid_sell=true;
}
else if(!NO_opposite_bar_check)
{
double open_1=iOpen(Symbol(),timeframe,last_count_bar);
double close_1=iClose(Symbol(),timeframe,last_count_bar);
if(x==count_bar_entry && open_1>close_1) valid_buy=true;
else if(y==count_bar_entry && open_1<close_1) valid_sell=true;
}
I am a professional MT4 programmer with 10+ years coding experience. I strive to deliver my customers the best product and provide outstanding service. All my EAs come with unlimited to ensure that you get exactly what you request, and that it works exactly as per your requirements.
I am available to complete this work, and as such should be able to complete within 24 hours once you accept my proposal to complete your work.