Author Topic: how to plot common buy sell indicator for MA & MACD combination  (Read 3593 times)

mayanksant18

  • Newbie
  • *
  • Posts: 2
    • View Profile
how to plot common buy sell indicator for MA & MACD combination
« on: October 29, 2014, 08:24:37 am »
MACDhistogram= MACD() – Signal() ;
Buy=Cross(C,MA(High,10)) AND MACDhistogram > 0;
Sell=Cross(MA(Low,10),C) AND MACDhistogram < 0 ;
PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-15);
PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorGreen, 0,Low, Offset=-15);

this will not give desired result the signal should plot on when both of MA & MACD histogram value higher

please help me on this

kelvinhand

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: how to plot common buy sell indicator for MA & MACD combination
« Reply #1 on: September 29, 2015, 07:17:38 am »
MACDhistogram= MACD() – Signal() ;
Buy=Cross(C,MA(High,10)) AND MACDhistogram > 0;
Sell=Cross(MA(Low,10),C) AND MACDhistogram < 0 ;
PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-15);
PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorGreen, 0,Low, Offset=-15);

this will not give desired result the signal should plot on when both of MA & MACD histogram value higher

please help me on this

Code: [Select]
MACDhistogram= MACD() - Signal() ;
mah = MA(High,10);
mal = MA(low,10);

Buy= BarsSince(MACDhistogram > 0)==0 AND Cross(C,mah);
Sell=BarsSince(MACDhistogram < 0)==0 AND Cross(mal,c);


Plot(MA(High,10), "", colorYellow);
Plot(MA(Low,10), "", colorYellow);

PlotShapes(IIf(Sell, shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-15);
PlotShapes(IIf(Buy, shapeUpArrow , shapeNone), colorLime, 0,Low, Offset=-15);