Breakout system for Hong Kong HS50 Cash (HKD10 Mini)
Forums › ProRealTime English forum › ProOrder support › Breakout system for Hong Kong HS50 Cash (HKD10 Mini)
- This topic has 34 replies, 6 voices, and was last updated 7 years ago by BC.
-
-
04/13/2017 at 1:13 PM #3193904/13/2017 at 2:10 PM #31949
Your Strat is very good Bin!
I tried 3 or 4 times to minus 7 hours from all your times (UTC +8) to get to my time (GMT +1 / UTC +1) but I’m sure due to my ‘finger trouble’ I got big overall loss.
So I changed my Platform to UTC +8 and now it works great, results attached.
When I get the GMT+1 times correct, I’ll post the code on here so others can test and we can compare Trades.
GraHal
04/13/2017 at 2:50 PM #31962I dont know why this strategy perform different live versus backtest
But generally speaking about this “spread” thing
When dealing with IG CFD/SB you have a midprice (that price we see on the charts and if nothing has changed lately also used in backtesting)
and then you have the spread we can call it bid and ask, if the spread are 12 points and the midprice is 1000 then the bid is 994 and ask 1006
when trading live with stop and limit you can get filled on a stoporder even if the midprice not touch the stop and to get filled on the limitorder the midprice must be 6 points higher then the limit
The problem is if the bid touch the stop and the midprice dont and if midprice touch the limit but not the ask
this problem is bigger with bigger spread (and many trades with small win/loss), if trading dax with 0,5 on each side you probably get filled on every trade
If i am wrong about this please enlighten me
(when using markets order this is not a problem, only stops and limits)
04/13/2017 at 3:21 PM #31963When thinking about it why not use one version in live and a version with spread added (in the code) in backtesting then the result would be similar?
when dealing with large spread and stop/limit
1 user thanked author for this post.
04/13/2017 at 3:28 PM #31965Hi Eric
Yes, that’s what I think (Wish I am wrong instead of PRT bugs).
I already start live (no spread built in, with little bit amend) 2 days ago, but no trade trigger due to market situtation.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144//Market: Hong Kong HS50 Cash (HKD10 Mini)//Time Zone: UTC+8:00//Time Frame: 15 mins//Please manual stop the system on Hong Kong public hoilday.//Remark: Offical HSI future night trade start from 2013-04-08, 17:00-23:00, amended on 2014-11-03, 17:15-23:45// code-parameterDEFPARAM FlatAfter = 234500 //234500// window high/low calculationONCE StartTime = 90000//91500ONCE EndTime = 93000//100000// trading windowONCE BuyTime = EndTimeONCE SellTime = 234500 //234500//Money managementONCE PositionSize = 1ONCE Capital = 10000ONCE Risk = 5ONCE MaxD = 50 // Quit system if highest close account balance drop over xx%equity = Capital + StrategyProfitmaxrisk = round(equity*(Risk/100))//Check system account balanceif equity<QuitLevel thenquitendifrecordhighest = MAX(recordhighest,equity)QuitLevel = recordhighest*((100-MaxD)/100)//MA FilterFMA=Average[80](close)SMA=Average[200](close)// calculate breakout box high/low and sl/tpIF Time >= StartTime AND Time <= EndTime THENIF TIME = StartTime THENDailyHigh = HighDailyLow = LowENDIFIF High > DailyHigh THENDailyHigh = HighENDIFIF Low < DailyLow THENDailyLow = LowENDIFsl = min(120,(max(30,((DailyHigh - DailyLow)))))tp = sl*4PositionSize = min(10,(max(1,abs(round((maxrisk/sl)/PointValue)*pipsize))))TradeCounterLong = 0TradeCounterShort = 0ENDIF//Define the best trading day and time and avoid trading at lunch & teakbreak high spread period, please manual stop system on Hong Kong public hoilday.//LongLOK1=currentdayofweek=1 and ((time>=091500 and time<120000) or (time>=130000 and time<160000) or (time>=171500 and time<230000))LOK2=currentdayofweek=2 and ((time>=091500 and time<120000) or (time>=130000 and time<160000) or (time>=171500 and time<230000))LOK3=currentdayofweek=3 and ((time>=091500 and time<120000) or (time>=130000 and time<160000) or (time>=171500 and time<230000))LOK5=currentdayofweek=5 and ((time>=130000 and time<160000) or (time>=171500 and time<230000))//ShortSOK1=currentdayofweek=1 and ((time>=091500 and time<120000) or (time>=130000 and time<160000) or (time>=171500 and time<230000))SOK2=currentdayofweek=2 and ((time>=130000 and time<160000) or (time>=171500 and time<230000))SOK4=currentdayofweek=4 and ((time>=091500 and time<120000) or (time>=171500 and time<230000))SOK5=currentdayofweek=5 and ((time>=091500 and time<120000) or (time>=130000 and time<160000) or (time>=171500 and time<230000))// Position managementIF Time >= BuyTime AND Time <= SellTime THEN//Long EntryIF Not LONGONMARKET and (LOK1 or LOK2 or LOK3 or LOK5) and close>DailyHigh and FMA>SMA and TradeCounterLong=0 THENBUY PositionSize CONTRACT AT MARKETTradeCounterLong = TradeCounterLong + 1ENDIF//Short EntryIF Not SHORTONMARKET and (SOK1 OR SOK2 OR SOK4 OR SOK5) and close<DailyLow and FMA<SMA AND TradeCounterShort=0 THENSELLSHORT PositionSize CONTRACT AT MARKETTradeCounterShort = TradeCounterShort + 1ENDIF// trailing stop functionONCE trailingStepLong = 0.08// in %ONCE trailingStepShort = 0.08 // in %trailingStartLongInPoints = max(30,(TP/5))trailingStartShortInPoints = max(30,(TP/4))trailingStepLongInPoints = max(10,(tradeprice(1) * trailingStepLong / 100))trailingStepShortInPoints = max(10,(tradeprice(1) * trailingStepShort / 100))// reset the stoploss valueIF NOT ONMARKET THENnewSL = 0ENDIF// manage long positionsIF LONGONMARKET THEN// first move (breakeven)IF newSL = 0 AND close - tradeprice(1) >= trailingStartLongInPoints * pipsize THENnewSL = tradeprice(1) + trailingStepLongInPoints * pipsizeENDIF// next movesIF newSL > 0 AND close - newSL >= trailingStepLongInPoints * pipsize THENnewSL = newSL + trailingStepLongInPoints * pipsizeENDIFENDIF// manage short positionsIF SHORTONMARKET THEN// first move (breakeven)IF newSL = 0 AND tradeprice(1) - close >= trailingStartShortInPoints * pipsize THENnewSL = tradeprice(1) - trailingStepShortInPoints * pipsizeENDIF// next movesIF newSL > 0 AND newSL - close >= trailingStepShortInPoints * pipsize THENnewSL = newSL - trailingStepShortInPoints * pipsizeENDIFENDIF// stop order to exit the positionsIF newSL > 0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF// close positionsIF Time = SellTime THENIF LONGONMARKET THENSELL AT MARKETENDIFIF SHORTONMARKET AND Time = SellTime THENEXITSHORT AT MARKETENDIFENDIF// stops and targetsSET STOP pLOSS slSET TARGET pPROFIT tpENDIF4 users thanked author for this post.
04/17/2017 at 5:57 PM #3233404/17/2017 at 10:30 PM #32365@Henrik ah I thought it was me! No I’ve not done it again since, forgot sorry and been out over Easter holiday.
I had 4 attempts to change all the times (to UTC+1) and was more deliberate and careful each successive time, I even used find & replace and none of my attempts worked / produced good results.
Weird … only thing I can think of is that not all Bins times are UTC +8?
What you reckon @Bin … is every time used in your code set to UTC + 8 please?
Thanks
GraHal04/18/2017 at 12:59 AM #3237204/18/2017 at 5:29 AM #32373I tried also to change the code for +1GMT, even change all Asian market to +8GMT but nothing worked.
cheers Kasper
04/18/2017 at 9:53 AM #32397Worked good for me if I changed my whole Platform time to UTC +8 (see my results here #31949).
This is very odd, we need to find the reason?
I know it sounds daft, but please Bin say what time it is where you are and post the time on a message here. Whoever sees your post as soon as you post it then check what your clock is showing and post here?
GraHal
04/18/2017 at 11:40 AM #32431Hi Grahal
Yes, I think change whole platform time to UTC+8:00 before backtest or start live is the only choice. Just like Reiner Hang Seng PF, I try to many many setting to fit for UTC+8:00 but failed. Finally I change whole platform time to UTC+1:00 and then start the system. (May be the issue of summer and winter time? )
04/18/2017 at 12:46 PM #32450Hi Bin and Grahal!
I need CET time for my other strategies, so i need to figure something out here.
@BIN are you shore you have +8 setting on hs chart?I ran original code with CET times and got a simular result but not the same, See lower test on picture on erlier post.
Regards
Henrik
04/18/2017 at 1:41 PM #3246204/18/2017 at 2:03 PM #3247104/18/2017 at 2:55 PM #32478 -
AuthorPosts