Please i need to add an extra condition to this filter

 
//MACD Filter
double macd_main = iMACD(a_symbol_0,0,12,26,9,PRICE_CLOSE,MODE_MAIN,1);
double macd_sig = iMACD(a_symbol_0,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1);
if ((a_cmd_8==OP_BUY)&&(macd_main<0))
{
return(0);
}
if ((a_cmd_8==OP_SELL)&&(macd_main>0))
{
return(0);
}

can you fix this code so that if the criteria for a buy trade is met
but the current candle is bearish on the 1m chart the ea should not
trade and also if the criteria for a sell trade is met but the current
candle on the 1m chart is bullish the ea should not trade.
 

Please use this to post code . . . it makes it easier to read.

 
worknet:
can you fix this code so that if the criteria for a buy trade is met
but the current candle is bearish on the 1m chart the ea should not
trade and also if the criteria for a sell trade is met but the current
candle on the 1m chart is bullish the ea should not trade.
You can't know if the current M1 candle is bullish or bearish until it is finished . . then it becomes candle number 1
 
RaptorUK:
You can't know if the current M1 candle is bullish or bearish until it is finished . . then it becomes candle number 1



can you think of a way to achieve the same goal?

 
worknet:



can you think of a way to achieve the same goal?



could say if price is lower than the previous candle's high then dont trade.

what do you think and vice versa, can we talk on skype or something it takes a while to get replies on here, skype name: ace112

 
worknet:



could say if price is lower than the previous candle's high then dont trade.

what do you think and vice versa, can we talk on skype or something it takes a while to get replies on here, skype name: ace112

Sorry too busy for that . . . unless you want to pop over and make my Christmas cake for me ?

Just use M1 bar 1 . . . check the Open vs the Close values to determine if it Bull or Bear . .

https://docs.mql4.com/series/iOpen vs https://docs.mql4.com/series/iClose

Reason: