But as everyone knows, or should, momentum can be decreasing while at the same time price continues to increase. Momentum can then resume increasing, and of course, price as well so looking at momentum alone is insufficient. Or trend.
Second Concept: Momentum measures the slope of a trend. I would say the slope of price can be measured to identify changes in momentum. Each VIAC leg up has a higher degree trend line which shows the momentum accelerating. increasing.
The code calculates the slope by dividing the fixed $2 increase of a stock that starts out at $100 and outputs the day index, old price, price increase from the previous day, slope from the previous day to the current day, and the current price. So after 1 day, the slope was 2/100, and the current price is 102. After 2 days, the slope is 2/102, and the current price is 104. After 3 days, the slope is 2/104, and the current price is 106. ... The slope is not constant, and each day, the slope gets a little smaller.