Hi All,
I’m hoping to get some help in coding a screener for a basic strategy:
- Find a stock/ currency pair that has reached a new 40 day high
- The next three days should have lower closing prices i.e day 1 close lower than 40 day high; day two close lower than day 1 close etc
- On the fourth day the closing price must close higher than the closing price on the third day and must close within the upper 20% of the daily trading range
This is a “long” strategy. “Short” would just be reversed.
I’m happy fro this to be shared in the community if it proves valuable
Thanks for any help.
-N
Hi Niall,
This is a first attempt, not sure if it suits correctly your query, please make tests and give feedback. Many thanks.
//Find a stock/ currency pair that has reached a new 40 day high
c1 = high[4]=highest[40](high)[4]
//The next three days should have lower closing prices i.e day 1 close lower than 40 day high; day two close lower than day 1 close etc
c2 = summation[3](close<close[1])[1]=3
//On the fourth day the closing price must close higher than the closing price on the third day and must close within the upper 20% of the daily trading range
c3 = close>close[1] and (close-low)/range>0.8
screener [c1 and c2 and c3]
Hi Nicholas,
Thank you very much for this. I’ve run it through a variety of exchanges that ProReal Time Offer and found some ideal candidates. I’ll tweak a bit of the code and see if I can get a screen for shorts too.
best wishes,
Niall
ooh ok. Please share your code here for the benefit of everyone and to complete the topic with a “global” screener code (long/short).
Hi All,
Been busy with my day job so apologies if this is a bit late. This is what I’ve got for shorts:
//Find a stock/ currency pair that has reached a new 40 day low
c1 = low[4]=lowest[40](low)[4]
//The next three days should have higher closing prices i.e day 1 close higher than 40 day low; day two close higher than day 1 close etc
c2 = summation[3](close>close[1])[1]=3
//On the fourth day the closing price must close lower than the closing price on the third day and must close within the upper 20% of the daily trading range
c3 = close<close[1] and (close–low)/range>0.8
screener [c1 and c2 and c3]
Rules:
Short
Place an entry 0.03 pips/ ticks below the lowest price traded on day four, the day the instrument turned back around and traded to the downside. Place a stop loss 0.03 cents above the highest high reached on the third day, two days before your entry, the pivot high point.
Long
Place an entry 0.03 pips/ ticks above the highest price traded on day four, the day the instrument traded to the upside. Place a stop loss 0.03 cents below the lowest low reached on the third day, two days before your entry, the pivot low point.
Hope that’s of use.
Niall01