Show your code.
// check for long position (BUY) possibility
if(MacdCurrent>0 && MacdPrevious2<0 && MacdCurrent>SignalCurrent)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-SL*Point,Ask+TakeProfit*Point,"macd sample",16384,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
if(MacdCurrent>0 && MacdPrevious2<0 && MacdCurrent>SignalCurrent)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-SL*Point,Ask+TakeProfit*Point,"macd sample",16384,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
That's my code for the long position. What I really want to know is exactly how I write code for when the line in the MACD chart goes above or below the current bar. Does that make sense? I think that SignalCurrent and my definition for SignalCurrent above is correct, but I am not sure.
I've attached a chart of the situation I want to capture. The crossing of the MACD and the red line (again, Signal line?) that I've circled in green.
Thanks

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Quick question for an expert advisor. I don't meant to get too untechnical, but I want a trade to open when the RED signal line in the MACD chart goes be.ow the level of the current bar. In my code, in the section for opening a long position, if i write: MacdCurrent>SignalCurrent and MacdCurrent=iMACD(NULL,PERIOD_H1,12,26,9,PRICE_CLOSE,MODE_MAIN,1) and SignalCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1) will that open a trade when the current RED signal line is below the MACD bar?
Any input would be of help.
Thanks.