Hello to All,
Could someone please help me with the line to add for a maximum points per day on this basic strategy and then stop trading?
I have put the line:
SET TARGET PROFIT DAY = 30
However, I am not sure this is working fine.
Thanks a lot !
// Définition des paramètres du code
DEFPARAM CumulateOrders = False // Cumul des positions désactivé
// Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".
DEFPARAM FLATBEFORE = 090000
// Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"
DEFPARAM FLATAFTER = 153000
// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiés
daysForbiddenEntry = OpenDayOfWeek = 5
// Conditions pour ouvrir une position acheteuse
indicator1 = Average[50](close)
c1 = (close > indicator1)
indicator2, ignored, ignored, ignored, ignored = CALL "ExtraTrend"[0, 1, 1, 1, 1, 1](close)
c2 = (close CROSSES OVER indicator2)
IF (c1 AND c2) AND not daysForbiddenEntry THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Stops et objectifs
SET STOP pLOSS 40 pTRAILING 40
SET TARGET pPROFIT 40
SET TARGET PROFIT DAY = 30
JSParticipant
Senior
Hi Mikael,
Maybe you can add something like this…
IF IntraDayBarIndex = 0 THEN
TradeON = 1
ENDIF
IF (StrategyProfit – StrategyProfit[1]) > MaxPoints THEN
TradeON = 0
ENDIF
IF MyConditions AND TradeON THEN
… Buy / SellShorts
…
ENDIF
Thank you for your help 🙂
Will try to incorporate it.
Mikaël
This code (written by Roberto) blocks intraday trading once you reach a certain profit in euro (maxDailyProfit)
maxDailyProfit = XXX
floatingPosition = positionPerf*positionPrice/pointSize*pointValue
once tradeAllowed = 1
if intradayBarIndex = 0 then
tradeAllowed = 1
myProfit=strategyProfit
endif
if (strategyProfit + floatingPosition) >= (myProfit+maxDailyProfit) then
tradeAllowed = 0
endif