Francesco’s Hammernegated strategy
Forums › ProRealTime English forum › ProOrder support › Francesco’s Hammernegated strategy
- This topic has 15 replies, 5 voices, and was last updated 5 years ago by solar.
Tagged: hammer, Hammernegated, Negated
-
-
06/27/2019 at 2:08 PM #101538
http://www.prorealcode.com/prorealtime-trading-strategies/oil-10min-hammernegated-pattern-strategy/
I refer to the strategy in the above link. It seems to be working well in recent months. But can someone please do a 200k bars test for us so so the community can further improve the code?
06/27/2019 at 2:09 PM #10153906/28/2019 at 2:33 PM #101616I converted it to MTF (1-minute default TF):
HammerNegated OIL 10min mtf12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758// HammerNegated OIL 10min mtf//// https://www.prorealcode.com/prorealtime-trading-strategies/oil-10min-hammernegated-pattern-strategy/// https://www.prorealcode.com/topic/francescos-hammernegated-strategy///defparam cumulateorders = falsetimeframe(10 minute,updateonclose)ONCE p = 36 //36 4ONCE t = 0 //0 0av1 = average[2,t](close) //2 2av2 = average[2,t](close) //2 15av3 = average[50,t](close) //50 30ONCE x = 0.53 //0.53 0.50bull = close> av1 and close >av2 and close > av3bear = close <av1 and close <av2 and close < av3ONCE n = 150 //150 95ONCE m = 30 //30 85hammerup = min(open[1],close[1]) > high[1]-(high[1]-low[1]) / 3//and timeokhammerupnegated = max(open,close) < min(open[1],close[1]) and abs(open-close) / (high-low) > xcs = hammerup and hammerupnegated and bearhammerdown = max(open[1],close[1]) < low[1]+(high[1]-low[1]) / 3 //and timeokhammerdownnegated = min(open,close) > max(open[1],close[1]) and abs(open-close) / (high-low) > xcl = hammerdown and hammerdownnegated and bulltimeframe(default)if cs AND Not OnMarket thensellshort 1 contract at marketset target pprofit n*averagetruerange[p]set stop ploss m*averagetruerange[p]endifif cl AND Not OnMarket thenbuy 1 contract at marketset target pprofit n*averagetruerange[p]set stop ploss m*averagetruerange[p]endif//TRAILING STOPONCE TGL = 27 //27 30ONCE TGS = 27 //27 18if not onmarket thenMAXPRICE = 0MINPRICE = closePREZZOUSCITA = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TGL*pointsize thenPREZZOUSCITA = MAXPRICE-TGL*pointsizeENDIFENDIFif shortonmarket thenMINPRICE = MIN(MINPRICE,close)if tradeprice(1)-MINPRICE>=TGS*pointsize thenPREZZOUSCITA = MINPRICE+TGS*pointsizeENDIFENDIFif onmarket and PREZZOUSCITA>0 thenEXITSHORT AT PREZZOUSCITA STOPSELL AT PREZZOUSCITA STOPENDIF06/29/2019 at 6:42 AM #101634Thank you robertogozzi for your modification on the code. Interesting result, I have several questions regarding your version of this strategy. For the sake of tidiness and legibility I make my questions in point form:
- whats is the difference between av1 and av2 (line 10 and 11) ( Is it a typo or sth else?)
- would it make more sense for “hammerupnegated = max(open,close) <= min(open[1],close[1]) “(line 19 and same for line 22) as i guess the open of the current bar should always equal the close of previous bar ?(except gaps after session break)
- Do the parameters like p,t,x,m,n c come from optimization? (any WF test done on these parameters?)
- Can you or any others help to test it for 200k bars?
- Have you tried other type of trailing stop or exit strategies?
Meanwhile, I am also interested on the original code’s performance on 15min TF for 200k bar. Would you mind posting the backtest result here for my reference?
Cheers
06/29/2019 at 8:35 AM #101638- it’s not a typo, it’s the optimization tool that said it was the same (I kept all the three not to alter the original logic)
- I kept the same code as the original version, but you can try different settings
- Yes, I optimized all variables due to the fact that I was using a MTF approach, which is different from using a single TF
- Yes, I attach both 100k and 200k performance on the original code, but with a 15-minute TF as you asked (oddly enough there’s no difference in performance and dates on CL, while there are on DAX or Eur/Usd). I never use 200k tests!
- No, I just kept the original code, just changing values or replacing some constants with variables. I also reintroduced the last two lines, but placed them elsewhere to avoid SL & TP be altered every candle when onmarket
07/02/2019 at 2:42 AM #101791I can see that very often the profit is secured after hours the position is opened. It somehow implies that “hammer negated” is not a very precise/ accurate signal, otherwise the market would always trend in direction favourable to the position.
Would you mind sharing your thoughts on this strategy?
07/02/2019 at 3:15 AM #101792Thank you @robertogozzi! I found that the original code written by @Francesco also works pretty well on DJI
Can robertogozzi please help the original code on DJI on 15min TF for 200k bar and share with us the results!
Many thanks!
07/02/2019 at 9:53 AM #101800Performance for DJI-15min with 2.4 spread.
07/02/2019 at 10:07 AM #10180307/02/2019 at 3:19 PM #10181807/02/2019 at 3:44 PM #101819Hola Roberto. He copiado el código del Hammarnegated pero no me funciona.
Hay algún fallo o algo que haya que hacer? yo hice un copy paste. Gracias.
Please speak English on the english forum.
If it does absolutely nothing, then there must be an error in the backtest periods.
Doesn’t it report any error?
It works perfectly if copied as is. Should you have also copied line numbers please remove them.
07/02/2019 at 4:45 PM #101830I attach the .ITF file to be imported.
07/03/2019 at 3:57 PM #101887interesting results, but I think there’s a point to take in consideration.
Although very high win-chance and nice results, there’s no fixed stoploss.
The highest MAE, is about the same as a 2.5-3% stoploss. (1 minute 200k bars us crude)
So perhaps it’s good to have a fixed % set and then you get out. 3% is big seeing a market running against your trade which can happen apparently.
The shorter the timeframe, the lower the stoploss should be?
If switched that code to 10min, it goes up al the way to 11,75% loss on a trade and still a win-chance of more then 90%.
123456789pp=(positionperf*100)sl=2.00 //stoploss in %if pp < -sl thensell at marketexitshort at marketendifgraph pp1 user thanked author for this post.
07/05/2019 at 2:49 AM #101999Thanks Paul for your advice.
It certainly makes me feel more comfortable by applying a fixed percentage stoploss, and of course, the trade off is a little bit lower win rate and profit.
The next thing that comes to my mind is increasing the bet size after losses, since the maximum consecutive loser is just 2 or 3. I know each trade occur independently, however, statistically speaking, i think it maybe worth doing so. What do you think?
07/06/2019 at 6:21 PM #102054Hi fatlung
In my opinion it’s not a good strategy, only maybe if you have 1000 of trades to test.
Example is an other strategy, nice run up and then after unexpected consecutive losses it gained momentum again.
In the backtest it never had so many consecutive losses. To take those losses is bad enough without doubling down.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on