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.
-
-
04/01/2021 at 7:52 AM #16590704/01/2021 at 8:20 AM #165912
No, I haven’t seen that. I’m running v5.5, it opened 2 positions, still open with the trail in place, behaving as it should.
What I have found is that the Target Profit doesn’t register, and maybe has to be entered after each buy instruction, but that won’t effect the Trail.
12345678910111213141516171819202122232425262728// Conditions to enter long positionsif tradetype=1 or tradetype=2 thenIF not longonmarket and CB and Flag THENBUY positionsize CONTRACT AT MARKETSET STOP %LOSS slSET TARGET %PROFIT tpelsif Ctime and longonmarket and CB2 and COUNTOFLONGSHARES < MaxPos and Flag thenBUY positionsize CONTRACT AT MARKETSET STOP %LOSS slSET TARGET %PROFIT tpFlag = 0elsif longonmarket and CB2 and positionperf <0 and COUNTOFLONGSHARES < MaxPos2 and Flag1 thenBUY positionsize CONTRACT AT MARKETSET STOP %LOSS slSET TARGET %PROFIT tpFlag1 = 0elsif longonmarket and CB2 and positionperf <0 and COUNTOFLONGSHARES < MaxPos2 and Flag2 thenBUY positionsize CONTRACT AT MARKETSET STOP %LOSS slSET TARGET %PROFIT tpFlag2 = 0elsif longonmarket and CB2 and positionperf <0 and COUNTOFLONGSHARES < MaxPos2 and Flag3 thenBUY positionsize CONTRACT AT MARKETSET STOP %LOSS slSET TARGET %PROFIT tpFlag3 = 0ENDIFENDIF2 users thanked author for this post.
04/01/2021 at 5:20 PM #16596504/01/2021 at 6:12 PM #165967I had a quick look at DJ 2m HULL-SAR v5.3S and I think there’s something wrong with the trail – try replacing it with this. Backtests ok but I haven’t tried running it.
The DJ looks like it might have some potential going short, I don’t think the NAS is worth the effort.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687// %trailing stop function incl. cumulative positionsonce trailingstoptype1= 1if trailingstoptype1 then//====================trailingpercentlong = .28 // %trailingpercentshort = TP02 // %once acceleratorlong = .029 // [1] default; always > 0 (i.e. 0.5-3)once acceleratorshort= ACC0022 // 1 = default; always > 0 (i.e. 0.5-3)ts2sensitivity = 2 // 1 = close 2 = High/Low 3 = Low/High 4 = typicalprice (not use once)//====================once steppercentlong = (trailingpercentlong/10)*acceleratorlongonce steppercentshort = (trailingpercentshort/10)*acceleratorshortif onmarket thentrailingstartlong = positionprice*(trailingpercentlong/100)trailingstartshort = positionprice*(trailingpercentshort/100)trailingsteplong = positionprice*(steppercentlong/100)trailingstepshort = positionprice*(steppercentshort/100)endifif not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) thennewsl = 0mypositionprice = 0endifpositioncount = abs(countofposition)if newsl > 0 thenif positioncount > positioncount[1] thenif longonmarket thennewsl = max(newsl,positionprice * newsl / mypositionprice)elsenewsl = min(newsl,positionprice * newsl / mypositionprice)endifendifendifif ts2sensitivity=1 thents2sensitivitylong=closets2sensitivityshort=closeelsif ts2sensitivity=2 thents2sensitivitylong=hights2sensitivityshort=lowelsif ts2sensitivity=3 thents2sensitivitylong=lowts2sensitivityshort=highelsif ts2sensitivity=4 thents2sensitivitylong=typicalpricets2sensitivityshort=typicalpriceendifif longonmarket thenif newsl=0 and ts2sensitivitylong-positionprice>=trailingstartlong*pipsize thennewsl = positionprice+trailingsteplong*pipsizeendifif newsl>0 and ts2sensitivitylong-newsl>=trailingsteplong*pipsize thennewsl = newsl+trailingsteplong*pipsizeendifendifif shortonmarket thenif newsl=0 and positionprice-ts2sensitivityshort>=trailingstartshort*pipsize thennewsl = positionprice-trailingstepshort*pipsizeendifif newsl>0 and newsl-ts2sensitivityshort>=trailingstepshort*pipsize thennewsl = newsl-trailingstepshort*pipsizeendifendifif barindex-tradeindex>1 thenif longonmarket thenif newsl>0 thensell at newsl stopendifif newsl>0 thenif low crosses under newsl thensell at marketendifendifendifif shortonmarket thenif newsl>0 thenexitshort at newsl stopendifif newsl>0 thenif high crosses over newsl thenexitshort at marketendifendifendifendifmypositionprice = positionpriceendif2 users thanked author for this post.
04/01/2021 at 6:31 PM #165977Thanks nonetheless!
For me the algo has stopped within a few seconds after start, so no positions then. But maybe still can be problems with the trail? I will try your code!
I have cumulative = false, but maybe that doesn´t matter with your code above?
04/01/2021 at 6:55 PM #165983I tried you code on DOW 5.3S but I get:
“The trading system was stopped because the historical data loaded was insufficient to calculate at least one indicator during the evaluation of the last candlestick.”
I got the same after changing to Preloadbars = 15000
04/01/2021 at 7:03 PM #165985in backtest or autotrading?
04/01/2021 at 7:13 PM #16598604/14/2021 at 10:10 AM #16702804/14/2021 at 2:34 PM #167054Here is the backtest of Dow 2m Hull SAR v5.3S.
Looks good in 200k in short only
04/14/2021 at 2:45 PM #167056I curiously has trouble when i want launch in autotrading the Dow 2m Hull SAR v5.3S
Line 24. Message say end of code ?
04/14/2021 at 2:50 PM #167058I curiously has trouble when i want launch in autotrading the Dow 2m Hull SAR v5.3S
Line 24. Message say end of code ?
You can’t launch the system in autotrading because there are variables in the optimization boxes; you have first to define the values through the code, delete the optimization boxes and then you can run it.
04/14/2021 at 2:59 PM #167059Here is the backtest of Dow 2m Hull SAR v5.3S.
And looks good too in 1M barres
04/14/2021 at 3:03 PM #167061You can’t launch the system in autotrading because there are variables in the optimization boxes; you have first to define the values through the code, delete the optimization boxes and then you can run it.
I don’t think i have to do it with the last version of prorealtime V11.
The problem doesn’t come from it in my opinion
04/14/2021 at 3:04 PM #167062Line 24. Message say end of code ?
It may be that the code needs an extra Endif adding as the last line of the code?
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on