Stoch-RSI-STrend DAX 15M
Forums › ProRealTime English forum › ProOrder support › Stoch-RSI-STrend DAX 15M
- This topic has 11 replies, 3 voices, and was last updated 8 years ago by Nicolas.
-
-
01/16/2017 at 4:39 PM #21331
Hi Guys
My 1st Algo for your usage and eminent comments.
Code Strategy is self-evident and is optimised for the DAX over 100,000 bars @ 15 mins.
Code shows ‘nil 0 bars’ re tick-tick backtest. However on the Detailed Report, Closed Positions List shows 67 0 bars all at £2 loss … can anybody see why please.
Above is not a trick question, but may prove useful to see that even with tick-tick backtest we can still get 0 bars for other reasons? Unless I am missing something … which I can be prone to 🙂
Cheers
GraHal1234567891011121314151617181920212223242526272829303132333435363738394041424344454647DEFPARAM CumulateOrders = False // Cumulating positions deactivated// Go LongIndicator1 = Stochastic[14,3](close)c1 = (indicator1 CROSSES OVER 13)Indicator2 = RSI[2](close)c2 = (indicator2 CROSSES OVER 28)IF c1 AND c2 AND Supertrend[3,10] < Close THENBUY 1 Contract AT MARKETENDIF// Exit LongIndicator3 = Stochastic[14,3](close)c3 = (indicator3 CROSSES UNDER 58)Indicator4 = RSI[6](close)c4 = (indicator4 CROSSES UNDER 24)IF c3 AND c4 THENSELL AT MARKETENDIF// Go ShortIndicator5 = Stochastic[14,3](close)c5 = (indicator5 CROSSES UNDER 55)Indicator6 = RSI[10](close)c6 = (indicator6 CROSSES UNDER 40)IF c5 AND c6 THENSELLSHORT 1 Contract AT MARKETENDIF// Exit ShortIndicator7 = Stochastic[14,3](close)c7 = (indicator7 CROSSES OVER 10)Indicator8 = RSI[25](close)c8 = (indicator8 CROSSES OVER 27)IF c7 AND c8 OR Supertrend[3,10] < Close THENEXITSHORT AT MARKETENDIF// Stops and targets01/16/2017 at 4:55 PM #21335Hey GraHal, I moved your post from the library’s pending queue to this new topic, I’m sorry but the reason is that the strategy is a bit “overrated”, mainly because of optimized indicators periods. That’s why I prefer discuss it here in the forum instead of the library where everyone is expecting nice and finalized “products” .. 🙂
About 0 bars, even if strategy is tested with the new backtest engine, orders can open and close on the same bars, and now stoploss can be tested before the takeprofit and vice-versa: the first price level to be met is the first action to be fired: stoploss or takeprofit, no preferred order any more.
1 user thanked author for this post.
01/16/2017 at 5:04 PM #21336At first glance I’d recommend to be careful with line 43, when mixing “and” and “or” in a conditions combo, it might be useful to use parenthesis to be sure it does what you really wanted it to do…
was it (c7 and c8) or supertrend…
was it c7 and (c8 or supertrend…)
without parenthesis I am not even sure if the software gives priority to the “and” or the “or”, or just reads it in the order it happens without priority…
Another possibility could be you never meant this to be a “or” and wanted “c7 and c8 and supertrend”… like you did in line 10
Don’t know… In any case I wouldn’t mix “and” and “or” without parenthesis
01/16/2017 at 7:16 PM #21356Hey thanks Guys.
With parenthesis (as below) the profit is the same and still ‘Qty 67 o bars’.
With ‘And’ before Supertrend (instead of OR) the profit drops by over 2K
123IF (c7 AND c8) OR Supertrend[3,10] < Close THENEXITSHORT AT MARKETENDIFI thought tick-tick backtest is to tell us how many times an Algo opens and closes in the same bar where there is anomaly re computed profit / loss? See screen shots for nil zero bars shown in Optimise Results but 67 zero bars shown in the Detailed Results. Not what I was expecting from 10.3 tick-tick. Maybe there is a ‘lower limit on anomalous profit / loss’? (its only £2 loss each time there is a 0 bar).
Be nice to know why I’m getting Qty 67 0 bars? What’s even more intriguing is … why / how is it £2 each and every time??
Thanks
GraHal01/16/2017 at 7:28 PM #21361Further thoughts in case above confuses …
I understand that 10.3 tick-tick won’t stop an Algo open and close on the same bars / 0 bars (as Nicolas says above) but I thought 10.3 tick-tick is supposed to tell us / show us how many 0 bars we have … clearly it is not doing this in my scenario as evidenced by the screen shots above?
GraHal
01/16/2017 at 7:56 PM #21362All those times when losing 2 pounds, are they matching candlesticks for which you have simultaneously your short entry conditions met (c5 and c6) and the supertrend lower than close too? Because ok c7 and c5 are mutually exclusive so your (c7 and c8) exit can’t happen same candlestick as your (c5 and c6) entry, but as you confirmed you wanted a “or supertrend<close”, this supertrend exit condition could happen at the same time your (c5 and c6) entry happens without this being a 0 bar backtest bug… You’d be in and out offering the spread to IG, would that match 2 pounds?
01/16/2017 at 8:14 PM #21363(moreover I’d say the zerobar issue was when there was a target and a stop within the same candle, but here anyway you have neither target nor stop, you just have entry rules and exit rules for trades in both directions, so solving the 2 pounds losses mistery would most likely involve simultaneity of entry and exit rules within same bars rather than zerobar stop/target 10.2/10.3 matters)
01/16/2017 at 8:26 PM #21364Haha you’re a genius Noob! I used the Graph function and checked 4 instances of meeting conditions c5 AND C6 AND Supertrend[3,10] < Close and that’s it … spot on!
Also yes … Sellshort IG spread on the DAX during the day is £1 and Exitshort spread is £1 so that solves the ‘£2 mystery’ … genius! 🙂
I had tried similar yesterday but got fed up; I just needed a fresh pair of eyes with a suggestion to renew my enthusiasm … and that’s what this Community is all about! Long live the PRC Community! 🙂
Many Thanks Noob
GraHal01/16/2017 at 10:02 PM #21378Tidied up and improved code and over 30% more profit.
1234567891011121314151617181920212223242526272829303132333435363738DEFPARAM CumulateOrders = False // Cumulating positions deactivatedSTOCH = Stochastic[14,3](close)STREND = Supertrend[3,10]// Go Longc1 = (STOCH CROSSES OVER 13)c2 = (RSI[2](close) Crosses Over 28)IF c1 AND c2 AND STREND < Close THENBUY 1 Contract AT MARKETENDIF// Exit LongC3 = (STOCH CROSSES UNDER 58)c4 = (RSI[6](close) Crosses Under 24)IF (c3 AND c4) OR POSITIONPERF < - 0.0136 OR POSITIONPERF > 0.1 THENSELL AT MARKETENDIF// Go Shortc5 = (STOCH CROSSES UNDER 55)c6 = (RSI[10](close) CROSSES UNDER 40)IF c5 AND c6 AND STREND > Close THENSELLSHORT 1 Contract AT MARKETENDIF// Exit Shortc7 = (STOCH CROSSES OVER 10)c8 = (RSI[25](close) CROSSES OVER 27)IF (c7 AND c8) OR STREND < Close OR POSITIONPERF < - 0.003 OR POSITIONPERF > 0.05 THENEXITSHORT AT MARKETENDIF// Stops and targetsGraHal
01/16/2017 at 11:35 PM #21387Nicolas is the code below underrated enough (standard indicator periods) to be included in the Library?
1234567891011121314151617181920212223242526272829303132333435363738DEFPARAM CumulateOrders = False // Cumulating positions deactivatedSTOCH = Stochastic[14,3](close)STREND = Supertrend[3,10]RS = RSI[14](close)// Go Longc1 = (STOCH Crosses Over 13)c2 = ( RS > 20)IF c1 AND c2 AND STREND < Close THENBUY 1 Contract AT MARKETENDIF// Exit LongC3 = (STOCH CROSSES UNDER 58)c4 = (RS < 20)IF (c3 AND c4) OR POSITIONPERF < - 0.017 OR POSITIONPERF > 0.053 THENSELL AT MARKETENDIF// Go Shortc5 = (STOCH CROSSES UNDER 55)c6 = (RS < 48)IF c5 AND c6 AND STREND > Close THENSELLSHORT 1 Contract AT MARKETENDIF// Exit Shortc7 = (STOCH Crosses Over 10)c8 = (RS > 50)IF c7 AND c8 AND STREND < Close OR POSITIONPERF < - 0.003 OR POSITIONPERF > 0.049 THENEXITSHORT AT MARKETENDIF// Stops and targets01/17/2017 at 10:01 AM #21418Thanks Grahal you’re too kind with me. I agree sometimes we all need another pair of fresh eyes, one day it’s you another day it’s me, and Nicolas PRC forums are great for this. And may I say I am all the more happy I could help you on this one because I can see you help others a lot on these forums, so it’s just fair and fully deserved you get something back out of it when in need of extra eyes.
01/17/2017 at 10:32 AM #21419@GraHal
I appreciate the effort to make it less curve-fitted, but I’m sorry about levels thresholds and positionperf which are still different between long and short positions.
Did you try to separate the strategy : 1 for long and 1 for short side?
What does it means that short position can exit in loss @ -0.003 or in gain @0.049 ? while long positions have different values? Not so obvious to me to understand what was the intellectual approach to take these values or not other one? what about -0.004? Please don’t be offend 🙂
-
AuthorPosts
Find exclusive trading pro-tools on