Updated version can be found: https://usethinkscript.com/threads/price-rate-of-change-roc-for-thinkorswim.8549/#post-102522
The Rate Of Change (ROC) is an oscillator calculating the percentage change of the security price relative to the price of a specified number (length) of periods before. The higher/lower the ROC, the more overbought/oversold the security; when the ROC falls, a rally might occur.
When I am in a price action trade or scalping I tend to watch the Time and Sales or Level2 price to get the most entry/exit of the position. That took too much brain energy to watch like I am in a Twilight Zone. So, I've come up with a simple ROC lower indicator to help me see the average of the last period prices if the price is increasing/decreasing and direction. This beats watching the Time and Sales or Level2. It works well on trending and momentum with price action securities. It works for me and would like to share it with you all. Let me know if ROC works and helps you too. Good luck! @cabe1332.
The Rate Of Change (ROC) is an oscillator calculating the percentage change of the security price relative to the price of a specified number (length) of periods before. The higher/lower the ROC, the more overbought/oversold the security; when the ROC falls, a rally might occur.
When I am in a price action trade or scalping I tend to watch the Time and Sales or Level2 price to get the most entry/exit of the position. That took too much brain energy to watch like I am in a Twilight Zone. So, I've come up with a simple ROC lower indicator to help me see the average of the last period prices if the price is increasing/decreasing and direction. This beats watching the Time and Sales or Level2. It works well on trending and momentum with price action securities. It works for me and would like to share it with you all. Let me know if ROC works and helps you too. Good luck! @cabe1332.
Ruby:
# Price Rate of Change
# cabe1332 10/20/2021
# The Rate Of Change (ROC) is an oscillator calculating the percentage change of the security price relative to the price of a specified number (length) of periods before. The higher the ROC, the more overbought the security; when the ROC falls, a rally might occur.
# code start
declare lower;
input length = 7;
input colorNormLength = 7;
input price = close;
input buy_threshold = 2;
assert(length > 0, "'length' must be positive: " + length);
plot ROC = if price[length] != 0 then (price / price[length] - 1) * 100 else 0;
ROC.DefineColor("Highest", Color.green);
ROC.DefineColor("Lowest", Color.red);
ROC.AssignNormGradientColor(colorNormLength, ROC.color("Lowest"), ROC.color("Highest"));
ROC.SetLineWeight(2);
plot zeroline = if !isnan(close) then 0 else double.nan;
zeroline.assignValueColor(if Roc > 0 then Color.green else color.light_red);
zeroline.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
zeroline.SetLineWeight(1);
AddLabel(yes, if roc > roc[1] then "Price ROC Increasing " + round(roc,2) else "Price ROC Status Decreasing " + round(roc,2), if roc > roc[1] then color.green else color.red);
AddLabel(yes, if roc > buy_threshold then "Trending UP: BUY or Take Profits if needed! " else if roc between 0 and buy_threshold then "Wait and Watch!" else if roc < roc[1] and roc < 0 then "Trending DOWN! Wait for the rally!" else if roc > roc[1] and roc < 0 then "Trending DOWN! Wait for the rally !" else " ", if roc > 0 and roc > buy_threshold then color.green else color.red);
# end code
Last edited by a moderator: