Gern
ich habe die Anwweisung wieder rausgenommen und statt dessen not onmarket raus genommen. Aber es funktioniert nicht.
Die Short Regeln habe ich aus gemacht.
Danke
Hier der Code:
//defparam calculateonlastbars=30000
ONCE HH = 0
ONCE HHprec = 0
ONCE LL = 0
ONCE LLprec = 0
cp = 3
once lastpoint = 0
if high[cp] >= highest[2*cp+1](high) then
PEAK = 1
else
PEAK = 0
endif
if low[cp] <= lowest[2*cp+1](low) then
TROUGH = -1
else
TROUGH = 0
endif
if PEAK = 1 then
TOPy = high[cp]
TOPx = barindex[cp]
endif
if TROUGH = -1 then
BOTy = low[cp]
BOTx = barindex[cp]
endif
if PEAK>0 and (lastpoint=-1 or lastpoint=0) then
//DRAWSEGMENT(lastX,lastY,TOPx,TOPy) COLOURED(127,255,0,1000)
//DRAWTEXT(“■”,TOPx,TOPy,Dialog,Bold,10) coloured(200,0,0,255)
lastpoint = 1
lastX = TOPx
lastY = TOPy
HHprec= HH
HH = TOPy
HHbar = TOPx
endif
if TROUGH<0 and (lastpoint=1 or lastpoint=0) then
//DRAWSEGMENT(lastX,lastY,BOTx,BOTy) COLOURED(255,0,0,255)
//DRAWTEXT(“■”,BOTx,BOTy,Dialog,Bold,10) coloured(0,200,0,255)
lastpoint = -1
lastX = BOTx
lastY = BOTy
LLprec= LL
LL = BOTy
LLbar = BOTx
endif
//TREND ATTEMPT
atr=AverageTrueRange[14](close)
if TOPy > TOPy[1] and topy<>lasttop then
//drawarrowup(barindex,low-atr/2) coloured(0,200,0)
lasttop=topy
trendup = 1
else
trendup = 0
endif
//RETURN TOPy as “TOPy”, BOTY as “BOTy”, trendup as “trendup”
// Long
IF (close > HH) AND (HH > 0)and (HH > HHPrec) AND (LL > LLprec) AND (LLprec > 0)and (LL > HHPrec) THEN
BUY 1 Contract at Market
SET STOP PRICE LL
SL = abs(close – LL)
TP = close + (SL * 0.5)
SET TARGET PRICE TP
LLprec = 0
ENDIF
//Short
//IF Not ShortOnMarket AND (close < LL) AND (LL > 0) AND (HH < HHprec) AND (HHprec > 0) THEN
//SELLSHORT 1 Contract at Market
//SET STOP PRICE HH
//SL = abs(close – HH)
//TP = close – (SL * 2)
//SET TARGET PRICE TP
//HHprec = 0
//ENDIF