hello Paul would you share your version? cordially
PaulParticipant
Master
a.tm. it’s basically the same as posted by AlexF minus/plus what I mentioned.
however I used an slightly updated breakeven stop, with the option to choose points or percentage. The way I ‘ve it, with stoploss of 0.4%, if atr distance is 1 or greater, the stoploss moves to -0.2%
// breakeven stop atr
once breakevenstoptype = 1 // breakeven stop - 0 off, 1 on
once bestoplong = 1 // breakeven stop atr relative distance
once bestopshort = 1 // breakeven stop atr relative distance
once beatrperiod = 14 // atr parameter value
once beminstop = 0 // minimum breakeven stop distance
once bepointsorperct= 0 //[0]percentage [1]points
bepointstokeep = -0.2 // positive or negative //not use once
//----------------------------------------------
beatr = averagetruerange[beatrperiod]((close/10)*pipsize)/1000
//beatr=averagetruerange[beatrperiod]((close/1)*pipsize) // (forex)
bestopl = round(beatr*bestoplong)
bestops = round(beatr*bestopshort)
if breakevenstoptype then
if bepointsorperct then
bepointstokeep=bepointstokeep
else
bepointstokeep=(tradeprice(1)/100)*bepointstokeep
bepointstokeep=bepointstokeep
endif
if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
bemaxprice = 0
beminprice = close
benewsl = 0
endif
if longonmarket then
bemaxprice = max(bemaxprice,close)
if bemaxprice-tradeprice(1)>=bestopl*pointsize then
if bemaxprice-tradeprice(1)>=beminstop then
benewsl=tradeprice(1)+bepointstokeep*pipsize
else
benewsl=tradeprice(1)- beminstop*pointsize
endif
endif
endif
if shortonmarket then
beminprice = min(beminprice,close)
if tradeprice(1)-beminprice>=bestops*pointsize then
if tradeprice(1)-beminprice>=beminstop then
benewsl = tradeprice(1)-bepointstokeep*pipsize
else
benewsl = tradeprice(1) + beminstop*pointsize
endif
endif
endif
if longonmarket then
if benewsl>0 then
sell at benewsl stop
endif
if benewsl>0 then
if low crosses under benewsl then
sell at market //when stop is rejected
endif
endif
endif
if shortonmarket then
if benewsl>0 then
exitshort at benewsl stop
endif
if benewsl>0 then
if high crosses over benewsl then
exitshort at market //when stop is rejected
endif
endif
endif
endif
Just an update for the people out there. I have been running renko breakout 5s dax. 473euro profit since may 15th.
@ , good with an update, are You running the Paul version in post #132278?
Im runniing AlexF version on dow
Interesting system. Running AlexF version on backtest (no breakeven) with a percentage stop loss of 0.25 significantly improves the performance, all be it on the very limited data period available.
// Condizioni per entrare su posizioni long
IF tradeon AND entrylong THEN
BUY 0.5 CONTRACTS AT MARKET
SET STOP %LOSS 0.25
ENDIF
// Condizioni per entrare su posizioni short
IF tradeon AND entryshort THEN
SELLSHORT 0.5 CONTRACTS AT MARKET
SET STOP %LOSS 0.25
ENDIF
@schizz – Please use the ‘Insert PRT Code’ button when posting code as per the forum rules. I have edited your post to correct your error. Please ensure you use the button in future posts.
PaulParticipant
Master
here’s some code for a fast timeframe.
For i.e. 5 seconds tf I use 0.5% stoploss, but prefer a faster exit for a loss. A faster exit results likely in a lower winchance though. But live creates often more max losses then a short backtest.
First code is a familiar one, created 2 variations.
// support & resistence
once supportresistance = 0 // exit [0-1-2]
//
timeframe(30 seconds)
if supportresistance then
pivotbar = 20
lookback = 20
barlookback = pivotbar + 1
if low[pivotbar] < lowest[lookback](low)[barlookback] then
if low[pivotbar] = lowest[barlookback](low) then
supportprice = low[pivotbar]
endif
endif
if high[pivotbar] > highest[lookback](high)[barlookback] then
if high[pivotbar] = highest[barlookback](high) then
resistanceprice = high[pivotbar]
endif
endif
endif
timeframe(default)
if supportresistance=1 then
if ((longonmarket and shortonmarket[1]) or (longonmarket and not onmarket[1])) then
sup=supportprice
endif
if ((shortonmarket and longonmarket[1]) or (shortonmarket and not onmarket[1])) then
res=resistanceprice
endif
elsif supportresistance=2 then
sup=supportprice
res=resistanceprice
endif
if supportresistance=1 or supportresistance=2 then
if longonmarket then
sell at sup stop
endif
if shortonmarket then
exitshort at res stop
endif
endif
graphonprice sub
graphonprice res
code below is created from scratch. It takes the lowest low before a long entry for xx periods and starts recording new highs. There are 2 ways of exits. If you want a clear break you can set a breakvalue.
// exitpivot
once exitpivot=2 // exit [0-1-2]
//
if exitpivot=1 or exitpivot=2 then
duration=360 // 720 = 1 hour lookback on 5s
breakvalue=0
//
if not onmarket then
prell=0
prehh=0
endif
if longonmarket then
prehh=highest[max(1,(barindex-tradeindex))](high)
endif
if ((longonmarket and shortonmarket[1]) or (longonmarket and not onmarket[1])) then
prell=lowest[duration](low)
endif
if shortonmarket then
prell=lowest[max(1,(barindex-tradeindex))](low)
endif
if ((shortonmarket and longonmarket[1]) or (shortonmarket and not onmarket[1])) then
prehh=highest[duration](high)
endif
if onmarket then
fibpivot=(prehh-prell)*0.618
else
fibpivot=0
endif
if exitpivot=1 then
if longonmarket then
sell at (prehh-fibpivot)-breakvalue stop
endif
if shortonmarket then
exitshort at (prell+fibpivot)+breakvalue stop
endif
endif
if exitpivot=2 then
if longonmarket then
sell at prell-breakvalue stop
endif
if shortonmarket then
exitshort at prehh+breakvalue stop
endif
endif
endif
graphonprice prehh
graphonprice prell
graphonprice prell+fibpivot coloured(255,0,0,255) as "short exit"
graphonprice prehh-fibpivot coloured(0,0,255,255) as "long exit"
So @Paul from all of your post what do you think is best running? AlexF orginal or do you have another 5s itf?
It takes the lowest low before a long entry
Forgive the daft question … am I missing something, there is no Buy or Sellshort?
Do I need to read earlier posts to get in the zone?? 🙂
Link to Paul’s 2 x Exit Strategies added as Log 226 here …
Snippet Link Library
PaulParticipant
Master
Thanks GraHal. Tested the plugin codes on alex version and results go down, regardless I’ve been using the plugins a.t.m. On the first code I used graphonprice sub which should be sup.
@, at the moment none of the codes here are good enough for me. Alex version doesn’t have a hardcoded stoploss. Very difficult timeframe!
PaulParticipant
Master
using atr trailingstop, but now includes a option to take profit near, at or above biglines
biglines can be defined with factor i.e. 50 every 50 points, 100 = every 100 points.
distance to take profit can be set. So if taken profit at every 100 lines (if trailingstop is active), it’s possible to take it say 15 points earlier profit.
Not really happy a.t.m. how things are rounded up/down and affect startlevel. Setup for 5s timeframe.
once trailingstoptype = 1
once biglineclose = 1 // depended on trailing stop
// trailing atr stop
once tsatrperiod = 14 // ts atr parameter
once tsminstop = 10 // ts minimum stop distance
if tradetype=1 then
once tsincrements = 0.0025 // set to 0 to ignore tsincrements //0.0025
once tsminatrdist = 1
once tssensitivity = 1 // [0]close;[1]high/low
elsif (tradetype=2 or tradetype=3) then
once tsincrements = 0 // set to 0 to ignore tsincrements
once tsminatrdist = 0
once tssensitivity = 1 // [0]close;[1]high/low
endif
if trailingstoptype then
if barindex=tradeindex then
if tradetype=1 then
trailingstoplong = 2 // ts atr distance
trailingstopshort = 2 // ts atr distance
elsif (tradetype=2 or tradetype=3) then
trailingstoplong = 4 // ts atr distance
trailingstopshort = 4 // ts atr distance
endif
else
if longonmarket then
if tsnewsl>0 then
if trailingstoplong>tsminatrdist then
if tsnewsl>tsnewsl[1] then
trailingstoplong=trailingstoplong
else
trailingstoplong=trailingstoplong-tsincrements
endif
else
trailingstoplong=tsminatrdist
endif
endif
endif
if shortonmarket then
if tsnewsl>0 then
if trailingstopshort>tsminatrdist then
if tsnewsl<tsnewsl[1] then
trailingstopshort=trailingstopshort
else
trailingstopshort=trailingstopshort-tsincrements
endif
else
trailingstopshort=tsminatrdist
endif
endif
endif
endif
tsatr=averagetruerange[tsatrperiod]((close/10)*pipsize)/1000
//tsatr=averagetruerange[tsatrperiod]((close/1)*pipsize) // (forex)
tgl=round(tsatr*trailingstoplong)
tgs=round(tsatr*trailingstopshort)
if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
tsmaxprice=0
tsminprice=close
tsnewsl=0
endif
if tssensitivity then
tssensitivitylong=high
tssensitivityshort=low
else
tssensitivitylong=close
tssensitivityshort=close
endif
if longonmarket then
tsmaxprice=max(tsmaxprice,tssensitivitylong)
if tsmaxprice-tradeprice(1)>=tgl*pointsize then
if tsmaxprice-tradeprice(1)>=tsminstop then
tsnewsl=tsmaxprice-tgl*pointsize
else
tsnewsl=tsmaxprice-tsminstop*pointsize
endif
endif
endif
if shortonmarket then
tsminprice=min(tsminprice,tssensitivityshort)
if tradeprice(1)-tsminprice>=tgs*pointsize then
if tradeprice(1)-tsminprice>=tsminstop then
tsnewsl=tsminprice+tgs*pointsize
else
tsnewsl=tsminprice+tsminstop*pointsize
endif
endif
endif
if longonmarket then
if tsnewsl>0 then
sell at tsnewsl stop
endif
if tsnewsl>0 then
if low crosses under tsnewsl then
sell at market
endif
endif
endif
if shortonmarket then
if tsnewsl>0 then
exitshort at tsnewsl stop
endif
if tsnewsl>0 then
if high crosses over tsnewsl then
exitshort at market
endif
endif
endif
if biglineclose then
currentprice = round(tradeprice(1))
mpmod = 100
factor = 100 // defines lines
abovelevel0 = currentprice mod mpmod
startlevel = currentprice - abovelevel0
distance=0 //positive = more profit or negative = less profit
if distance<0 then
distancel=distance
distances=-distance
elsif distance>0 then
distancel=distance
distances=-distance
else
distancel=distance
distances=distance
endif
level10up = (startlevel + (1*factor))+distancel
level20up = (startlevel + (2*factor))+distancel
level30up = (startlevel + (3*factor))+distancel
level10down = (startlevel - (1*factor))+distances
level20down = (startlevel - (2*factor))+distances
level30down = (startlevel - (3*factor))+distances
if longonmarket then
if tsnewsl>0 then
sell at startlevel limit
sell at level10up limit
sell at level20up limit
sell at level30up limit
endif
endif
if shortonmarket then
if tsnewsl>0 then
exitshort at startlevel limit
exitshort at level10down limit
exitshort at level20down limit
exitshort at level30down limit
endif
endif
endif
endif
graphonprice startlevel
graphonprice level10down coloured(255,0,0,255)
graphonprice level20down coloured(255,0,0,255)
graphonprice level10up coloured(0,0,255,255)
graphonprice level20up coloured(0,0,255,255)
Above added as Log 227 here …
Snippet Link Library
@Paul If you wanna use a fast tf system, I strongly suggest to DO NOT use a fixed stoploss. It will be hit too much often and you will end compounding small losses and not getting good wins.
I suggest to code an hard exit stop loss, i.e. a signal that invalidate your entry, not necessarily the opposite of your signal, even something different like macd crossing 0.
This is what I use on my few intraday systems and it’s working.