oil-10min-hammernegated-pattern-strategy
Forums › ProRealTime English forum › ProOrder support › oil-10min-hammernegated-pattern-strategy
- This topic has 93 replies, 25 voices, and was last updated 4 years ago by nonetheless.
-
-
07/11/2017 at 10:42 AM #40331
Hello everyone, as suggested by Grahal I’m opening a forum thread dedicated to my last posted strategy on oil.
http://www.prorealcode.com/prorealtime-trading-strategies/oil-10min-hammernegated-pattern-strategy/
Happy to compare results but most of all to hear your criticism in order to be able to improve in the spirit of this forum.
Best
Francesco
07/11/2017 at 11:28 AM #40341Hello,
I was thinking about the division by zero problem running this strategy. I would guess the (high-low) statement below would be the source of the error?
This was suggested as a correction:
1hammerupnegated= max(open,close)<min(open[1],close[1]) and abs(open-close)/((high-low)*1)>xBut zero times 1 is still zero i would guess?? An IF-test would fix this, but I was wondering if there was another permanent fix?
1 user thanked author for this post.
07/11/2017 at 12:17 PM #40347I would suggest using
1234567If (high-low) = 0 ThenHiLo = 1ElseHiLo = (high-low)EndIfhammerupnegated= max(open,close)<min(open[1],close[1]) and (abs(open-close)/HiLo)>0.55 users thanked author for this post.
07/11/2017 at 5:50 PM #40378I was testing the strategy but also got the Zero Division last night so I have started it again with the fix from Andyswede:
hammerupnegated= max(open,close)<min(open[1],close[1]) and abs(open-close)/((high-low)*1)>x
cs = hammerup and hammerupnegated and bear
hammerdown = max(open[1],close[1])<low[1]+(high[1]-low[1])/3 //and timeok
hammerdownnegated = min(open,close)>max(open[1],close[1]) and abs(open-close)/((high-low)*1)>xAnd hope it works fine.(have to wait some days since it doesent buy to offen.
—————————————————————————————
I have also tested on the backtest with this addition:
NbrContracts = 2 //need a value for the first trade
IF PositionPerf(1) < 0 THEN
NbrContracts = 2
ENDIF
IF PositionPerf(1) > 0 and PositionPerf(2) > 0 THEN
NbrContracts = 3Buy 3 after second win and buy 2 after first loss.
I also tested it with some sort of martin gale strategy for fun.
IF Barindex = ExitIndex + 1 THEN
ExitIndex = 0
IF PositionPerf(1) < 0 THEN
OrderSize = MAX(OrderSize -0.5, 1)
ELSIF PositionPerf(1) >= 0 THEN
OrderSize = OrderSize +0.2
ENDIF
endif1 user thanked author for this post.
07/11/2017 at 7:34 PM #4038307/11/2017 at 8:05 PM #40385Is this the same as you are trying Andyswede?
12345678910111213If (high-low) = 0 ThenHiLo = 1ElseHiLo = (high-low)EndIfhammerup = 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)/HiLo)>0.5cs = 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)/HiLo)>0.5cl = hammerdown and hammerdownnegated and bull07/11/2017 at 8:30 PM #4038607/11/2017 at 9:10 PM #40387So this last update from Juanj might work ?
Anyway we cant give up now. Fransisco78`s strategy seems Very good:) Thanx again.
1 user thanked author for this post.
07/12/2017 at 3:38 PM #4045707/12/2017 at 3:48 PM #4046107/13/2017 at 11:46 AM #40546hi guys, thank you for the work you are doing, I did not have this division by zero problem, but maybe you could just try to modify the formula like this
max(open,close)<min(open[1],close[1]) and abs(open–close)/((high–low+0.0000001))>x?
Doesnt change the idea underlying idea and should work as a trick?
Best
1 user thanked author for this post.
07/13/2017 at 3:08 PM #40572Thats great.I will test this:)
1 user thanked author for this post.
07/13/2017 at 3:54 PM #4057307/13/2017 at 8:18 PM #40586123456789101112131415161718192021222324//TRAILING STOPTGL =18TGS= 24if not onmarket thenMAXPRICE = 0MINPRICE = closePRICEEXIT = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TGL*pointsize thenPRICEEXIT = MAXPRICE-TGL*pointsizeENDIFENDIFif shortonmarket thenMINPRICE = MIN(MINPRICE,close)if tradeprice(1)-MINPRICE>=TGS*pointsize thenPRICEEXIT = MINPRICE+TGS*pointsizeENDIFENDIFif onmarket and PRICEEXIT>0 thenEXITSHORT AT PRICEEXIT STOPSELL AT PRICEEXIT STOPENDIFHi
Being new to coding, Am I correct in thinking that there is no stop if the price moves immediately against any new trade position? (either long or short).
Also i’d be interested in hear how you decided on TGL = 18 and TGS = 24 ?
Many thanks
07/13/2017 at 10:25 PM #40597MIGUEL33 what you are asking for is a question for francesco78.
Carras: if price goes directly againt target after taken there is no stop loss. Tgl and tgs is only active is price moves xx pips in righ direction. Then the stop will move accordingly to price. Lets say price goes 50pips, then stoploss will be 18 or 24 pips behind/under.
Why 18 and 24 is something francesco78 have coded after his toughts. I use 30 and 20 or so. Slight diffrens.
If you whant/should after my opinion i use own code for stop loss just incase it goes directly in wrong direction, I use this code as my last rung/line in the code.
Set stop ploss xx (I use 110pip)
1 user thanked author for this post.
-
AuthorPosts