Posted By: webradio
modified parabolic stop - 11/28/14 15:42
I came across an interesting trailing stop and would like to share it here. This is a modified parabolic stop (the original one is by Welles Wilder).
For clarity, I only describe long direction here. Initial stop is at low of entry bar minus ATR multiple (e.g. 2). There is a factor called acceleration (e.g. 0.02). With every new bar, stop is moved up by acceleration times distance between highest_high_since_entry and the old stop level, but not beyond last low. Every time a new highest_high_since_entry is reached, acceleration is increased by one step (e.g. 0.02), limited by some maximal value (e.g. 0.2).
I wrote a pseudo-system to see how it looks like, therefore setup&entry is simply MA crossing, just to have some entries. Here is how it looks like on USD/JPY 240min.
full size
For clarity, I only describe long direction here. Initial stop is at low of entry bar minus ATR multiple (e.g. 2). There is a factor called acceleration (e.g. 0.02). With every new bar, stop is moved up by acceleration times distance between highest_high_since_entry and the old stop level, but not beyond last low. Every time a new highest_high_since_entry is reached, acceleration is increased by one step (e.g. 0.02), limited by some maximal value (e.g. 0.2).
I wrote a pseudo-system to see how it looks like, therefore setup&entry is simply MA crossing, just to have some entries. Here is how it looks like on USD/JPY 240min.
full size
Code:
#include <profile.c> function run() { var AtrLen = 3; var AtrMult = 2; var AccelInit = 0.02; var AccelStep = 0.02; var AccelMax = 0.2; var Stp; static var Accel; static var Hihi, Lolo; vars Price = series(priceClose()); vars FastMA = series(SMA(Price, 5)); vars SlowMA = series(SMA(Price, 12)); StartDate = 20140801; if (is(INITRUN)) { Accel = AccelInit; } if (NumOpenLong + NumPendingLong + NumOpenShort + NumPendingShort == 0) { if (crossOver(FastMA, SlowMA)) { exitShort(); enterLong(0, 0, priceLow() - AtrMult*ATR(AtrLen)); Accel = AccelInit; Hihi = priceHigh(); } if (crossUnder(FastMA, SlowMA)) { exitLong(); enterShort(0, 0, priceHigh() + AtrMult*ATR(AtrLen)); Accel = AccelInit; Lolo = priceLow(); } } for(open_trades) { Stp = 0; if (TradeIsLong) { TradeStopLimit = min(priceLow(), TradeStopLimit + Accel*(Hihi-TradeStopLimit)); Stp = TradeStopLimit; //for painting if (priceHigh() > Hihi) { Hihi = priceHigh(); Accel = min(AccelMax, Accel+AccelStep); //printf("\nTradeTime=%d, new Accel=%f",TradeTime, Accel); } } else if (TradeIsShort) { TradeStopLimit = max(priceHigh(), TradeStopLimit - Accel*(TradeStopLimit-Lolo)); Stp = TradeStopLimit; //for painting if (priceLow() < Lolo) { Lolo = priceLow(); Accel = min(AccelMax, Accel+AccelStep); } } } // zoom in a certain date PlotDate = 20140829; //testing with USDJPY 240min PlotWidth = 4096; PlotHeight1 = 800; ColorEquity = ColorDD = 0; ColorUp = ColorDn = 0x00AAAAAA; plot("FastMA",FastMA[0],0,BLACK); plot("SlowMA",SlowMA[0],0,RED); if (Stp!=0) {plot("Stp",Stp,DOT,BLUE);} set(PLOTNOW); }