Elder Ray Bull Bear Power

Please code for this

Buy:

  1. The trend is up as indicated by 14 EMA.
  2. Bear power is negative but rising.
  3. Bull power's latest peak is higher than it was previously.
  4. Bear power is moving higher from a bullish divergence.

Sell: The corresponding sell signal is realized when prices hit a new high but bull power reaches a lower peak than that of its previous rally.

  1. The trend is down as indicated by 14 EMA.
  2. Bull power is positive but falling.
  3. Bear power's latest bottom is deeper than any previous bottom.
  4. Bull power is declining from a bearish divergence. As in the case of buying.

Cover short positions: A new low in price with a new low in bear power points to a continued downtrend; however, with bear power tracing a shallower bottom than prices, a bullish divergence is realized: cover your shorts and prepare for the ensuing uptrend.

The syntax for the above condition is 

TREND(CLOSE,5)=UP AND EMA(CLOSE,14)

The above condition is not clear, please specify in brief and you can modify above syntax values

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//**********NEOTRADE ANALYTICS PVT LTD **************************//
//**********www.neotradeanalytics.com ********************************//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("ERAY_BULL_BEAR");

period= Param("period", 14, 1, 240, 1);
//Calculate EMA for the defined period
EMA_prd = EMA(Close, period);

//Calculate ERay Bull and ERAY Bear
ERayBull= High - EMA(Close,period);
ERayBear= Low - EMA(Close, period);

//Calculate the HH and LL values for ERAY-Bull and ERAY-Bear
Eray_bear_llv = LLV(ERayBear,period); 
Eray_bull_hhv = HHV(ERayBull,period); 

//Buy is when  
// A. when Close > Ema of Period defined
// B. when ERAY Bear Current LL value > ERAY Bear previous LL value
// C. when ERAY Bull Current HH Value > ERay Bull Previous HH value
Buy = (Close > EMA_prd) AND (Ref(Eray_bear_llv,-1) > Ref(Eray_bear_llv,-2)) AND (Ref(Eray_bull_hhv,-1) > Ref(Eray_bull_hhv,-2));

//Sell is when  
// A. when Close < Ema of Period defined
// B. when ERAY Bear Current LL value < ERAY Bear previous LL value
// C. when ERAY Bull Current HH Value < ERay Bull Previous HH value
Sell = (Close < EMA_prd) AND (Ref(Eray_bear_llv,-1) < Ref(Eray_bear_llv,-2)) AND (Ref(Eray_bull_hhv,-1) < Ref(Eray_bull_hhv,-2));

//Filter excess buy or sell signals
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
 
plotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorGreen, 0,L); 
        
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed, 0,H);

Plot(Close,"Close",colorGreen,styleCandle);

_SECTION_END();

Regards

Vivith

www.neotradeanalytics.com

(Authorized vendor of NSE supporting realtime data feeds for Amibroker, Metastock and Ninjatrader)

1 Like