Platinum Customer
Joined: 5/5/2010 Posts: 176

Bruce,
Can you assist me in writing a code (Speed = Distance / Time) that can be used with any indicator.
If the indicator is moving up the result should be positive speed, if the indicator is moving down then negative speed. The output should be numerical values.

Worden Trainer
Joined: 10/7/2004 Posts: 57,916

How do you want this to differ from the Rate of Change (Net) of Indicator, Rate of Change (Percent) of Indicator or Linear Regression Slope of Indicator indicators.
Bruce Personal Criteria Formulas TC2000 Support Articles

Platinum Customer
Joined: 5/5/2010 Posts: 176

The issue with above child indicators are the numbers itself, if the indictor pivots then moves up i would prefer the value to be a positive number reather than a negative number that is increasing.

Worden Trainer
Joined: 10/7/2004 Posts: 57,916

If you set the period of the ROC indicators to 1 or the linear regression slope to 2, then they will always be positive when moving up and negative when moving down right after it changes direction.
So if you are only interested in one bar to the next, you should be able to use any one of those three indicators.
However if you want to cover more than one bar, I need to know exactly how you want to calculate "speed" an a way that you would get what you want.
Bruce Personal Criteria Formulas TC2000 Support Articles

Platinum Customer
Joined: 5/5/2010 Posts: 176

Is it possible write the code using this formula for any indicator of choice? (+/)
acceleration = ((final velocity)  (initial velocity)) = (change in velocity)
time time

Worden Trainer
Joined: 10/7/2004 Posts: 57,916

Unless I'm misunderstanding (which I obviously did the first time), you should be able to just apply a Rate of Change (Net) of Indicator, Rate of Change (Percent) of Indicator or Linear Regression Slope of Indicator to your chosen indicator. Then apply a Rate of Change (Net) of Indicator (but not the % version) or Linear Regression Slope of Indicator to the first indicator you used to measure speed or velocity.
Bruce Personal Criteria Formulas TC2000 Support Articles
