DEFPARAM CumulateOrders = False
DEFPARAM flatbefore = 090000
DEFPARAM flatafter= 172900
Positionsize=1 // KONSTANTE KONTRAKTANZAHL!!
Spread=1 // Handelsspread DAX 1 Punkt 9.00-17.30 bei IG
Startzeit=090000
Endzeit=120000
//
////Martingal
MainSize = PositionSize
ONCE MainSize = PositionSize
ONCE LossSize = MainSize
IF StrategyProfit < StrategyProfit[1] THEN
LossSize = LossSize + MainSize
PositionSize = LossSize
ELSIF StrategyProfit > StrategyProfit[1] THEN
PositionSize = MainSize
LossSize = PositionSize
//
// Spanne 8-9 in Hi and Lo ermitteln
// ------------------------
once Bars=60 // 60 x 1 Minute
once Hi=0
once Lo=0
If time = 090000 then // Das ist das Ende der 8.59 Kerze. Also INCLUSIVE DIESER
Hi=highest[Bars](high)
Lo=lowest[Bars](low)
endif
Spannepoints=(Hi-Lo)/pointsize // Spanne in Punkten
//
once Tradetag=0
If onmarket then
Tradetag=date
endif
If not onmarket and time>= Startzeit and time < Endzeit and Tradetag<>date then
BUY Positionsize Lot AT Hi+(Spread/2) Stop
Sellshort Positionsize Lot AT Lo-(Spread/2) Stop
SET stop ploss Spannepoints*1
SET TARGET pPROFIT Spannepoints*1
ENDIF
Endif
Hallo,
dieser Code für einen breakout funktioniert gut, leider funktioniert er mit den Zeilen 13 – 20 im Code nicht mehr.
Hier habe ich Regeln für den Martingal eingefügt. Bei Verlusttrade verdoppeln
Kann mir jemand sagen warum der dann keine Entry mehr tätigt?
Danke und Gruß
Weil Sie den Code, den ich Ihnen für das Martingal geschrieben habe, schlecht kopiert haben.
Hallo
ich habe ihn original kopiert und beim BUY/SELL lediglich POSITIOSIZE verändert, war das falsch?
Vielleicht ist die definierte Positionsize 1 oben im Code der Fehler?!
Danke
Alle Anfangszeilen in Bezug auf Kapital, Risiko und Berechnungen fehlen.
tut mir leid, das ist zu schwer für mich, ich verstehe nicht wie das geht.
Okay, ich werde es so bald wie möglich versuchen.
Fertig:
DEFPARAM CumulateOrders = False
DEFPARAM flatbefore = 090000
DEFPARAM flatafter = 172900
Spread = 1 // Handelsspread DAX 1 Punkt 9.00-17.30 bei IG
Startzeit = 090000
Endzeit = 120000
//
// Martingala & PositionSize start
ONCE Capital = 10000 //10000€ initial Capital
ONCE Investment = 5 //5% max Investment for each trade
ONCE MinLots = 0.5 //0.5 min lot size (Dax)
ONCE Margin = 5 //5% Margin required by the broker for each lot
IF (StrategyProfit = 0) OR (Not OnMarket AND OnMarket[1]) THEN
Invested = Capital * Investment / 100 / PipValue
CurrentMargin = close * Margin / 100
TempLots1 = Capital / CurrentMargin
TempLots2 = round(((Invested / CurrentMargin) * 10) - 0.5) / 10 //round to 1 decimal digit
PositionSize = max(MinLots,TempLots2) //never below the minimum lots
MainSize = PositionSize
ENDIF
ONCE MainSize = PositionSize
ONCE LossSize = MainSize
IF StrategyProfit < StrategyProfit[1] THEN
LossSize = LossSize + MainSize
PositionSize = LossSize
ELSIF StrategyProfit > StrategyProfit[1] THEN
PositionSize = MainSize
LossSize = PositionSize
ENDIF
// Martingala & PositionSize end
//
// Spanne 8-9 in Hi and Lo ermitteln
// ------------------------
once Bars=60 // 60 x 1 Minute
once Hi=0
once Lo=0
If time = 090000 then // Das ist das Ende der 8.59 Kerze. Also INCLUSIVE DIESER
Hi=highest[Bars](high)
Lo=lowest[Bars](low)
endif
Spannepoints=(Hi-Lo)/pointsize // Spanne in Punkten
//
once Tradetag=0
If onmarket then
Tradetag=date
endif
If not onmarket and time>= Startzeit and time < Endzeit and Tradetag<>date then
BUY Positionsize Lot AT Hi+(Spread/2) Stop
Sellshort Positionsize Lot AT Lo-(Spread/2) Stop
SET stop ploss Spannepoints*1
SET TARGET pPROFIT Spannepoints*1
ENDIF
//
//graph StrategyProfit < Strategyprofit[1]
//graph LossSize
//graph MainSize
Hallo und vielen Dank dafür!!!!!!!