Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by 7th_zorro. 04/20/24 07:29
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, henrybane, flink, Edgar_Herrera), 758 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
volatility-based trailing stop #445713
09/21/14 13:29
09/21/14 13:29
Joined: Apr 2014
Posts: 45
Germany
webradio Offline OP
Newbie
webradio  Offline OP
Newbie

Joined: Apr 2014
Posts: 45
Germany
I am about to port my ATR-based trailing stop from MT4 to Zorro. I do enjoy programming, but I wonder if a similar source code already exists. At least, I coundn't find it on ta-lib.org and tadoc.org, nor in indicators.c. Sometimes this indicator is called Supertrend. It looks familiar to you, for sure:

Re: volatility-based trailing stop [Re: webradio] #445813
09/25/14 21:36
09/25/14 21:36
Joined: Apr 2014
Posts: 45
Germany
webradio Offline OP
Newbie
webradio  Offline OP
Newbie

Joined: Apr 2014
Posts: 45
Germany
I gave it a try
Code:
function run()
{
	set(PLOTNOW);
	PlotDate = 20140810;
	PlotHeight1 = 900;
	
	vars Top = series(2.0*priceHigh()-priceLow());
	vars Btm = series(2.0*priceLow()-priceHigh());
	var width = 3.0*EMA(series(ATR(2)), 10);
	var center = (priceHigh()+priceLow()+priceClose())/3.0;
	if (priceHigh()>Top[1]) {
		Top[0] = center+width;
	} else {
		Top[0] = min(Top[1], center+width);
	}
	if (priceLow()<Btm[1]) {
		Btm[0] = center-width;
	} else {
		Btm[0] = max(Btm[1], center-width);
	}
	
	plot("Top", Top[0],DOT,GREEN);
	plot("Btm", Btm[0],DOT,RED);
}

example from NinjaTrader
this script
this script, diffeent parameters


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1