Screen: price is 20% within 52-week high
Author: asurapan
Creation Date: 6/20/2012 2:27 AM
profile picture

asurapan

#1
I'm hacking away at something and the code below works the way I want it to. but i am trying to make 3 enhancements which i am having trouble with. I beleive it is as simple as just 3 IF statements, but I just cannot get it to work.

Rather than printing values for each security in the dataset like the code beleow does, I'd like to only print securities to the debug window that meet the criteria of being within 20% of the 52 week high and within 20% of the 52 week relative strength high.

Essentially:
1) IF price within 20% of 52 week price high
2) IF relative strength ratio within 20% of 52 week relative strength high
3) only print to debug window IF both of the above criteria are true

CODE:
Please log in to see this code.
profile picture

Eugene

#2
Here you go.

Note: run this script by clicking on a single symbol only. Do not run as a portfolio backtest as the code loops by DataSetSymbols.

CODE:
Please log in to see this code.
profile picture

asurapan

#3
thanks Eugene for the quick response and the efficient code
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).