Untitled
"TASC 2023.05 Cong Adaptive Moving Average" by PineCodersTASC, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: TASC 2023.05 Cong Adaptive Moving Average (v1.0), read 2026-11-15T18:32:37.205Z; 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 2023.05 Cong Adaptive Moving Average by PineCodersTASC, ported from Pine v5. Overlay indicator with 1 plot and 1 input.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// (Notice added by FloSignals: the author's source carries none. It was published open-source on 2023-04-14; since 2019-07-26 the platform it was published on has released such a script under MPL-2.0 automatically.)
// TASC Issue: May 2023 - Vol. 41, Issue 6
// Article: Result Vs. Effort
// An Adaptive Moving Average For Swing Trading.
// Article By: Scott Cong
// Language: Pine-compatible v5
// Provided By: PineCoders, for tradingview.com
// ------------------------------------------------------------------------------------------------
// Original author: PineCodersTASC
// Original title: TASC 2023.05 Cong Adaptive Moving Average
// Licence: MPL-2.0 (the notice above was added by FloSignals; the original carries none)
// Pine version: 5
// Fetched: 2026-11-15
// 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 2023.05 Cong Adaptive Moving Average'
string stitle = 'AMA'
indicator(title, stitle, true)
// @function Wilder's True Range
// @param sClose float . Source data, default=`close`.
// @param sHigh float . Source data, default=`high`.
// @param sLow float . Source data, default=`low`.
wTR(float sClose = close, float sHigh = high, float sLow = low) =>
if barstate.isfirst
sHigh - sLow
else
math.max(sHigh - sLow, sHigh - sClose[1], -sLow + sClose[1])
// @function Cong Adaptive Moving Average (CAMA)
// @param length int . Lookback period.
// @param sClose float . Source data, default=`close`.
// @param sHigh float . Source data, default=`high`.
// @param sLow float . Source data, default=`low`.
// @returns float. Smoothed series data.
maCongAdaptive(int length = 10, float sClose = close, float sHigh = high, float sLow = low) =>
float result_cama = sClose
float hh = ta.highest(sHigh, length)
float ll = ta.lowest(sLow, length)
float wTR = wTR(sClose, sHigh, sLow)
float effort = math.sum(wTR, length)
float result = hh - ll
float alpha = result / effort
if bar_index > length
float d = (1.0 - alpha) * result_cama[1]
result_cama := alpha * sClose + d
result_cama
int lookback = input.int(10, 'Lookback period', 1)
float cama = maCongAdaptive(lookback)
plot(cama, 'AMA', #4997fc, 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.
- v1
Library refresh 2026-11-15
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.