Supertrend Indikator als ExpressStopp ( Taktik )
Posted: 06 Jun 2014 18:34
Hallo,
Wer Interesse hat, ich habe einen Stopp Express für den Supertrend Indikator geschrieben.
Dieser Funktioniert als Taktik und Normal als Stopp.
Die Berechnungswerte für den Stopp, werden vom Supertrend Indikator Importiert.
Beide müssen Eingefügt werden !!!
Mit dem Wert $stoppdist des Stopps, kann der Abstand des Stopps zum Indikator vergrößert werden.
Hier der Indikator
--------------------------------------------------
express SuperTrend;
vars
series lastStop, lastStopLong, lastStopShort, isLong;
numeric actMidPrice, actLongStop, actShortStop;
input $Span(1,100,10), $ATRfactor(0.0,100.0,3.0,0.1,1);
calculation
CalculateAtEveryTick(false);
isLong = isLong[1];
lastStop = lastStop[1];
lastStopLong = void;
lastStopShort = void;
if (CurrentBarIndex() = ($Span+1)) then
begin
if (close >= close[1]) then
begin
isLong = 1;
lastStop = -999999;
end
else
begin
isLong = -1;
lastStop = 999999;
end
end
else if (CurrentBarIndex() > ($Span+1)) then
begin
actMidPrice = (high+low)/2;
actLongStop = actMidPrice - AtrAbs($Span) * $ATRfactor;
actShortStop = actMidPrice + AtrAbs($Span) * $ATRfactor;
if (isLong = 1) then
begin
lastStop = max(lastStop, actLongStop);
lastStopLong = lastStop;
end
else
begin
lastStop = min(lastStop, actShortStop);
lastStopShort = lastStop;
end
if ((isLong = 1) AND (lastStop > close)) then
begin
isLong = -1;
lastStop = actShortStop;
lastStopShort = lastStop;
end
else if ((isLong = -1) AND (lastStop < close)) then
begin
isLong = 1;
lastStop = actLongStop;
lastStopLong = lastStop;
end
end
interpretation
begin
end
plot(lastStopShort, Magenta, 2);
plot(lastStopLong, Magenta, 2);
------------------------------------------------------------
Hier der Stopp
Express Stop supertrend
vars
input $stoppdist (0,100,1);
numeric stopp,ticksize, stoppsize;
series lastStopLong (SuperTrendExpress.lastStopLong);
series lastStopshort(SuperTrendExpress.lastStopshort);
calculation
CalculateAtEveryTick(false);
if isFirstBar() then
begin
ticksize = TickSize();
stoppsize = ticksize* $stoppdist;
end
if (MarketPosition()<>0) then
begin
if (MarketPosition() = 1) then
begin
// if IsIntradayEntry() then we work on the period where the position
// was opened or the TradeGuard/Tactic was activated.
if IsIntraDayEntry() then
begin
stopp = lastStopLong[1]-stoppsize;
end
else // not intraday
begin
if (BarsSinceEntry() = 0) then
begin
// Low Stop Ende der Einstiegsperiode
stopp = lastStopLong-stoppsize;
end
else
begin
// Regular Low Stop
stopp = lastStopLong-stoppsize;
end
end
end
else
begin
if (MarketPosition() = -1) then
begin
if IsIntraDayEntry() then
begin
stopp = laststopshort[1]+stoppsize;
end
else // not intraday
begin
if (BarsSinceEntry() = 0) then
begin
// High Stop Ende der Einstiegsperiode
stopp = lastStopshort+stoppsize;
end
else
begin
// Regular High Stop
stopp = lastStopshort+stoppsize;
end
end
end
end
SetStopPrice(stopp);
end
--------------------------------------------------------
Ich habe den Stopp bis jetzt nur als Taktik getestet ( Live ).
Bitte Vorher im Papermodus Testen.
Ideen und Verbesserungen können gerne vorgenommen und veröffentlicht werden.
Viele Grüße
Martrader
Wer Interesse hat, ich habe einen Stopp Express für den Supertrend Indikator geschrieben.
Dieser Funktioniert als Taktik und Normal als Stopp.
Die Berechnungswerte für den Stopp, werden vom Supertrend Indikator Importiert.
Beide müssen Eingefügt werden !!!
Mit dem Wert $stoppdist des Stopps, kann der Abstand des Stopps zum Indikator vergrößert werden.
Hier der Indikator
--------------------------------------------------
express SuperTrend;
vars
series lastStop, lastStopLong, lastStopShort, isLong;
numeric actMidPrice, actLongStop, actShortStop;
input $Span(1,100,10), $ATRfactor(0.0,100.0,3.0,0.1,1);
calculation
CalculateAtEveryTick(false);
isLong = isLong[1];
lastStop = lastStop[1];
lastStopLong = void;
lastStopShort = void;
if (CurrentBarIndex() = ($Span+1)) then
begin
if (close >= close[1]) then
begin
isLong = 1;
lastStop = -999999;
end
else
begin
isLong = -1;
lastStop = 999999;
end
end
else if (CurrentBarIndex() > ($Span+1)) then
begin
actMidPrice = (high+low)/2;
actLongStop = actMidPrice - AtrAbs($Span) * $ATRfactor;
actShortStop = actMidPrice + AtrAbs($Span) * $ATRfactor;
if (isLong = 1) then
begin
lastStop = max(lastStop, actLongStop);
lastStopLong = lastStop;
end
else
begin
lastStop = min(lastStop, actShortStop);
lastStopShort = lastStop;
end
if ((isLong = 1) AND (lastStop > close)) then
begin
isLong = -1;
lastStop = actShortStop;
lastStopShort = lastStop;
end
else if ((isLong = -1) AND (lastStop < close)) then
begin
isLong = 1;
lastStop = actLongStop;
lastStopLong = lastStop;
end
end
interpretation
begin
end
plot(lastStopShort, Magenta, 2);
plot(lastStopLong, Magenta, 2);
------------------------------------------------------------
Hier der Stopp
Express Stop supertrend
vars
input $stoppdist (0,100,1);
numeric stopp,ticksize, stoppsize;
series lastStopLong (SuperTrendExpress.lastStopLong);
series lastStopshort(SuperTrendExpress.lastStopshort);
calculation
CalculateAtEveryTick(false);
if isFirstBar() then
begin
ticksize = TickSize();
stoppsize = ticksize* $stoppdist;
end
if (MarketPosition()<>0) then
begin
if (MarketPosition() = 1) then
begin
// if IsIntradayEntry() then we work on the period where the position
// was opened or the TradeGuard/Tactic was activated.
if IsIntraDayEntry() then
begin
stopp = lastStopLong[1]-stoppsize;
end
else // not intraday
begin
if (BarsSinceEntry() = 0) then
begin
// Low Stop Ende der Einstiegsperiode
stopp = lastStopLong-stoppsize;
end
else
begin
// Regular Low Stop
stopp = lastStopLong-stoppsize;
end
end
end
else
begin
if (MarketPosition() = -1) then
begin
if IsIntraDayEntry() then
begin
stopp = laststopshort[1]+stoppsize;
end
else // not intraday
begin
if (BarsSinceEntry() = 0) then
begin
// High Stop Ende der Einstiegsperiode
stopp = lastStopshort+stoppsize;
end
else
begin
// Regular High Stop
stopp = lastStopshort+stoppsize;
end
end
end
end
SetStopPrice(stopp);
end
--------------------------------------------------------
Ich habe den Stopp bis jetzt nur als Taktik getestet ( Live ).
Bitte Vorher im Papermodus Testen.
Ideen und Verbesserungen können gerne vorgenommen und veröffentlicht werden.
Viele Grüße
Martrader