Bonjour,
J’ai un problème sans doute très bête mais je ne vois pas quoi faire… Je suis en train modifier des codes backtests présentés dans la librairie et de faire des tests en incluant des indicateurs que j’utilise.
J’ai par exemple fait ce code.. Mais quand je fais un copier coller, j’ai toute une partie du code qui se décalle ( à partir de “// short on Monday….”) dans le module Probacktest. tout est un peu décalé vers la droite et le code mentionne des erreurs à chaque ligne quand je veux le valider… Ca vient de mon PRT ? Que faire ? j’ai coder dans le bloc note. Puis devant ce problème j’ai essayé de coder directement dans la fenêtre probacktest mais ca fait la même chose.
// Lift up and down DAX 5M
// Code-Parameter
DEFPARAM FlatAfter = 113000
// trading window
ONCE BuyTime = 84500
ONCE SellTime = 113000
// money management
// variable position size - thanks Adolfo :-)
ONCE Capital = 10000
ONCE Risk = 0.01
ONCE StopLoss = 10
ONCE equity = Capital + StrategyProfit
ONCE maxrisk = round(equity*Risk)
ONCE PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)
// fixed position size
// ONCE PositionSize = 10
// manage number of trades
IF Time = BuyTime THEN
LongTradeCounter = 0
ShortTradeCounter = 0
ENDIF
// long on Monday until Thursday with filter close is above MA(14) and max 2 trades per day
indicator1 = CALL RenkoTrend[7, 20, 10]
IF Not LongOnMarket AND Time >= BuyTime AND close CROSSES OVER DHigh(1) AND close > indicator1 AND LongTradeCounter < 2 AND CurrentDayOfWeek <> 5 THEN
BUY PositionSize CONTRACT AT MARKET
LongTradeCounter = LongTradeCounter + 1
ENDIF
// Fermeture long
If LongOnMarket and (indicator1 < indicator1[1]) THEN
Sell at market
// short on Monday and Tuesday with filter close is under MA(9) and max 2 trades per day
IF Not ShortOnMarket AND Time >= BuyTime AND close CROSSES UNDER DLow(1) AND close < indicator1 AND ShortTradeCounter < 2 AND CurrentDayOfWeek < 3 THEN
SELLSHORT PositionSize CONTRACT AT MARKET
ShortTradeCounter = ShortTradeCounter + 1
ENDIF
// Fermeture short
If ShortOnMarket and (indicator1 > indicator1[1]) THEN
EXITSHORT AT MARKET
// exit
IF LongOnMarket AND Time = SellTime THEN
SELL AT MARKET
ENDIF
IF ShortOnMarket AND Time = SellTime THEN
EXITSHORT AT MARKET
ENDIF
// stop and target
SET STOP pLOSS sl
SET TARGET pPROFIT tp
Il manque un ENDIF aux lignes 35 et 46. C’est pour cela qu’il pense avoir une erreur à la ligne 59 car il attend une instruction pour fermer la condition IF.