Page 1 of 1

Supertrend Indikator als ExpressStopp ( Taktik )

Posted: 06 Jun 2014 18:34
by Martrader
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.

Bild Supertrend.png
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
supertrendStopp.txt
Supertrend Indikator.txt

Re: Supertrend Indikator als ExpressStopp ( Taktik )

Posted: 16 Dec 2015 21:01
by WHFX
Vielen dank .
Perfekt ;-)

Re: Supertrend Indikator als ExpressStopp ( Taktik )

Posted: 18 Dec 2015 12:49
by Artnaf
Hallo,

einfacher geht es, wenn man von dem ja schon existenten SuperTrend Indikator die jeweiligen Serien ausliest und in einen Stop Sentimentor packt. Logisch das der SuperTrend Indikator dazu auch geladen sein muss.

Hier als Beispiel ein entsprechender Code zum Kopieren

------------------ snipp -------------------------------

Express stop SuperTrend_Stop; //v0.3

vars

series
LongStop (SuperTrend.LongStops),
ShortStop (SuperTrend.ShortStops);

numeric
LS, SS;

input
$Off (0, 1000, 10), //Offset in Ticks
$Spr (0, 100, 10); //Spread in Ticks for correct setting of LongStop

calculation
CalculateAtEveryTick(false);
SS = ShortStop + $Off * ticksize() + $Spr * ticksize();
LS = LongStop - $Off * ticksize();


If MarketPosition() = 1 then
SetStopPrice (LS);
If MarketPosition() = - 1 then
SetStopPrice (SS);//@@@cs:266098-3419480-160374_cs@@@

-------------------- snipp ----------------------------------------

Welche Serien von dem jeweiligen Indikator augelesen werden können und wie die benannt sind, kann man sich über die Visualisierung des Indikators anschauen, der SuperTrend hat neben dem LongStop und den ShortStop noch eine Close Serie zum auslesen.

Wie man sich die Visualisierung anzeigen lässt, bitte in dem / den Handbüchern nachschlagen oder / und oder in den Lehrfilmen suchen.

Gruß
Artnaf