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.
Size:
Color:
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.
Size:
Color:
thanks Eugene for the quick response and the efficient code
Size:
Color: