Sorex hoyi scalper
Forums › ProRealTime English forum › ProOrder support › Sorex hoyi scalper
- This topic has 29 replies, 6 voices, and was last updated 4 years ago by MAKSIDE.
-
-
04/12/2020 at 12:00 AM #125739
Hi all,
Thanks to everyone sharing valuable code on this website, I’m learning a lot from being part of this community. I’m sharing here a 1 second TF code that seem to work well in backtestig (with very little backtest data..) but not sure how it will work live/forward testing. Both short and long strategies seem to have high win rate (and it seem to work well in tamdem, when the drawdays happens in one it goes up on the other, utlimately end up in a win position), but I would like to improve the precision of entry point to reduce drawdown. Does anhyone have an idea on how to achieve this on such a short timeframe? The result from the screenshot are with 6 points spread DJI
Sorex hoyi: “With a pulse clocking in at more than a 1000 per minute, the smallest mammal in North America really needs lots of food to keep its phenomenal metabolism going. Every day it eats three times its own weight. To do so it needs to constantly eat and never sleeps for more than a few minutes. An hour without food would mean certain death.
LONG
LONG123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332// Definition of code parametersDEFPARAM CumulateOrders = true // Cumulating positions deactivatedDEFPARAM preloadbars = 10000DEFPARAM flatbefore = 090000DEFPARAM flatafter = 220000once spreadmode = 1 // [1]dji;[2]us500;[3]us100;[4]dax;[5]saf;[6]ftse;[7]cac40// trailing stop atr// 'Value 2 is nice for 1/10s with max 3. So this parameter doesn’t need to be optimised'once trailingstoptype = 1 // trailing stop - 0 off, 1 ononce trailingstoplong = 2 // trailing stop atr relative distanceonce trailingstopshort = 2 // trailing stop atr relative distanceonce atrtrailingperiod = 14 // atr parameter valueonce minstop = 10 // minimum trailing stop distance//************************************************************************//Money Management DOWMM = 0 // = 0 for optimizationif MM = 0 thenpositionsize=1ENDIFif MM = 1 thenONCE startpositionsize = 1ONCE factor = 30 // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etcONCE factor2 = 20 // tier 2 factorONCE 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 = 55 // DOW €1 IG first tier margin limitONCE maxpositionsize = 550 // DOW €1 IG tier 2 margin limitONCE minpositionsize = .2 // enter minimum position allowedIF Not OnMarket THENpositionsize = startpositionsize + Strategyprofit/(factor*margin)ENDIFIF Not OnMarket THENIF startpositionsize + Strategyprofit/(factor*margin) > tier1 thenpositionsize = (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor2*margin2)) + tier1 //incorporating tier 2 marginENDIFIF Not OnMarket THENif startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THENpositionsize = minpositionsize //keeps positionsize from going below allowed minimumENDIFIF (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor2*margin2)) + tier1 > maxpositionsize thenpositionsize = maxpositionsize// keeps positionsize from going above IG tier 2 margin limitENDIFENDIFENDIFENDIF//************************************************************************//vwap code taken from Nicolas PRC_VWAP intraday indicator//if(intradaybarindex=0) then//sd = 0//else//sd = SUMMATION[d](max(abs(high-vwap),abs(vwap-low)))/d//endif//************************************************************************TIMEFRAME (1 minute)ST60 = SuperTrend[st5,st6]l10 = close > ST60TIMEFRAME (20 seconds)m = Momentum[momen](close)ST20 = SuperTrend[st1,st2]////TIMEFRAME (15 seconds)//voss1, voss2 = CALL "PRC_Voss Predictive Filter VPF"[20, 3, 0.25]//l10 = voss1 crosses over voss2TIMEFRAME (10 seconds)ST10 = SuperTrend[st3,st4]VWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume)l1 = close > close[1]l9 = close > VWAP//s1 = close < close[1]TIMEFRAME (Default)l2 = close > close[1]l3 = m crosses over 0l4 = close > ST10l5 = close > ST20// Conditions to enter long positionsIF not longonmarket and l1 and l2 and l3 and l4 and l5 and l9 and l10 THENBUY positionsize CONTRACT AT MARKETENDIF// Conditions to enter short positions//IF not shortonmarket and s1 and s2 and s3 and s4 and s5 and s6 THEN//SELLSHORT positionsize CONTRACT AT MARKET//ENDIF//SET STOP %LOSS 2SET TARGET %PROFIT 2.1////************************************************************************// spreadif spreadmode=1 then // wallstreetif time > 090000 and time <= 153000 thenspread=2.4elsif time > 153000 and time <= 220000 thenspread=1.6elsif time > 221500 and time <= 223000 thenspread=9.8elsif time > 230000 and time <= 235959 thenspread=9.8elsif time = 000000 thenspread=9.8elsespread=3.8endifelsif spreadmode=2 then // us500if time > 090000 and time <= 220000 thenspread=0.4elsif time > 221500 and time <= 223000 thenspread=1.5elsif time > 223000 and time <= 235959 thenspread=1.5elsif time = 000000 thenspread=1.5elsespread=0.6endifelsif spreadmode=3 then // us100if time > 153000 and time <= 220000 thenspread=1elsif time > 221500 and time <= 223000 thenspread=5elsif time > 230000 and time <= 235959 thenspread=5elsif time = 000000 thenspread=5elsespread=2endifelsif spreadmode=4 then // daxif time > 090000 and time <= 173000 thenspread=1elsif time > 173000 and time <= 220000 thenspread=2elsif time > 220000 and time <= 235959 thenspread=7elsif time >= 000000 and time <= 080000 thenspread=7elsif time > 080000 and time <= 090000 thenspread=2endifelsif spreadmode=5 then // south african 40if time > 073000 and time <= 163000 thenspread=8elsespread=30endifelsif spreadmode=6 then // ftse100if time > 080000 and time <= 163000 thenspread=1elsif time > 163000 and time <= 210000 thenspread=2elsif time > 070000 and time <= 075000 thenspread=2elsespread=5endifelsif spreadmode=7 then // cac40if time > 090000 and time <= 173000 thenspread=1elsif time > 173000 and time <= 220000 thenspread=2elsif time > 220000 and time <= 235959 thenspread=5elsif time > 000000 and time <= 080000 thenspread=5elsif time > 080000 and time <= 090000 thenspread=2endifendifspread=spread/2//************************************************************************//----------------------------------------------atrtrail = averagetruerange[atrtrailingperiod]((close/10)*pipsize)/1000tgl = round(atrtrail*trailingstoplong)tgs = round(atrtrail*trailingstopshort)if trailingstoptype = 1 then//if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) thenmaxprice = 0minprice = closenewsl = 0endif//if longonmarket thenmaxprice = max(maxprice,close)if maxprice-tradeprice(1)>=tgl*pointsize thenif maxprice-tradeprice(1)>=minstop thennewsl = maxprice-tgl*pointsizeelsenewsl = maxprice - minstop*pointsizeendifendifendifif shortonmarket thenminprice = min(minprice,close)if tradeprice(1)-minprice>=tgs*pointsize thenif tradeprice(1)-minprice>=minstop thennewsl = minprice+tgs*pointsizeelsenewsl = minprice + minstop*pointsizeendifendifendif//if longonmarket thenif newsl>0 thensell at newsl stopendifif newsl>0 thenif low < newsl thensell at marketendifendifendif//if shortonmarket thenif newsl>0 thenexitshort at newsl stopendifif newsl>0 thenif high > newsl thenexitshort at marketendifendifendifendifGRAPHONPRICE VWAPSHORT123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331// Definition of code parametersDEFPARAM CumulateOrders = true // Cumulating positions deactivatedDEFPARAM preloadbars = 10000DEFPARAM flatbefore = 090000DEFPARAM flatafter = 220000once spreadmode = 1 // [1]dji;[2]us500;[3]us100;[4]dax;[5]saf;[6]ftse;[7]cac40// trailing stop atr// 'Value 2 is nice for 1/10s with max 3. So this parameter doesn’t need to be optimised'once trailingstoptype = 1 // trailing stop - 0 off, 1 ononce trailingstoplong = 2 // trailing stop atr relative distanceonce trailingstopshort = 2 // trailing stop atr relative distanceonce atrtrailingperiod = 14 // atr parameter valueonce minstop = 10 // minimum trailing stop distance//************************************************************************//Money Management DOWMM = 1 // = 0 for optimizationif MM = 0 thenpositionsize=1ENDIFif MM = 1 thenONCE startpositionsize = 1ONCE factor = 30 // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etcONCE factor2 = 20 // tier 2 factorONCE 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 = 55 // DOW €1 IG first tier margin limitONCE maxpositionsize = 550 // DOW €1 IG tier 2 margin limitONCE minpositionsize = .2 // enter minimum position allowedIF Not OnMarket THENpositionsize = startpositionsize + Strategyprofit/(factor*margin)ENDIFIF Not OnMarket THENIF startpositionsize + Strategyprofit/(factor*margin) > tier1 thenpositionsize = (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor2*margin2)) + tier1 //incorporating tier 2 marginENDIFIF Not OnMarket THENif startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THENpositionsize = minpositionsize //keeps positionsize from going below allowed minimumENDIFIF (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor2*margin2)) + tier1 > maxpositionsize thenpositionsize = maxpositionsize// keeps positionsize from going above IG tier 2 margin limitENDIFENDIFENDIFENDIF//************************************************************************//vwap code taken from Nicolas PRC_VWAP intraday indicator//if(intradaybarindex=0) then//sd = 0//else//sd = SUMMATION[d](max(abs(high-vwap),abs(vwap-low)))/d//endif//************************************************************************TIMEFRAME (1 minute)ST60 = SuperTrend[st5,st6]s10 = close < ST60TIMEFRAME (20 seconds)m = Momentum[momen](close)ST20 = SuperTrend[st1,st2]////TIMEFRAME (15 seconds)//voss1, voss2 = CALL "PRC_Voss Predictive Filter VPF"[20, 3, 0.25]//l10 = voss1 crosses over voss2TIMEFRAME (10 seconds)ST10 = SuperTrend[st3,st4]VWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume)s1 = close < close[1]s9 = close < VWAP//s1 = close < close[1]TIMEFRAME (Default)s2 = close < close[1]s6 = m crosses under 0s7 = close < ST10s8 = close < ST20// Conditions to enter long positions//IF not longonmarket and l1 and l2 and l6 and l7 and l8 and l9 THEN//BUY positionsize CONTRACT AT MARKET//ENDIF// Conditions to enter short positionsIF not shortonmarket and s1 and s2 and s6 and s7 and s8 and s9 and s10 THENSELLSHORT positionsize CONTRACT AT MARKETENDIF//SET STOP %LOSS 2SET TARGET %PROFIT 2.1////************************************************************************// spreadif spreadmode=1 then // wallstreetif time > 090000 and time <= 153000 thenspread=2.4elsif time > 153000 and time <= 220000 thenspread=1.6elsif time > 221500 and time <= 223000 thenspread=9.8elsif time > 230000 and time <= 235959 thenspread=9.8elsif time = 000000 thenspread=9.8elsespread=3.8endifelsif spreadmode=2 then // us500if time > 090000 and time <= 220000 thenspread=0.4elsif time > 221500 and time <= 223000 thenspread=1.5elsif time > 223000 and time <= 235959 thenspread=1.5elsif time = 000000 thenspread=1.5elsespread=0.6endifelsif spreadmode=3 then // us100if time > 153000 and time <= 220000 thenspread=1elsif time > 221500 and time <= 223000 thenspread=5elsif time > 230000 and time <= 235959 thenspread=5elsif time = 000000 thenspread=5elsespread=2endifelsif spreadmode=4 then // daxif time > 090000 and time <= 173000 thenspread=1elsif time > 173000 and time <= 220000 thenspread=2elsif time > 220000 and time <= 235959 thenspread=7elsif time >= 000000 and time <= 080000 thenspread=7elsif time > 080000 and time <= 090000 thenspread=2endifelsif spreadmode=5 then // south african 40if time > 073000 and time <= 163000 thenspread=8elsespread=30endifelsif spreadmode=6 then // ftse100if time > 080000 and time <= 163000 thenspread=1elsif time > 163000 and time <= 210000 thenspread=2elsif time > 070000 and time <= 075000 thenspread=2elsespread=5endifelsif spreadmode=7 then // cac40if time > 090000 and time <= 173000 thenspread=1elsif time > 173000 and time <= 220000 thenspread=2elsif time > 220000 and time <= 235959 thenspread=5elsif time > 000000 and time <= 080000 thenspread=5elsif time > 080000 and time <= 090000 thenspread=2endifendifspread=spread/2//************************************************************************//----------------------------------------------atrtrail = averagetruerange[atrtrailingperiod]((close/10)*pipsize)/1000tgl = round(atrtrail*trailingstoplong)tgs = round(atrtrail*trailingstopshort)if trailingstoptype = 1 then//if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) thenmaxprice = 0minprice = closenewsl = 0endif//if longonmarket thenmaxprice = max(maxprice,close)if maxprice-tradeprice(1)>=tgl*pointsize thenif maxprice-tradeprice(1)>=minstop thennewsl = maxprice-tgl*pointsizeelsenewsl = maxprice - minstop*pointsizeendifendifendifif shortonmarket thenminprice = min(minprice,close)if tradeprice(1)-minprice>=tgs*pointsize thenif tradeprice(1)-minprice>=minstop thennewsl = minprice+tgs*pointsizeelsenewsl = minprice + minstop*pointsizeendifendifendif//if longonmarket thenif newsl>0 thensell at newsl stopendifif newsl>0 thenif low < newsl thensell at marketendifendifendif//if shortonmarket thenif newsl>0 thenexitshort at newsl stopendifif newsl>0 thenif high > newsl thenexitshort at marketendifendifendifendifGRAPHONPRICE VWAP2 users thanked author for this post.
04/12/2020 at 12:21 AM #12574104/12/2020 at 8:47 AM #125750Thx for sharing, i will check
about TF, on my side, i use also a higher TF > 15 or 30mn in order to get the big trend (i have 1s/1mn/5mn/30mn)
did you test that ?
about TF 20 second, it’s s specific TF i think. Maybe you may have a better result with 30s which is more “standard” ? not tested..
for the entrypoint, a work around the settings of the candles could improve it
maybe you could work also an exit if TP isn’t reached.. a security if failed. It’s the most difficult with TF 1s, when to go out..
1 user thanked author for this post.
04/12/2020 at 10:45 AM #12576204/12/2020 at 11:19 AM #125764Thanks for sharing eckaw. Looks indeed that spread is not used. Regardless of using, the spread needs to be set in the backtest engine. Since your code trade specific times on which the spread is almost the same, the extra code don’t add much. In my renko version I got it removed. Can you post the variables used?
04/12/2020 at 12:02 PM #125769@Paul Thanks for the insight about the spread. I’m fairly new to coding in PRT so I appreciate your advice. I used spread 6pt in the backtest settings.
Variables used:
momen – 10
st1 – 18
st4 – 4
st3 – 6
st4 – 1
d – 3
st5 – 9
st6 – 2
There may be some other code that could be removed, I will look into this – if that’s the case I’ll post another version. Would be intersted to hear your thoughts on this idea, why it could work / why it won’t work.
1 user thanked author for this post.
04/12/2020 at 12:04 PM #12577004/12/2020 at 12:52 PM #125780When I want folk to check out a System of mine on their Platform and offer improvements etc, I always post the .itf file with all the settings for variables set up in the optimiser … makes it loads easier for them .. download, import, backtest … 3 clicks of the mouse, and they can start working on it.
Alsos .itf files show as titled versions in the Attachment list at the top of every page and so it makes it loads easier to later find previous and latest versions (backup if our PC crashes even?) … they would always be available on this website.
Might you post the .itf please? 🙂
04/12/2020 at 1:18 PM #12578304/12/2020 at 2:31 PM #125791The stoploss is too big for a 1s or 10s system for me. Changing it to 0.5% results in less profit but still good overall. But if I check when signals come and apply my reenter theory for robustness, it seems results go down too much.
I did some work on it, so I share it.
Made 2 systems into one. Can’t run long&short at the same time.
Results are the same on yours posted above.
2 users thanked author for this post.
04/13/2020 at 11:06 AM #125892I’m getting rejections on both versions of this – ‘division by zero’ on the original and ‘negative or zero parameter’ on Paul’s version.
04/13/2020 at 11:59 AM #125908Hi @eckaw thanks for sharing this hungry little shrew – seems it could have potential.
One thing I noticed though is that your Supertrend settings are miles away from the default and on such a short back test this strongly indicates a curve fit. I use Supertrend a lot but try to keep to the default settings for back tests of less than 1 year, otherwise it’s v likely that you’re bending your parameters to fit the data.
(3,10) is the most common setting and halving those values (1.5,5) is also an option. (2,7) is a good mid-way point and within the extremely limited TF, this would appear to give the best result for Sorex Hoyi.
This is not to say that your numbers won’t work, they certainly do for now, just that I fear they may not hold up in the long run.
Just a suggestion …
04/13/2020 at 12:43 PM #125917@nonetheless thanks for feedback. I will take a look at this and do further testing.
I just tried to launch Paul amended version with slightly different SuperTrend settings and it failed to start. There was a message “The trading sytstem was stopped because an indicator received a negative or zero parameter ex:(-10).”
It seems to work well in backtest. I’m going through the code but haven’t yet figured out yet what it could be.
04/13/2020 at 1:52 PM #125933Probably it happens quicker on a short timeframe those errors. Same annoying thing on renko, but I got it to work for now.
Here are few idea’s.
Use below to make sure there is data.
1if barindex>1 and range>0 thenand/or
when there’s possibly no data i.e. the max function
1max(abs(open - close), 0.000000001)can also be used on an average I think, like
1max(ExponentialAverage[20](close),0.000000001)I don’t now where exactly is the cause, so in the renko version I use above a lot.
04/13/2020 at 6:27 PM #125982 -
AuthorPosts
Find exclusive trading pro-tools on