Los geht’s:
defparam flatbefore = 080500
defparam flatafter = 213000
//
if intradaybarindex=0 then
trading=1
elsif barindex=tradeindex then
trading=0
endif
//
if time = 080500 then
mypriceL=close-AverageTrueRange[14](close)*3
tpL = close-mypriceL
slL = tpL * 2
mypriceS=close+AverageTrueRange[14](close)*3
tpS = mypriceS-close
slS = tpS * 2
elsif time> 080500 and time[1] < 080500 then
mypriceL=close[1]
mypriceS=close[1]
endif
//
if not longonmarket and trading=1 then
buy 1 share at mypriceL limit
set stop loss slL
set target profit tpL
BreakEven = tpL * 0.7
endif
//
if not shortonmarket and trading=1 then
sellshort 1 share at mypriceS limit
set stop loss slS
set target profit tpS
BreakEven = tpL * 0.7
endif
//
IF LongOnmarket THEN
IF ExitPrice = 0 THEN
IF (close - TradePrice) >= BreakEven THEN
ExitPrice = TradePrice
ENDIF
ELSE
SELL AT ExitPrice STOP
ENDIF
ELSIF ShortOnMarket THEN
IF ExitPrice = 0 THEN
IF (TradePrice - close) >= BreakEven THEN
ExitPrice = TradePrice
ENDIF
ELSE
EXITSHORT AT ExitPrice STOP
ENDIF
ELSE
ExitPrice = 0
ENDIF
Ich habe PLOSS in LOSS geändert.
Ich habe die Gewinnschwelle hinzugefügt, wenn ein Gewinn von 70% erreicht ist.
Ich habe sowohl Short- als auch Long-Trades hinzugefügt.
Ich füge separate SL und TP für Short- und Long-Trades hinzu.
@ axmichi Zeile 15 für kurz SL ist falsch, es sollte geschrieben werden
SL = (myprice-close)
Ich hänge auch die .ITF-Datei an.
OMG Daaaaanke Du bist der Wahnsinn wie kann man so was können?? 🙂
Auf welcher Zeiteinheit und auf welchem Wert testen Sie diese ITF?
Da sich die Strategie auf 080500 bezieht, jeder Zeitrahmen, dessen Balken genau zu dieser Stunde endet, also 5 Minuten oder 1 Minute oder in 10 Sekunden.