hi
How i can i code to get the rate of Moving Average?
You can use the Rate Of Change indicator (ROC):
in this example, the rate of change over the last 10 periods of a 20 periods simple moving average:
a = roc[10](average[20])
return a
can i have the code of ROC?
What is the ‘Price Rate Of Change – ROC’
The price rate of change (ROC) is a technical indicator of momentum that measures the percentage change in price between the current price and the price n periods in the past. It is calculated by using the following formula:
ROC = (Most recent closing price – Closing price n periods ago) / Closing price n periods ago x 100
actually i am looking for slope of moving average. that code is not as what i want as ROC is already delayed than the slope can be seen in the chart. so what should i do?
that code is not as what i want as ROC is already delayed
No delay with just 1 period for ROC:
a = roc[1](average[20])
return a