Hi Ich bins nochmal,
ic wei nicht ob hier noch fragen beantwortet werden, wenn ja könntet ihr mir helfen diesen code auf
ProRealTime zu portieren???
Der Code stammt von Tradesignal
Vielen Dank im voraus
Handelsystem "
Stop Loss Steps"
Meta:
Synopsis("
Stop Loss and Trailing stop, based in the volatility. tha trailings stop moves in steps on the multiplie of volatility."),
Weblink("http://www.tradesignalonline.com/Lexicon/Default.aspx?name=Volatilit%u00e4tsstop+mit+Traili ng+Stop"),
SubChart( False );
Inputs:
Activate_Stop( True ),//Activate - Deactivate the program
Period_ATR( 20 , 1 ),//Perdiod for the volatility calculation
Start_Factor( 2.5 ),//factor for the init stop
Activate_Trail( True ),//Activate the trailing stop
Trail_Factor( 1.0 ),//factor for the stepwidth
Draw_Stops( True );
Variables:
stopLevel, initStopLevel, newStopLevel,
serialBSE, stopLevelLong, stopLevelShort, serialOP, serialTP, serialTT,
trailValue, trailBorder, atrValue, stepCondLong, stepCondShort,
stopValue, trailLevel, trailLevelShort,
initStopLevelLong, initStopLevelShort;
serialTT = TotalTrades;
serialBSE = BarsSinceEntry;
serialOP = OpenPosition / GetDefaultQuantity / LotSize;
serialTP = TotalPositions;
atrValue = Average( TrueRange(), Period_ATR );
stopValue = atrValue * Start_Factor;
trailValue = atrValue * Trail_Factor;
initStopLevelLong = Close - stopValue;
initStopLevelShort = Close + stopValue;
If Activate_Stop Then
Begin
If ! LongPos() Then
Begin
Sell("Init
Long") Next
Bar at initStopLevelLong Stop;
stepCondLong = False;
End;
If ! ShortPos() Then
Begin
Cover("Init
Short") Next
Bar at initStopLevelShort Stop;
stepCondShort = False;
End;
End;
if LongPOS() and Activate_Stop then
begin
If ( serialTP > serialTP[1] ) Then
Begin
stopLevelLong = initStopLevelLong[1];
newStopLevel = stopLevelLong;
trailLevel = stopLevelLong;
trailBorder = EntryPrice + stopValue;
stepCondLong = True;
If Draw_Stops Then
DrawSymbol( initStopLevelLong[1], "Init
Long", SymbolDot, 5, DarkGreen, DarkGreen );
End
Else
Begin
If ( serialOP > 0 ) And Activate_Trail Then
Begin
If ( Close > trailBorder ) Then
Begin
trailBorder = trailBorder + trailValue;
If stepCondLong Then
Begin
stepCondLong = False;
trailLevel = EntryPrice + Commission;
DrawText( trailLevel, "Tx BE", "Break Even", 12, DarkGreen, AlignBottom );
DrawSymbol( trailLevel, "Smbl BE", SymbolTriangleUp, 6, DarkGreen, DarkGreen );
End
Else
trailLevel = trailLevel + trailValue;
End;
newStopLevel = MaxList( trailLevel, newStopLevel[1] );
End;
End;
If Activate_Stop And ( newStopLevel <> 0 ) Then
Begin
Sell("Stop
Long") Next
Bar at newStopLevel Stop;
NoPlot("Tx Stop
Long");
If Draw_Stops Then
Begin
DrawText[-1]( newStopLevel, "Tx Stop
Long", "SL: " + CStr( newStopLevel, 4 ), 10, DarkGreen, AlignTop + AlignCenter );
DrawSymbol[-1]( newStopLevel, "Smbl Stop
Long", SymbolDot, 5, DarkGreen, DarkGreen );
End;
End;
End;
if ShortPOS() and Activate_Stop then
begin
If ( serialTP > serialTP[1] ) Then
Begin
stopLevelShort = initStopLevelShort[1];
newStopLevel = stopLevelShort;
trailLevel = stopLevelShort;
trailBorder = EntryPrice - stopValue;
stepCondShort = True;
If Draw_Stops Then
DrawSymbol( initStopLevelShort[1], "Init
Short", SymbolDot, 5, Red, Red );
End
Else
Begin
If ( serialOP > 0 ) And Activate_Trail Then
Begin
If ( Close < trailBorder ) Then
Begin
trailBorder = trailBorder - trailValue;
If stepCondShort Then
Begin
stepCondShort = False;
trailLevel = EntryPrice - Commission;
DrawText( trailLevel, "Tx BE", "Break Even", 12, DarkBlue, AlignTop );
DrawSymbol( trailLevel, "Smbl BE", SymbolTriangleDown, 6, Red, Red );
End
Else trailLevel = trailLevel - trailValue;
End;
newStopLevel = MinList( trailLevel, newStopLevel[1] );
End;
End;
If Activate_Stop And ( newStopLevel <> 0 ) Then
Begin
Cover("Stop
Short") Next
Bar at newStopLevel Stop;
NoPlot("Tx Stop
Short");
If Draw_Stops Then
Begin
DrawText[-1]( newStopLevel, "TX Stop
Short", "SL: " + CStr( newStopLevel, 4 ), 10, Red, AlignBottom + AlignCenter );
DrawSymbol[-1]( newStopLevel, "Smbl Stop
Short", SymbolDot, 5, Red, Red );
End;
End;
end;
// *** Copyright tradesignal GmbH ***
// ***
www.tradesignal.com ***“
Funktion "LongPos"
Meta:
Synopsis("Reports True if the systems marketposition is
long");
LongPos = MarketPosition = 1;
// *** Copyright tradesignal GmbH ***
// ***
www.tradesignal.com ***
Funktion "ShortPos"
Meta:
Synopsis("Reports True if the systems marketposition is
short");
ShortPos = MarketPosition = -1;
// *** Copyright tradesignal GmbH ***
// ***
www.tradesignal.com ***
Funktion "
trend"
trend = 1;
if high[2] < close[7] and high[2] < close[8] and high < low[5] and high < low[6] then
trend = 0;
if low[2] > close[7] and low[2] > close[8] and low > high[5] and low > high[6] then
trend = 0;