NAS 2m HULL-SAR trading system
Forums › ProRealTime English forum › ProOrder support › NAS 2m HULL-SAR trading system
- This topic has 343 replies, 42 voices, and was last updated 1 year ago by bege.
-
-
10/18/2020 at 7:16 PM #147674
yeah, I like it – better % win, better gain/loss, lower drawdown, only slightly lower profit but probably better in the long term. Thanks Fifi! 👍
10/18/2020 at 11:52 PM #147683Hi Nonetheless,
Looking at your money management code, it calculates the new positionsize when there’s no market position.
However, if going from long to short directly & visa versa, which can happen a lot, regardless gain or loss there is no change in positionsize, so essentially there could be more gains to explore.
Is this something which can be changed? strategyprofit is only calculated when the position is closed.
Do you think it’s worth the effort to change this?
10/19/2020 at 12:19 AM #147684Had a try, but doesn’t make much difference overall on vectorial strategy.
It had to be place right above the entry since it needs to know before the reversal takes place what positionsize to use. Seems to work as I tended in a glance.
123456789101112131415161718192021222324252627once startpositionsize = 1once factor = 10 // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etconce margin = (close*.05) // tier 1 margin value of 1 contract in instrument currency; change decimal according to available leverageonce margin2 = (close*.05) // tier 2 margin value of 1 contract in instrument currency; change decimal according to available leverageonce tier1 = 55 // ig first tier margin limitonce maxpositionsize = 550 // ig tier 2 margin limitonce minpositionsize = 1 // enter minimum position allowedstrategypp=strategyprofit+(positionperf(0)*100)*(tradeprice(1)/100)if not onmarket or ((longonmarket and condsell) or (shortonmarket and condbuy)) thenpositionsize = startpositionsize + strategypp/(factor*margin)endifif not onmarket or ((longonmarket and condsell) or (shortonmarket and condbuy)) thenif startpositionsize + strategyprofit/(factor*margin) > tier1 thenpositionsize = (((startpositionsize + (strategypp/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 //incorporating tier 2 marginendifif not onmarket or ((longonmarket and condsell) or (shortonmarket and condbuy)) thenif startpositionsize + strategypp/(factor*margin) < minpositionsize thenpositionsize = minpositionsize //keeps positionsize from going below allowed minimumendifif (((startpositionsize + (strategypp/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 > maxpositionsize thenpositionsize = maxpositionsize// keeps positionsize from going above ig tier 2 margin limitendifendifendif10/19/2020 at 1:02 AM #147686one part needed change
12345if onmarket thenstrategypp=strategyprofit+(abs(countofposition)*(positionperf(0)*100)*(tradeprice(1)/100))elsestrategypp=strategyprofitendifDownside is, it’s not exactly a snippet anymore because it must know when conditions are met.
it was interesting to test.
10/19/2020 at 8:17 AM #147706Thanks for that, Paul – def worth having a look at. Recently I changed it to
123456789101112131415161718192021222324252627282930//Money Management NASMM = 0 // = 0 for optimizationif MM = 0 thenpositionsize=1ENDIFif MM = 1 thenONCE startpositionsize = 1ONCE factor = f // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etcONCE margin = (close*.005) // tier 1 margin value of 1 contract in instrument currency; change decimal according to available leverageONCE margin2 = (close*.01)// tier 2 margin value of 1 contract in instrument currency; change decimal according to available leverageONCE tier1 = 200 // IG first tier margin limitONCE maxpositionsize = 2000 // IG tier 2 margin limitONCE minpositionsize = 1 // enter minimum position allowedIF StrategyProfit <> StrategyProfit[1] THENpositionsize = startpositionsize + Strategyprofit/(factor*margin)ENDIFIF StrategyProfit <> StrategyProfit[1] THENIF startpositionsize + Strategyprofit/(factor*margin) > tier1 thenpositionsize = (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 //incorporating tier 2 marginENDIFIF StrategyProfit <> StrategyProfit[1] THENif startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THENpositionsize = minpositionsize //keeps positionsize from going below allowed minimumENDIFIF (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 > maxpositionsize thenpositionsize = maxpositionsize// keeps positionsize from going above IG tier 2 margin limitENDIFENDIFENDIFENDIFusing IF StrategyProfit <> StrategyProfit[1] to allow for instant reversals. Seemed to solve the problem of algos that were onmarket near to 100%, but I hadn’t thought of merging it with the entry conditions… could be worth playing around with.
10/19/2020 at 2:14 PM #147755I tried that too, but didn’t look close enough using graph! There’s a difference at the bar of the reversal.
Did a side by side comparison between your approach and mine, there’s a very small difference.
It’s easier to use your method which had a +400 on a equity of 117500. I remember you ran into this problem somewhere. I will update it in my strategies. Thanks.
10/20/2020 at 9:56 AM #147867Thank you all for your effor and for sharing this in the forum, it is an inspiration for people like me who are trying to start programming algos in PRT. @nonetheless or anyone, could you tell me which GTM hour is this algo using? I’ve tried it in GMT+2 and it works properly but probably another GMT time would be better to fit the parameters of the algo. Thanks in advance.
10/20/2020 at 10:53 AM #147880Hi @Ryugin, it’s set to UK time so for Spain I expect you need to change it to
1Ctime = time >=153000 and time <220000//Euro time, GMT +1it’s just the Wall St opening hours.
1 user thanked author for this post.
10/20/2020 at 11:05 AM #147881@Paul, did you see I added a line to your %TS
12345678once trailingpercentlong = tsl // %once trailingpercentshort = tss // %once accelerator = acc // 1 = default; always > 0 (i.e. 0.5-3)once accelerator2 = acc2 // 1 = default; always > 0 (i.e. 0.5-3)once ts2sensitivity = 0 // [0]close;[1]high/low;[2]low;high//====================once steppercentlong = (trailingpercentlong/10)*acceleratoronce steppercentshort = (trailingpercentshort/10)*accelerator2accelerator2 gives the option to further optimize the TS going short, usually shows a small advantage.
10/20/2020 at 11:17 AM #147883Hi @Ryugin, it’s set to UK time so for Spain I expect you need to change it to
1Ctime = time >=153000 and time <220000//Euro time, GMT +1it’s just the Wall St opening hours.
Just to make sure I haven’t missed something since the timezone comes up in every thread. If I set custom trading hours in PRT that matches the exchange, for Nasdaq UTC-4. I just set the regular trading hours (9:30-16:00) in the script?
10/20/2020 at 11:22 AM #147886yes, I did see that, nice touch! I would like to say it’s perfect now but it is not cuz I found maybe a bug.
Using it on vectorial, I saw a big difference in results using trailing-stop sensitivity 0 or 2 and the difference was too big to explain. Especially the last trade with the big loss. When it uses the close, the trade can exit too early. Something is off there can you ‘ve a look too?
10/20/2020 at 11:43 AM #147887I’ve loaded the original one of nicolas & modifcations by robertoguzzi. That seems to work oke.
Then I took the version from your v3 strategy, which uses % instead of points and uses default close which is off too.
Think I found it
1234if onmarket thentrailingstart = positionprice[0]*(trailingpercent/100) //trailing will start @trailingstart points profittrailingstep = positionprice[0]*(stepPercent/100) //% step to move the stoplossendifIt used positionprice[1] and when there’s no market position and opened a new one it went off the rails.
10/20/2020 at 12:15 PM #14789010/21/2020 at 10:04 AM #147980Hello, first thanks for your work.
I keep seeing that he makes many entries in a row without closing the first ones. For that you have to have a large capital.
I have also tried reducing the 0.4lotti, but it keeps coming in with 1lotti.
Can you help me please? is there something that escapes me?NOTE: In this test I have added the chunk of Fifi:
Mrsi=RSI[14](close)
if longonmarket and CurrentDayOfWeek=5 and close>positionprice and Mrsi crosses under 70 then
sell at market
endif
if shortonmarket and CurrentDayOfWeek=5 and close<positionprice and Mrsi crosses over 30 then
exitshort at market
endif10/21/2020 at 11:26 AM #147985 -
AuthorPosts
Find exclusive trading pro-tools on