John Ehler’s Universal oscillator

The universal oscillator introduced in John Ehlers’ article in this issue, “Whiter Is Brighter,” is an evolution of Ehlers’ SuperSmoother filter, which was introduced in his January 2014 STOCKS & COMMODITIES article “Predictive And Successful Indicators”). The new indicator follows the short-term variations in price without introducing extra delay. It is comfortably controlled through just a single input — the bandedge — which basically is frequency. The smaller it is set, the less lag there is, but the smoother the indicator’s outline will be. Built-in automatic gain control normalizes the output to vary between -1 to +1.

As an illustration of its application, a straightforward short-term countertrend system could, for example, use the following rules:

  • Cover your short position and go long when the universal oscillator crosses below zero
  • Sell and go short when the universal oscillator crosses above zero.

Since it is really a universal oscillator, the indicator can power up a trend-trading system just as easily:

  • Buy when the long-term universal oscillator crosses above zero
  • Sell when the long-term universal oscillator crosses below zero.

 

Universal Oscillator:

bandedge:= 20;
whitenoise:= (C - Ref(C,-2))/2;

{super smoother filter}
a1:= Exp(-1.414 * 3.14159 / bandedge);
b1:= 2*a1 * Cos(1.414*180 /bandedge);
c2:= b1;
c3:= -a1 * a1;
c1:= 1 - c2 - c3;
filt:= c1 * (whitenoise + Ref(whitenoise, -1))/2 + c2*PREV + c3*Ref(PREV,-1);
filt1:= If(Cum(1) = 0, 0, If(Cum(1) = 2, c2*PREV,
If(Cum(1) = 3, c2*PREV + c3*Ref(PREV,-1), filt)));

pk:= If(Cum(1) = 2, .0000001,
If(Abs(filt1) > PREV, Abs(filt1), 0.991 * PREV));
denom:= If(pk=0, -1, pk);
If(denom = -1, PREV, filt1/pk)

Modified SH315 Strategy by Santhosh2010

Basic concept in modified SH315 Strategy:

We are using Total 3 Moving averages :-

Ema 15 based on High.
Ema 15 based on Low.

Ema 3 based on close.(signal line)

Entry logic :-

Long entry : when signal line (Ema 3) is cross (Ema 15,High)
Short entry : when signal line (Ema,3) is cross (Ema 15,low)

Exploration for Metastock:

Col A: CMP/ CLOSE
Col B: BUY/ Cross(Mov(CLOSE,3,E),Mov(HIGH,15,E))
Col C: BUYABOV/ Mov(HIGH,15,E)
Col D: SELLAT/ Mov(LOW,15,E)
Col E: SELL/ Cross(Mov(CLOSE,3,E),Mov(LOW,15,E))
Filter VOLUME>100000 AND CLOSE>50 AND colB=1 OR
colE=1
Filter enabled Yes
Periodicity Daily
Records required 20

Alternate Buy Exploration for Metastock

Col A: CMP/ CLOSE
Col B: BUYABOV/ Mov(HIGH,15,E)
Col C: STOPLOS/ Mov(LOW,15,E)
Filter Cross(Mov(CLOSE,3,E),Mov(HIGH,15,E)) AND
VOLUME>100000 AND CLOSE>50 AND (Fml(
"Volume Oscillator"))>0
Filter enabled Yes
Periodicity Daily
Records required 167

AFL for Amibroker:

 _SECTION_BEGIN("MA Cross");

//Modified SH's 315 Strategy by Santhosh2010
 // Traderji id :Santhosh2010

e1=EMA(C,3);
 e2=EMA(H,15);
 e3=EMA(L,15);

Plot(e1,"",colorYellow,styleDashed |styleThick);
 Plot(e2,"",colorLightYellow,styleDots );
 Plot(e3,"",colorLightYellow,styleDots );

b1=Cross(e1,e2);
 s1=Cross(e3,e1);
 Buysetup=Flip(b1,s1);
 Shortsetup=Flip(s1,b1);
 trend=IIf(BarsSince(Buysetup)<BarsSince(Shortsetup ),1,0);
 Col=IIf(trend==1,colorGreen,4);
 SetBarFillColor(Col);
 Plot(C,"Close",Col,64);

_SECTION_END();

Donchian’s Four-Week Rule

What do Point & Figure charts, Kagi charts, Renko charts, Filtered Waves, and Zig Zag have in common? They are all related to swing charting in some way. Swing charting follows a simple concept: additional information to the chart is made when a new price swing penetrates the level of the prior swing in the same direction. The basis of this type of charting is the filter. Once prices have moved by the distance specified by this filter, a new line is drawn next to the previous one. In a nutshell, it is a chart that shows up and down price movement of a minimum size regardless of the time it takes.

Another concept of swing charts is that it works similarly to a breakout system. A new high made after so many days is a buy signal and a sell signal occurs when a new low is made after so many days. This has been written about for years, by Gann, Merrill, Livermore, Donchian, Hochheimer, Wilder, and Keltner, to name a few. They all used some form of swing charting.

Many swing based systems use volatility as the basis for determining the parameters to use for determining the swing filter. This way, as the current volatility increases, the number of days used in the calculation of the swing filter decreases.

On of the more simple swing systems was Donchian’s Four-Week Rule. Buy when the current price goes above the highs of the previous 4 full weeks. Sell (go short) when the price falls below the lows of the previous 4 full weeks. That’s it. Guess what? In 1970, Dunn and Hargitt Financial Services rated it as the best of the popular systems of the day.

There are a host of different swing charting techniques. Some use 3 consecutive new highs as an up move and will remain as such until 3 consecutive new lows. The list is endless, but the concept is the same.

The Donchian Channel indicator is simply a marker of the highest high in the last few points, and the lowest low in the last few points. The centerline is a simple average of the two. Typically, 20 points are used. This indicator is useful as previous highs and lows typically offer significant resistance to further price movement.

In MetaStock the formula you would have to use is:

HHV(H,20);
LLV(L,20);
Mov((HHV(H,20) + LLV(L,20))/2,20,S)

Metastock Indicators/Exploration/Expert

Create these two Indicator in indicator builder

Donchian Channel :

upch:= Ref(HHV(H,20),-1);
dnch:= Ref(LLV(L,20),-1);
midch:=(upch+dnch)/2;
upch;dnch;midch

Donchian Midchannel :

upch:= Ref(HHV(H,20),-1);
dnch:= Ref(LLV(L,20),-1);
midch:=(upch+dnch)/2;
midch

——————————————————————————
Exploration Donchian midpoint crossover :

Column A : Bullish
C>(Fml( “Donchian Midchannel”) AND Ref(C,-1)<
Ref(Fml( “Donchian Midchannel”)-1)

Column B : Bearish
C<(Fml( “Donchian Midchannel”) AND Ref(C,-1)>
Ref(Fml( “Donchian Midchannel”)-1)

Filter : Column A =1 OR Column B =1

The formula for crossover needs one more condition and that is last candle should cross the high of previous one for bullish signal and for bearish it should cross the previous low on downside.


CREATE NEW EXPERT ADVISOR AS CHANNEL SIGNALS

UNDER SYMBOLS –

BUY
C>(Fml( “Donchian Midchannel”) AND Ref(C,-1)<
Ref(Fml( “Donchian Midchannel”)-1)

SELL
C<(Fml( “Donchian Midchannel”) AND Ref(C,-1)>
Ref(Fml( “Donchian Midchannel”)-1)

SH 315 Strategy

315 Strategy for swing trading

315 is a simple swing technique which tries to identify a trend very early. In this strategy we use only EMAs name EMA 3 & EMA 15 (hence the name 315).

People ask me why EMA 3 and EMA 15 …. for me last 3 days define the immediate average price … to find the slightly longer term trend i use the factor of 5. This is becuase 5 has an interesting relevance to markets…. we have approx 5 hours of trading everyday, 5 trading days in a week, almost 5 trading weeks in a month …. So I simply multiple 3 by 5 to get my 15 EMA which defines my medium term average price.

Now in simple terms, if our immediate average price is higher than the medium term average price that means we are entering in a bull swing … and visa versa. Hence the strategy entries are:

1 Enter Long when 3 EMA goes above 15 EMA
2 Enter Short when 3 EMA goes below 15 EMA

Advantages of following 315 strategy

1. A simple technique using just 2 EMAs, no other oscilattors or indicators required. NO advanced charting softwares required.

2. System is based on following the ULTIMATE indicator available i.e price action.

3. Keeps a trader in the trend, lets the full swing to complete. Never gets a trader against the trend.

4. Since we are just following price action, we dont need to worry about divergences etc.

Disadvantages of 315 Strategy

1. Works brilliantly in a trending market but can whipsaw in extremely ranging markets. However this can be overcome by certain rules and money management to be explained later in this thread.

For Entry, Pryramiding & Exits (profit booking) and re-entry rules

Entries are simple, you wait for a candle to close above 15 EMA, next candle to open and see if 3 EMA is above 15 EMA or not. If the answer is ‘Yes’ you go long. For shorts you need an exact opposite setup.

ScreenHunter_02 Jul. 10 07.08

Position Sizing

Since in this system SL cannot be defined as a ‘level’ your initial position sizing has to be small. Depending on the trading capital, you dont want to put more than 25% capital which you want to put in this trade in as the first trade i.e assume if you can trade a total of 4 lots max, you will start with 1 lot. Rest 3 lots we will add later as our position moves into profit.

Pyramiding

Pyramiding or ‘adds’ are obviosly done once our position has ‘swung’ into profits. The rule is we add when the markets correct after a swing, price comes and touched 15 EMA again (but 3 EMA hasnt crossed over). This means that we add very close to our SAR hence keeps the risk small and also ensures that even if SAR is triggered we still end up in net profits (since our initial position is in profits hopefully now).

Exits

Yes, we do exit at certain points even when our SAR is not hit. These exit points are obviously when our position is suddenly in deep profits becuase of an extreme rally or crash in our favour. The exit points are where you find our ‘current’ EOD candle is not touching 3 EMA at all. On this candle, we book profits and wait for markets to correct back and touch 3 EMA again. As soon as 3 EMA is touched we jump back into our initiaal position. So in a way we stay with our position, we just exit it once and get back in after a small correction.

I will talk you through the chart.

ScreenHunter_02 Jul. 10 07.08
Please see first red up arrow .. a buy on 16th March, before the days close you can see 3 EMA clearly above 15 EMA you take your first lot long position before market closes on 16th March ie around 2770 (please note how we need to wait till the last moment of EOD candle close to ensure we have a confirmed crossover on EOD charts).

Wow – we have a secular bull swing going from that day which takes markets to 3500 levels.

Please see second red up arrow on 28th April. Markets corrects on this day and EOD candle touches (or gets very close to) 15 EMA. This is the point we ‘Add’ one more lot long just before th day closes at around 3350 levels. Now the fact is that our average price has become 3060 for 2 lots so even if next day we again have a down day and 3 EMA crosses and closes below 15 EMA we will still be able to get out at a level above 3060 and hence book profits. See how even after our ‘Add’ we have not increased our risk overall.

Wow – but markets go up next day and both our positions are in profits.

NOW, please see 4th May candle… Nifty gapped up by 5% and closed at 3658.This is our Exit candle since 3 EMA is not touching the body candle at all.

So we basically book both lots before market closes on 4th May at around 3650. So we have made 590 points profit per lot or total 1180 points profit.

We now want to renter again with 2 lots whenever EOD candle touches 3 EMA again. If you see on 6th May that happens and we again go long 2 lots before market close at around 3630.

Now, please see the third up arrow. Markets keep correcting and EOD candle again touches 15 EMA on 11th May. This is where we ‘add’ our 3rd lot at around 3550. NOw we hold 3 lots NF long with avg price 3600. We have already booked 1180 points so that is still acting as a buffer we have in case markets go down next day and our SAR is hit. We will still have overall profits.

But as luck had it .. our SAR is not hit since markets are rangebound waiting for election results.

Now please see 19th May Candle .. opened way beyond 3 EMA so clearly a profit booking zone right at the open. It was a volatile day, opened at 4600 and kept crashing to 4200 …assume we exited at 4300. We made 700 points profit per lot on 3 lots or total 2100 points profit. Add that to 1190 points profit and we have made 3390 points profit.

As you can see, we reenter again after a couple of days as marked on charts…. Finally on 18th June we exit all longs and enter shorts (again 1 lot as start).

We add shorts at 25th June… we have a small whipsaw on a day before budget but after budget we get another sell signal and now we are short.

I will cover one more important aspect about ‘Protecting Capital’ in my next post. Please post any questions here in the meantime.

Stop losses and protecting your capital

I will start sharing the P&L etc once I complete my entire description of certain rules to make it more effective.

We have talked about the basics & ‘effective adds’. The second bit i want to explain under ‘protecting capital’ is ‘effective SLs’.

Learning to use effective SLs is the simplest yet the most powerful piece in ‘Protecting Capital’.

The way I use my SLs under this strategy is that once my initial position has moved in more than 100 points profit, I use my entry point as my SL.

Though this sounds very naive to do that but it serves two very important functions:

1. First of all it avoids whipsaws. Ideally, in a good trade, when we make an entry based on 315, I would expect our ADD to happen once my initial position is in good profit. This means that after the initial entry, the market has trended in the direction of our position, corrected to touch 15 EMA and gave us an ‘ADD’ without touching our initial entry point. THIS IS A STRONG SIGN OF A TRENDING MARKET HENCE MAKES OUR TRADE MORE POWERFUL.

2. It also means that we dont let a winning position become a losing one, a basic fundamental of a successful swing trader.

Please remember : If our initial entry point (or SL) is hit, we enter again based on ‘effective ADD’ rules i.e previous day highs/lows breached and 3 EMA still in favour. This might mean we end up shorting below our earlier entry point but thats fine.

Please take the current example now, I shorted at 4190, booked at 3930, re-entered shorts at 4040. Now when 4190 was hit again on 15/07/2009 I exited my shorts and waitied for a ‘ADD’ signal to get generated. 315 stayed bearish even when markets went upto 4236 close on 15/07 & 16/7 (hence no longs) but it didnt generate any ‘ADD short’ signal by breaching previous days lows.

Hence I couldnt short again once my 4190 SL was hit. so basically made 110 points in short on one lot.

And then on 17th July closing at around 4392 when the 315 bullish signal was confirmed I entered fresh longs. Market has closed at 4510 today however till day end 3 EMA was not touched hence i booked profits at 4508 levels. I am waiting for 3 EMA to be touched again to jump into longs again with SL 4392 (my initial entry point since it has swung up more than 100 points now).

I have now explained all my rules making 315 more effective, please use them as per your money management rules and hopefully you all will make money. to summarise the rules:

1. Build up on winning positions gradually by following ‘ADD’ rules.
2. Exit on candles where 3 EMA is not touching the candle body using ‘effective profit booking’ rule.
3. Never let a winning position become a losing one… use ‘effective SL’ rule.

More explanations for conservative and aggressive trader

Question : I have taken the EOD chart of CAIRN (NSE) below. The long cross over happened on 4th May’09 and below are the EOD price of 4th May’09.

OPEN 192.00
HIGH 203.45
LOW 190.50
CLOSE 202.05

My query is

1). What would be the entry point for placing buy order
2). SL as mentioned by you will it be the entry price?
3). Exit price as you said will be the price when 3 EMA is not touched. But this will be known on the next day in case of positional trading? what to do on this case.

Answer : Coming to your questions, though i do not trade CAIRN but I will try and answer your questions based on 315. However first of all you will need a charting software that would provide you real time EOD charts (including current day’s candle) along with EMAs.

1. Entry would be at around closing time around 202 since at that point your charts will tell you bullish crossover is complete and confirmed.

2. Initially SL is a bearish crossover of EMAs. However I believe that once I have enough M2M profits i would not want to take a loss later on that position. For myself, I have defined enough as 3% for Nifty, for stocks its slightly higher i.e 5%. Once i get this favourable move, I would put SL at my entry point so that if markets reverse atleast I would not have to bear any loss. In this case if we long at 202 and Cairn touches 212 (which it did on 07/05/2009) I would have put my trailing SL to 202 immediately. Apparently this SL would have got hit on 12/05/09.

For re-entry, I would re-enter on when previous days highs are breached and again wait for my position to move 5% above my entry point before i put a trailing SL. Here in this case, on 13/05/09 Cairn breached previous days high (212.45) hence I would have longed at 212.50 again. NOw we would put a trailing SL only once our position moves to 223 (5% up) otherwise we will hold until bearish crossover is completed. apprently 223 gets hit on 18/05/2009 and immediately next day SL (212.50 our entry point) is taken out on 19/05/09 leaving us empty handed again. We again wait for re-entry (previous day high breach) which happens on 21/05/2009 and we long at 232.50 .. and then rest is history when you exit at 270 odd levels as shown on your charts.

Please note : Putting trailing SLs is for conservative traders like me, high risk takers can forget about trailing SLs for higher returns like in this case had we not put trailing SLs we would have held onto longs from 202 to 270 (instead of 232.50 to 270)

3. This has to be known same day at open price and thats why you need the real time EOD candle.

Summing up my understanding:

Dos:

  • Apply this strategy to only selected 10 – 20 high volume large cap/mid cap stocks.
  • Apply this strategy to EOD charts only.
  • Preferably choose futures so that both long and short can be tried.
  • Use SL and money management for profit management.

Donts:

  • Do not apply this to intraday.
  • Do not apply to options
  • Do not apply if the entry criteria is not fully met.
  • Do not apply to low volume stocks as it can whipsaw.

To Enter:
Apply 315 strategy to the selected high volume stocks and wait for cross over. Enter long or short depending strictly on the cross over.

To Re Enter:

Renter when the candle which moved above the 3 EMA returns back and touches 3EMA.

To Add more lots:
Add second lot when the candle touches back 15 EMA after moving above it and also the candle high is above the previous candle high.

To Exit:
Exit when the candle moves above 3EMA. Also another chance to exit is when reverse cross over happens. In addition to these, exit, when you realize you have made huge profit and huge is subjective. (5% for stocks ??)