Indicator · Pine Script v4 · On the chart

ITG Scalper Buy/Sell [Complector]

by theonetrade· code credited to Complector

This indicator overlays a Triple Exponential Moving Average (TEMA) on the price chart and plots alternating buy and sell signals.

View on GitHub

GitHub stars34on the repository
Pine versionv4older, still runs
Lines of code113
Settings12inputs
LicenceMIT
Last update2 weeks ago8 Nov 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

113 lines of Pine Script v4 from assets/indicator/bit-exact/itg_scalper_AcrZjl6Q.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

itg_scalper_AcrZjl6Q.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Complector
//@version=4
////////////////////////////////////////////////////////////////////////////////////////////
// *** ITG Scalper by Complector ***                                                   ***//
// ***                                                                                 ***//
// ***                                                                                 ***//
// *** Thanks to Iain M. Banks for making my life richer :-)                           ***//
////////////////////////////////////////////////////////////////////////////////////////////
//
study(shorttitle="ITG_Scalper", title="ITG Scalper Buy/Sell [Complector]", overlay=true)
//
//General inputs
//
shc = input(true, title="Plot TEMA?")  // Plot Triple EMA
cc = input(true, title="Green/redshift on/off?")  // Trend color change?
showtext = input(true, title="Show buy/sell?")  // Show buy & sell signals?
uselabel = input(true, title="Use labels? (max 50)") // Use labels or plotshape?
showperc = input(false, title="Show % change since last buy/sell")
nfilter = input(true, title="Noise filter on/off?")
useCurrentRes = input(true, title="Use Current Chart Resolution for filter?")
resCustom = input(title="Use Different Timeframe for filter? Uncheck Box Above", type=input.resolution, defval="60")
len = input(14, title="TEMA period")
FfastLength = input(12, minval=1, title="Filter fast length")
FslowLength=input(26,minval=1, title="Filter slow length")
FsignalLength=input(9,minval=1, title="Filter signal length")
//
//Get real close price
t_id = tickerid(syminfo.prefix, syminfo.ticker)
realC = security(t_id, timeframe.period, close)
//
//Set persistent variables (buy price, sell price, last transaction type)
buyprice = 0.0
buyprice := nz(buyprice[1])
sellprice = 0.0
sellprice := nz(sellprice[1])
last_tran = false
last_tran := nz(last_tran[1])
//
//Truncate function used for rounding variables
truncate(number, decimals) =>
    factor = pow(10, decimals)
    int(number * factor) / factor
//
//Triple EMA definition
ema1 = ema(realC, len)
ema2 = ema(ema1, len)
ema3 = ema(ema2, len)
//
//Triple EMA trend calculation
avg = 3 * (ema1 - ema2) + ema3
out = avg
out1 = security(t_id, timeframe.period, out)
ma_up = out1 >= out1[1]
ma_down = out1 < out1[1]
col = cc ? ma_up ? color.lime : ma_down ? color.red : color.lime : color.aqua
t_UP = ma_up
t_DOWN = ma_down
t_NON = t_UP == t_DOWN
//
//Filter formula
Fsource = close
macd_colorChange = true
Fres = useCurrentRes ? timeframe.period : resCustom
FfastMA = ema(Fsource, FfastLength)
FslowMA = ema(Fsource, FslowLength)
Fmacd = FfastMA - FslowMA
Fsignal = sma(Fmacd, FsignalLength)
outMacD = security(syminfo.tickerid, Fres, Fmacd)
outSignal = security(syminfo.tickerid, Fres, Fsignal)
Fbuy = (outMacD >= outSignal) or not nfilter
Fsell = (outMacD < outSignal) or not nfilter
//
//Triple EMA plot
plot(out1, title="TEMA", style=plot.style_line, linewidth=2, color=col, transp=iff(shc, 0, 100))
//
//Entry & exit conditions
long = t_UP and not last_tran and not t_NON and Fbuy and barstate.isconfirmed
short = t_DOWN and last_tran and not t_NON and Fsell and barstate.isconfirmed
//
if long
    buyprice := realC  //Set buyprice
    last_tran := true  //Set long condition
if short
    sellprice := realC  //Set sellprice
    last_tran := false  //Set short condition
//
PercVal = iff(last_tran, 100*(realC - buyprice)/buyprice, 100*(realC - sellprice)/sellprice) //Percent change since last buy/sell
PercCol = iff(PercVal >= 0, color.lime, color.orange) //Color of percent text
//
//Plot percent label
if showperc
    var label percLab = na
    label.delete(percLab)
    percLab := label.new(x=bar_index, y=high, yloc = yloc.abovebar, color=color.black, textcolor=PercCol, style = label.style_none)
    label.set_text(id=percLab, text=tostring(truncate(PercVal,2))+" %")
//
goodlong = long and buyprice <= sellprice // Buying with a profit?
goodshort = short and sellprice > buyprice // Selling with a profit?
txtlight_b = color.lime// Buy signal set to always green.
txtlight_s = iff(goodshort, color.red, color.yellow) // Sell signal change color depending on profitable or not.
buytxt = tostring(truncate(buyprice,8))
selltxt = tostring(truncate(sellprice,8))
alertcondition(long, title='Buy alert', message='Buy alert')
alertcondition(short, title='Sell alert', message='Sell alert')
// Alternative 1: Plot buy/sell signals as labels with price indication. Max 50 labels visible.
if uselabel and long and showtext
    label.new(bar_index, high, buytxt, yloc = yloc.belowbar, color = txtlight_b, textcolor=color.white, style = label.style_triangleup, size=size.small)
if uselabel and short and showtext
    label.new(bar_index, high, selltxt, yloc = yloc.abovebar, color = txtlight_s, textcolor=color.white, style = label.style_triangledown, size=size.small)
// Alternative 2: Plot buy/sell signals as plotshape without price indication. No max.
plotshape(not uselabel and long and showtext, title="Buy alert", color=txtlight_b, transp=0, style=shape.triangleup, size=size.small, location=location.belowbar)
plotshape(not uselabel and short and showtext, title="Sell alert", color=txtlight_s, transp=0, style=shape.triangledown, size=size.small, location=location.abovebar)

Overview

Trend direction is established by the slope of the TEMA, which changes line color dynamically. Signals are filtered using a MACD-based noise filter that can run on the chart's current timeframe or a user-defined higher resolution. Signals trigger only on confirmed bar closes, displaying optional labels or percentage gains since the previous signal. It provides visual cues without executing trades directly.

Details

Published by

theonetrade on GitHub

Code credit

Complector, as written in the script's header

Type

Indicator, Pine Script v4

Draws

On the price chart

Markets

Any symbol

Timeframes

M1-M5, M15-H1

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

algorithmic-tradingbacktestingbitcoinccxtcrypto-tradingllm-agentoffline-backtestingopen-source-tradingpine-scriptpine-to-pythonpinescriptpynecorepythonquantquantitative-financestrategy-backtestingtechnical-analysistrading-indicatorstrading-strategiestradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Plot TEMA?booltrueshc
Green/redshift on/off?booltruecc
Show buy/sell?booltrueshowtext
Use labels? (max 50)booltrueuselabel
Show % change since last buy/sellboolfalseshowperc
Noise filter on/off?booltruenfilter
Use Current Chart Resolution for filter?booltrueuseCurrentRes
Use Different Timeframe for filter? Uncheck Box Abovetimeframe60resCustom
TEMA periodint14len
Filter fast lengthint12FfastLength
Filter slow lengthint26FslowLength
Filter signal lengthint9FsignalLength
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

3 stars

This indicator plots a fast and a slow exponential moving average on the price chart and marks buy and sell signals for Bitcoin scalping. A buy appears when the fast EMA crosses above the slow EMA, RSI is above its buy threshold, the MACD line is above its sig

Indicator v5 TrendOscillators & momentum
Updated 1 year ago · MIT GitHub repository of BTC 1–5 min Scalping Signals
947 stars

The Adaptive RSI Moving Average (ARSIMA) is an overlay indicator that dynamically adjusts its smoothing factor based on the Relative Strength Index (RSI). When the RSI moves toward extreme overbought or oversold conditions, the smoothing factor increases to ma

Indicator v4 Moving averagesOscillators & momentum
Updated 5 weeks ago · GPL-3.0 GitHub repository of Adaptive RSI Moving Average

This indicator scans NSE-listed stocks for momentum signals using Supertrend, multiple EMAs, MACD, and stochastic oscillator. It supports continuous or flip signal modes and displays matching setups in a customizable table at the bottom left of the chart. The

Indicator v5 Oscillators & momentumMoving averages
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup: Vijay Thakare Option Buying Scalping Setup Scanner
228 stars

TradersPost Trading Checklist is an overlay indicator that evaluates a suite of popular technical conditions for long and short trade setups. It checks session-anchored VWAP, fast and slow EMA alignments and crosses, 200 SMA, RSI overbought or oversold conditi

Indicator v6 Screeners & dashboardsTrend
Updated 4 months ago · None stated GitHub repository of TradersPost Trading Checklist

Daily Trend Filter

by agutinbaigo28
147 stars

Calculates market regime conditions by combining RSI, MACD, and ADX/DMI indicators. It evaluates whether the market is in a strong bullish, strong bearish, neutral, or non-trending regime. The script plots a colored line overlaying the close price to reflect t

Indicator v5 TrendOscillators & momentum
Updated 2 months ago · MIT GitHub repository of Daily Trend Filter

AAPP

by capissimo
114 stars

This indicator plots an adaptive moving average or scaled RSI divergence line directly on the price chart. It calculates dual RSI series to measure momentum divergence, scales the values to the chart's price range, and constructs an adaptive average filtered b

Indicator v4 Moving averagesTrend
Updated 2 years ago · None stated GitHub repository of AAPP

More Moving averages scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers