# Elder Ray 0

Posted on 18, February 2014

in Category SID

### Description for ElderRay SID 933

The Elder Ray strategy is based on 2 oscillators; Bull Power and Bear Power. Both of which was developed by Dr Alexander Elder. The aim of the oscillators was to show buying and selling power within the market.

The Elder Ray strategy is based on 2 oscillators; Bull Power and Bear Power. Both of which was developed by Dr Alexander Elder. The aim of the oscillators was to show buying and selling power within the market. This system is an interpretation of this and the following principles are applied:

– A long position will be executed when; the Bear Power is below zero, there is a bullish convergence and the closing price closes above the EMA(65).

– A short position will be executed when; the Bull Power is above zero, there is a bearish convergence and the closing price closes below the EMA(65).

– Trades will be closed upon Bull/Bear Power crossover e.g. if you had a long position and the Bear Power oscillator crosses below zero then your position will be closed.

Bar event logic:

```my \$bulls = BullsPower(); #Bulls Power Oscillator.
my \$bears = BearsPower(); #Bears Power Oscillator.
my \$ema = EMA(Close,\$emaPeriod); #EMA with a period of 65. emaPeriod variable is set under "BullsBearsSystem -> Variables".

#If there is no positions for the current symbol...
if(NoPosition){

#Opens a long position when there is a bullish convergence, the Bears Power is below zero and the closing price is above the exponential moving average.
BuyOpen if \$bearsPike!=0 && \$bearsPikePrevious!=0 && \$bearsPike>\$bearsPikePrevious && Now(\$bears)>0 && Previous(\$bears)<0 && ClosePrice>Now(\$ema);
#Opens a short position when there is a bearish convergence, the Bulls Power is above zero and the closing price is below the exponential moving average.
SellOpen if \$bullsPike!=0 && \$bullsPikePrevious!=0 && \$bullsPike<\$bullsPikePrevious && Now(\$bulls)<0 && Previous(\$bulls)>0 && ClosePrice<Now(\$ema);

}else{
#If there isn't any positions for the current symbol...

#Close long position when the Bears Power falls below zero.
#Close short position when the Bulls Power is greater than zero.

}

#Pike calculation. This will record pikes in order to determine the convergence direction at a later stage.
if( Ago(\$bears,2)>Previous(\$bears) && Previous(\$bears)<Now(\$bears) && Ago(\$bears,2)<0 && Previous(\$bears)<0 && Now(\$bears)<0 && Ago(\$bears,2)>Now(\$bears) ){
\$bearsPikePrevious = \$bearsPike;
\$bearsPike = Previous(\$bears);
}

if( Ago(\$bulls,2)<Previous(\$bulls) && Previous(\$bulls)>Now(\$bulls) && Ago(\$bulls,2)>0 && Previous(\$bulls)>0 && Now(\$bulls)>0 ){
\$bullsPikePrevious = \$bullsPike;
\$bullsPike = Previous(\$bulls);
}

#Reset Pikes if reversal.
\$bearsPike = 0 if Now(\$bears)>0;
\$bearsPikePrevious = 0 if Now(\$bears)>0;
\$bullsPike = 0 if Now(\$bulls)<0;
\$bullsPikePrevious = 0 if Now(\$bulls)<0;```