EricParticipant
Master
I saw this strategy in the library by beeb
https://www.prorealcode.com/prorealtime-trading-strategies/dax30-morning-breakout-order-size-increase/
Would it be possible to do a version2 and change the code so that max 2 trades per day 1 long and 1 short (if the first is a loss)
like this first 1 cfd long and win no more trade that day, and if a loss then sell 2 cfd and no more trade that day
and then start again next day with 1 cfd (even if there was 2 loss previous day)
DEFPARAM FLATBEFORE=090100
// Festlegen der Code-Parameter
DEFPARAM CumulateOrders = false // Kumulieren von Positionen deaktiviert
// einmalige werte
once size = 1
once profi = 20
once in = 1
once korrek = 1
sl = 35
// Verhindert das Trading an bestimmten Wochentagen
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
noEntryAfterTime = 100000
timeEnterAfter = time < noEntryAfterTime
// einen trade nur
IF (CurrentTime = 010000) then
onetrade = 0
ENDIF
// Bedingungen zum Einstieg in Long-Positionen
IF (CurrentTime = 085900) then
high7 = HIGHEST[120](high)
low7 = LOWEST[120](low)
ENDIF
IF (close > high7) AND (CurrentTime >= 090100) then
onetrade = 1
ENDIF
IF (CurrentTime >= 090100) AND not daysForbiddenEntry AND (onetrade = 0) AND timeEnterAfter THEN
BUY size CONTRACT AT high7 STOP
ENDIF
IF (LONGONMARKET = 1) then
onetrade = 1
in = 1
korrek = 0
//l1 = POSITIONPRICE + 0.0008
l2 = POSITIONPRICE - sl
//sell at l1 LIMIT
sell at l2 stop
ENDIF
// Bedingungen zum Einstieg in Short-Positionen
IF close < low7 AND (CurrentTime >= 090100) then
onetrade = 1
ENDIF
IF (CurrentTime >= 090100) AND not daysForbiddenEntry AND (onetrade = 0) AND timeEnterAfter THEN
SELLSHORT size CONTRACT AT low7 STOP
ENDIF
IF (SHORTONMARKET = 1) then
onetrade = 1
in = 1
korrek = 0
//s1 = POSITIONPRICE - 0.0008
s2 = POSITIONPRICE + sl
//EXITSHORT at s1 LIMIT
EXITSHORT at s2 STOP
ENDIF
// korrektur
IF (LONGONMARKET < 1) AND (SHORTONMARKET < 1) then
in = 0
ENDIF
IF in = 0 and korrek = 0 then
d1 = POSITIONPERF(1) > 0
d2 = POSITIONPERF(1) < 0
IF d1 and size > 1 then
size = size - 1
korrek = 1
ELSIF d2 then
size = size + 1
korrek = 1
ENDIF
ENDIF
// Stops und Targets
SET STOP pLOSS 60
SET TARGET pPROFIT sl
// Performance
IF STRATEGYPROFIT > profi then
size = 1
profi = profi + 20
ENDIF
EricParticipant
Master
“box” high and low would be stoplevel and buy/sell
and maybe (for the strategyprofit) to work?) close first losing position with a stop at box high/low and then open the next one with a market order outside the box?
and run it on 1-minute