screening a strategy on each stock of us 500
Forums › ProRealTime English forum › ProScreener support › screening a strategy on each stock of us 500
- This topic has 7 replies, 2 voices, and was last updated 6 years ago by Nicolas.
-
-
03/26/2018 at 1:45 PM #66438
Hi, I was wondering if there is any way to screen a strategy on every single shares of the SP 500.
Just to be clear. I want to see if a mean reverting strategy that works well on the SP 500 could be applied to a basket of stocks instead than to the whole index. It would be interesting to see if there is a particular basket that contribute to the “mean revertingness” of SP 500 and isolate it.
Many thanks
Francesco
03/26/2018 at 1:48 PM #66439We could simulate profit generated by a strategy of each individual stock of a shares list.. but it would be tricky, depends of the strategy itself! and it would only be possible on the last 254 bars (history limitation of ProScreener).
If you could expose the strategy (or the probacktest code), I could lend an hand 🙂
03/26/2018 at 2:18 PM #66444Thank you Nicolas,
the strategies I had in mind are the one that we published on the SP 500
https://www.prorealcode.com/prorealtime-trading-strategies/sp-500-daily-rsi2-long-short-strategy/
and
https://www.prorealcode.com/prorealtime-trading-strategies/sp-500-reverting-strategy/
Let me know if you think you can work something out of them and if I can do anything to help
Thank you!
03/26/2018 at 4:10 PM #66462Quick example of the first one converted into a screener:
12345678910111213141516171819202122232425262728293031a = 5b = 20cl = RSI[2]<acs = RSI[2]>100-aif cl thenlong=1short=0entrylong=closeendifif cs thenlong=0short=1entryshort=closeendifif long and RSI[2]>100-(a+b) and close < open thenlong=0gain=(close-entrylong)+gain//sell at marketendifif short and RSI[2]<(a+b) thenshort=0gain=(entryshort-close)+gain//exitshort at marketendifscreener[gain](gain)Your a and b variables are optimized in ProBacktest, so I took dummy values for them. The gain is in points, not in money, depends of shares quantity you bought for each stock of course ..
1 user thanked author for this post.
03/26/2018 at 4:12 PM #66463Wait a minute, I think I made something wrong..
1 user thanked author for this post.
03/26/2018 at 4:18 PM #66464Hmmm, please review my code, I think it should be good now 🙂
12345678910111213141516171819202122232425262728293031a = 5b = 20cl = RSI[2]<acs = RSI[2]>100-aif cl and long=0 thenlong=1short=0entrylong=closeendifif cs and short=0 thenlong=0short=1entryshort=closeendifif long and RSI[2]>100-(a+b) and close < open thenlong=0gain=(close-entrylong)+gain//sell at marketendifif short and RSI[2]<(a+b) thenshort=0gain=(entryshort-close)+gain//exitshort at marketendifscreener[gain](gain)03/26/2018 at 4:34 PM #66465Thank you Nicolas, the code is fine but I am not very confident with screeners. Let me understand, if I select “daily” screening the resultsa are computed on the last 2 years right?
03/26/2018 at 4:54 PM #66471Yes, beginning 254 bars ago from now.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on