@Makside, could you upload your .itf that I have a look at what’s different and what could be improved in this strategy? 🙂
yes if you want, it’s a poc..
Thanks @Makside!
On the long run (1M candles) it does not looks very linear curve, I’ll have a look is something is interesting in your code 😉
I’m afraid, it looks like overoptimized with 1M historical bar…
yes, it’s just a test… it’s up to everyone to do what they want with this code, it’s not turnkey..
PaulParticipant
Master
Hi Tanou, the idea I had use market direction before opening reduces the trades too much.
The buy/sellshort stop order does work, for i.e. on 1 minute but it could mean a delayed entry compared to 10s because of Heikin-Ashi. In the past I worked on OpenStraddle DAX v6p, a bit similar.
Hey Paul, I just went to your strat and indeed it looks quite similar in some points. So what do you think of this one? 😉
PaulParticipant
Master
maybe, what I programmed back then failed. You could implemented yours into barhunter and find/optimise the right bar=time where it has the most chance perhaps. long time ago I’ve looked at that setup.
PaulParticipant
Master
forget about barhunter
It happens in your strategy you use time and opentime together. Not saying it’s wrong here, but it’s tricky!
Another way to use a reset is with intradaybarindex=0. It has influence on results though.
You used Heikin-Ashi in the trailingstop, which for me complicates things. Not so easy to improve on this strategy.
Yes, I agree… I’ll keep having an eye in it to see if some changes can be done.
What do you mean by barhunter ?
PaulParticipant
Master
That’s the downside not posting it in the library 🙂 Spent a lot of time on thisone.
Barhunter was a strategy that searches for a bar where it would setup a breakpoint (straddle sortoff) for long & short with stop order for entry. So it uses 1hour timeframe to do the backtest, and after finding it, you switch mode and use 1 minute timeframe to create the same results you had in the backtest of 1 hour. Pretty good implantation of the trailing stop too.
So 1h is easy, you optimise 24 bars and it found that hour 3/4 is the best hour. That in combination with trend detection system & breakpointpercentage .
here’s the link
https://www.prorealcode.com/topic/strategy-barhunter-dax-v1p/
Will post a few charts there.
Here’s a version of this with a few tweaks – added MM, TP and allowance for American DLS which makes a big difference. Works quite well for a very short backtest, but I don’t understand why it takes 10x more short trades than long? Should be room for improvement there.
Hello @Nonetheless !
It is because it is th short version 😀
Here is the long one 😉 (I can’t make it linear, if you have ideas!)
//-------------------------------------------------------------------------
// Code principal : Neutral Zone Long.
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// Code principal : Neutral Zone Long
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// Code principal : Neutral Zone Long
//-------------------------------------------------------------------------
DEFPARAM CumulateOrders = false
DEFPARAM Preloadbars = 50000
// Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".
DEFPARAM FLATBEFORE = 152900
// Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"
DEFPARAM FLATAFTER = 220000
// Variables / Réglages :
TimeOpen = 153000
TimeClose = 220000
x=21 //Taille de la zone autour de l'ouverture pour activation/Désactivation
//-----------------------------------------------------------------------------------------------------------------------------------------------------
//HORAIRES DE TRADING
Ctime = time >= TimeOpen and time < TimeClose
//--------------------------------------
//Nouveau OpenPrice et OpenDay a 15:30
IF OPENTIME = (TimeOpen) then
OpenPrice = Open
OpenD = OpenDay
strategyprofitpoint=0
l = 0
s = 0
count = 0
debutopen = barindex
ENDIF
if(strategyprofit<>strategyprofit[1]) then
strategyprofitpoint = (strategyprofit-strategyprofit[1])/pointvalue
endif
//------------------------------------
//Représentation graphique Heikin-Ashi
once xOpen = open
Price = (open + close + low + high)/4
if barindex > 0 then
xOpen = (xOpen + Price[1]) / 2
endif
xLow = min(low,min(Price,xOpen))
xHigh = max(high,max(Price,xOpen))
GreenHA = Price > xOpen
RedHA = Price < xOpen
//------------------------------------
// STRATEGIE ---------------------------------------------------------------------------------
// Conditions Short
If s=0 then
If xHigh=xOpen and xHigh<(OpenPrice-x) then
s1 = 1
Else
s1 = 0
Endif
Endif
//Conditions Long
If l=0 then
If xLow=xOpen and xLow>(OpenPrice+x) then
l1 = 1
Else
l1=0
Endif
Endif
//-------------------------------------------------------------------------------------------
//POSITION LONGUE
IF l1 and strategyprofitpoint<=0 and count<2 and ctime THEN
Buy 1 contract at market
l1 = 0
l = 1
count = count + 1
ENDIF
//POSITION COURTE
IF s1 and not onmarket and strategyprofitpoint<=0 and count<2 and ctime THEN
s1 = 0
count = count + 1
ENDIF
//POSITION COURTE
IF s1 and strategyprofitpoint<=0 and count>=1 and count<2 and ctime THEN
Sellshort 1 contract at market
s1 = 0
s = 1
count = count + 1
ENDIF
//TP et SL ---------------------------------------------------------------------------------
//Variables
NATR = 14 //ATR Period
SATR = 20 // ATR Multiplier for Stop
PATR = 1// ATR Multiplier for Profit
//Stop and Target
SET STOP LOSS SATR*AverageTrueRange[NATR](close)
SET TARGET PROFIT PATR*AverageTrueRange[NATR](close)
It is because it is th short version
Salut Tanou – yes, I did see that you had posted long and short versions, what I meant is that it seemed odd that they weren’t completely exclusive – the short version still takes some long trades and vice versa.
This is the best I could do for a fully ambidextrous version, lots more trades, more or less equal long and short … but only slightly more profitable and less stable. Hard to say if it’s worth it with a short backtest ???
I added an MA on the 2m TF, but this is the main change:
//POSITION LONGUE
IF l1 and strategyprofitpoint<=0 and count<2 and ctime and cb1 THEN
Buy PositionSize contract at market
l1 = 0
l = 1
count = count + 1
SET TARGET %PROFIT tp
ENDIF
//POSITION COURTE
IF s1 and strategyprofitpoint<=0 and count<2 and ctime and cs1 THEN
Sellshort PositionSize contract at market
s1 = 0
s = 1
count = count + 1
SET TARGET %PROFIT tps
ENDIF