PaulParticipant
Master
Hi Fifi, that concept can be expanded in multiple ways.
with above example, i.e. when lowest[barindex-tradeindex](close) was below another line, which means there was a fast run-up where you prevent buying near the top. If prevented buying on the top, it could still be considered to close a short position.
Also for exits, although then it’s best to have the code below the entry , something like this
if tradeprice(1)>fibobear62b and highest[barindex-tradeindex](close)<fibobull62b then
if close crosses under fibobear62b then
sell at market
endif
endif
if tradeprice(1)<fibobull62b and lowest[barindex-tradeindex](close)>fibobear62b then
if close crosses over fibobull62b then
exitshort at market
endif
endif
Although all this would not give a greater equitycurve, maybe if programmed well could results in an algo with a smaller stoploss like 0.5 to 1%.
Hi Paul,
I will test.
Lowering the SL A 1 is good, I don’t think underneath.
PaulParticipant
Master
i’am was optimistic 🙂 lowering it to 1% would be nice for this timeframe. For now I keep it for testing at 2%.
I did had a look at the reversal exit code.
While I splitted short in 3 sections, there are all the same.
The problem was long which didn’t work before, there splitting worked. Ofcourse all curvefitting after the fact.
It’s not robust, because i.e. slippage & high spread could influence this too. But I always like to try something new even if it fails.
The idea; if the position doesn’t gain ground after opening, the criteria for the range is lower which increases the chance for an early exit.
Also a gap rewrite.
// reversal exit
once longexit =1
once shortexit=1
if longexit then
if longonmarket and highest[barindex-tradeindex](high)-tradeprice(1)<25 then
minrangedistL1=1
cl1=close<open and close[1]<open[1] and close[2]<open[2]
cl2=(close=low or close[1]=low[1] or close[2]=low[2])
cl3=(range>(close/1000)*minrangedistL1 or range[1]>(close[1]/1000)*minrangedistL1 or range[1]>(close[1]/1000)*minrangedistL1)
if cl1 and cl2 and cl3 and (high>high[1] or low<low[1]) and barindex-tradeindex>=3 then
sell at market
endif
endif
if longonmarket and (highest[barindex-tradeindex](high)-tradeprice(1)>=25 and highest[barindex-tradeindex](high)-tradeprice(1)<50) then
minrangedistL2=3
cl1a=close<open and close[1]<open[1] and close[2]<open[2]
cl2a=(close=low or close[1]=low[1] or close[2]=low[2])
cl3a=(range>(close/1000)*minrangedistL2 or range[1]>(close[1]/1000)*minrangedistL2 or range[1]>(close[1]/1000)*minrangedistL2)
if cl1a and cl2a and cl3a and (high>high[1] or low<low[1]) and barindex-tradeindex>=3 then
sell at market
endif
endif
if longonmarket and highest[barindex-tradeindex](high)-tradeprice(1)>=50 then
minrangedistL3=4
cl1b=close<open and close[1]<open[1] and close[2]<open[2]
cl2b=(close=low or close[1]=low[1] or close[2]=low[2])
cl3b=(range>(close/1000)*minrangedistL3 or range[1]>(close[1]/1000)*minrangedistL3 or range[1]>(close[1]/1000)*minrangedistL3)
if cl1b and cl2b and cl3b and (high>high[1] or low<low[1]) and barindex-tradeindex>=3 then
sell at market
endif
endif
endif
if shortexit then
if shortonmarket and tradeprice(1)-lowest[barindex-tradeindex](low)<25 then
minrangedistS1=1.5
cs1=close>open and close[1]>open[1] and close[2]>open[2]
cs2=(close=high or close[1]=high[1] or close[2]=high[2])
cs3=(range>(close/1000)*minrangedistS1 or range[1]>(close[1]/1000)*minrangedistS1 or range[1]>(close[1]/1000)*minrangedistS1)
if cs1 and cs2 and cs3 and (high>high[1] or low<low[1]) and barindex-tradeindex>=3 then
exitshort at market
endif
endif
if shortonmarket and (tradeprice(1)-lowest[barindex-tradeindex](low)>=25 and tradeprice(1)-lowest[barindex-tradeindex](low)-tradeprice(1)<50) then
minrangedistS2=1.5
cs1a=close>open and close[1]>open[1] and close[2]>open[2]
cs2a=(close=high or close[1]=high[1] or close[2]=high[2])
cs3a=(range>(close/1000)*minrangedistS2 or range[1]>(close[1]/1000)*minrangedistS2 or range[1]>(close[1]/1000)*minrangedistS2)
if cs1a and cs2a and cs3a and (high>high[1] or low<low[1]) and barindex-tradeindex>=3 then
exitshort at market
endif
endif
if shortonmarket and tradeprice(1)-lowest[barindex-tradeindex](low)>=50 then
minrangedistS3=1.5
cs1b=close>open and close[1]>open[1] and close[2]>open[2]
cs2b=(close=high or close[1]=high[1] or close[2]=high[2])
cs3b=(range>(close/1000)*minrangedistS3 or range[1]>(close[1]/1000)*minrangedistS3 or range[1]>(close[1]/1000)*minrangedistS3)
if cs1b and cs2b and cs3b and (high>high[1] or low<low[1]) and barindex-tradeindex>=3 then
exitshort at market
endif
endif
endif
if onmarket then
if dayofweek=0 and (hour=0 and minute>=57) then
if shortonmarket and close>dopen(0) and dopen(0)-dclose(1)>50 then
exitshort at market
endif
if longonmarket and close<dopen(0) and dclose(1)-dopen(0)>50 then
sell at market
endif
endif
endif
That looks promising 🙂
Can you update us with the .itf file @Paul? 😉
This setup is working very unklucky the last 7 days. Every time switching the position on low/high and turn into the other side. 9 SL in a row is not normal for that strategy. Hope it will work better the next days.
Attached the new itf.
PaulParticipant
Master
@Tanou not as this moment, the posted v5b is fine.
Hi, I have added a routine that close position if loss or profit aftert X bar and I have optimize the variable longexit (for reversal)…it seems to have some improvement. Thanks
PaulParticipant
Master
funny, by mistake I’ve loaded up v5p on the dax 10s
with these settings ;
once tradetype = 1 // [1]long/short [2]long [3]short
once reenter = 1 // [1]on [0]off (off ignores positionperftype/value below)
once positionperftype = 1 // [0]loss/gain [1]loss [2]gain
once positionperfvalue = 0 // % (0 or higher)
@Paul
Its 10s yes, but on DJ, not DAX right?
PaulParticipant
Master
no loaded on the dax 10s, the dj version for 3 min v3p5
Interesting Paul! If one were to optimise this strategy weekly / monthly, which parameters would you then optimise? I had a pretty bad week recently and wondering if it would be better to run it with weekly / monthly optimisations?
@volpiemanuele, thanks for all yours algos. I launch the DJ-3m-Vectorial-V3p5_v1, but it crashed.
Hi @Paul, shouldn’t the code:
(range>(close/1000)*minrangedist– or range[1]>(close[1]/1000)*minrangedist– or range[1]>(close[1]/1000)*minrangedist–)
be
(range>(close/1000)*minrangedist– or range[1]>(close[1]/1000)*minrangedist– or range[2]>(close[2]/1000)*minrangedist–)
on all occurences (–) in the code you posted?
@Nicoeni1: I was wrong to share the file … this is the correct one that I also use in real. Thanks