Coding a price/volume-based momentum rank
Author: Yuyu
Creation Date: 1/25/2014 9:22 AM
profile picture

Yuyu

#1
I would like to create a technical indicator to do backtest, however, I am still in learner stage and try to be intermediate level on coding. I hope I can get some helps and hints, please

the strategy is kind of momentum strategy that measure a stock for past 7 days

there are four criteria
1. if the price and volume today both are greater than yesterday, the stock get 2 points
2. if the price is greater than yesterday but the volume is lower than yesterday, the stock get 1 points
3.if the price is lower than yesterday but the volume is greater than yesterday, the stock get -2 points
4. if the price and volume today both are lower than yesterday, the stock get -1 points

then, the system will sum up the total point of a stock in past 7 days so that I can know which stock has better performance in past 7 days

Hope the explanation is clear. Please give me some hints.
profile picture

Eugene

#2
Give this a try:

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

Yuyu

#3
Thank you so much.... it is exactly what I am looking for.
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).