Untitled
"TASC 2024.03 Rate of Directional Change" by PineCodersTASC, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: TASC 2024.03 Rate of Directional Change (v1.0), read 2026-10-12T15:52:11.709Z; source language v5.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
TASC 2024.03 Rate of Directional Change by PineCodersTASC, ported from Pine v5. Pane indicator with 1 plot and 3 inputs.
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © PineCodersTASC
// TASC Issue: March 2024 - Vol. 42, Issue 3
// Article: Taming The Effects Of Whipsaw.
// Improve Trading Performance With
// A Whipsaw Filter.
// Article By: Richard Poster
// Language: Pine-compatible v5
// Provided By: PineCoders, for tradingview.com
// ------------------------------------------------------------------------------------------------
// Original author: PineCodersTASC
// Original title: TASC 2024.03 Rate of Directional Change
// Licence: MPL-2.0 (the header above is the original notice, kept verbatim)
// Pine version: 5
// Fetched: 2026-10-12
// Ported to FloScript by FloSignals; modifications under MPL-2.0.
// Converter: @flosignals/floscript 0.1.0, strict mode, score 100/100
// ------------------------------------------------------------------------------------------------
//@floscript=1
//@version=5
string title = "TASC 2024.03 Rate of Directional Change"
string stitle = "RODC"
indicator(title, stitle, false)
// --- Global variables ---
int DIGITS = syminfo.pricescale
float MULT = 1.0
float _point = syminfo.mintick
float lamUp = 1.0
float lamDn = 1.0
// --- Inputs ---
int bkData = input.int(30, "Window")
float lamda = input.float(15.0, "Zigzag Threshold")
int perSmth = input.int(3, "Smooth Period")
// --- Indicator initialization for forex pairs ---
if DIGITS == 100000 or DIGITS == 1000
MULT := 10.0
lamUp := lamda
lamDn := lamda
// --- Main loop ---
// Initialize for each bar, assuming mode up
bool modeUp = true
int nUp = 1 // up mode counter
int nDn = 0 // down mode counter
int nUD = 1 // node counter for new mode
// Iterate over bars within lookback window
int limit = bkData + perSmth + 1
if bar_index > limit
float xext = close[bkData]
for jj = bkData - 1 to 0
float xcls = close[jj]
if not modeUp
if xext > xcls
// still mode down
xext := xcls
else if (xcls - xext) / (MULT * _point) >= lamDn
// reversal to mode up
modeUp := true
nUp += 1
nUD += 1
xext := xcls
else if xext < xcls
// still mode up
xext := xcls
else if (xcls - xext) / (MULT * _point) <= -lamUp
// reversal to mode down
modeUp := false
nDn += 1
nUD += 1
xext := xcls
//@variable The RODC indicator value.
float RODC = nUD == 0 ? 100.0 / bkData : 100.0 * (nUD / bkData)
//@variable The smoothed RODC value.
float smaRODC = ta.sma(RODC, perSmth)
// --- Plotting ---
plot(smaRODC, 'RODC Smoothed', color.blue, 2)
This file is under the Mozilla Public License 2.0; it is a port of the original by PineCodersTASC, with the original licence header kept and the changes made for FloScript noted in the file.
- v2
Library refresh 2026-10-14
- v1
Library refresh 2026-10-12
Disclaimer. Scripts are written and published by members, or ported by FloSignals from open-source originals, and are their authors' own work and opinion. FloSignals does not review them for correctness and nothing in a script is financial advice or a recommendation to buy or sell anything — read the Risk Disclaimer. Posting here is under the Community Rules; a script that is not the poster's to post can be reported as the Copyright & Takedowns page says.

Comments (0)
No comments yet. Members can leave one.