Strategy · Pine Script v6 · On the chart

PF kanuck-probe-02-calc-on-every-tick

by pineforge-4pass· code credited to PineForge contributors 2026

This Pine Script strategy overlays two exponential moving averages on the price chart.

View on GitHub

Repaints

GitHub stars1on the repository
Pine versionv6current
Lines of code55
Settings3inputs
LicenceApache-2.0
Last update5 days ago23 Oct 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 strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

55 lines of Pine Script v6 from validation/composite-kanuck-calc-on-every-tick-01/strategy.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

strategy.pine
// This Pine Script® code is licensed under Apache-2.0
// SPDX-License-Identifier: Apache-2.0
// © PineForge contributors 2026
//
// PF probe kanuck-probe-02-calc-on-every-tick — calc_on_every_tick semantics
// Clean-room: written from validation goal, not from source.
//
// Purpose: isolates `calc_on_every_tick=true` evaluation. The engine surface
// under test is the per-tick re-evaluation pass: a `var int` counter
// incremented every script run, plus a modulo-based entry trigger. On
// historical (replay) data both engine and TV evaluate once per bar; under
// `calc_on_every_tick` semantics the engine should still produce a trade
// list that matches TV's broker-emulator output for historical bars.
//
// Validation goal: bit-exact entries when `tick_counter % step == 0` after
// a momentum trigger fires. Note: engine vs TV may legitimately diverge on
// intra-bar order if `calc_on_every_tick` semantics differ on real-time
// bars; the historical replay used by the corpus should still match.
//
// TV setup: 15m chart, ETH-USDT-USDT (Binance USDT-M Perpetual). Full window
// matching corpus/data/ohlcv_ETH-USDT-USDT_15m.csv. Strategy properties:
// leave defaults from script header. Export "List of trades" → tv_trades.csv.
//@version=6
strategy("PF probe kanuck-probe-02-calc-on-every-tick", shorttitle="PF_kan02_TICK",
     overlay=true, initial_capital=1000000,
     commission_type=strategy.commission.percent, commission_value=0,
     slippage=0, default_qty_type=strategy.fixed, default_qty_value=1,
     pyramiding=1, process_orders_on_close=false,
     calc_on_every_tick=true)

// ---- inputs --------------------------------------------------------
int i_step    = input.int(3,  "Tick-counter modulo step", minval=1)
int i_fast    = input.int(8,  "EMA fast length",          minval=2)
int i_slow    = input.int(21, "EMA slow length",          minval=3)

// ---- per-evaluation tick counter ----------------------------------
var int tick_counter = 0
tick_counter += 1

// ---- momentum trigger ---------------------------------------------
float fast = ta.ema(close, i_fast)
float slow = ta.ema(close, i_slow)

bool cross_up   = ta.crossover(fast, slow)
bool cross_down = ta.crossunder(fast, slow)

// ---- modulo gate on the counter -----------------------------------
bool gate = (tick_counter % i_step) == 0

// ---- order routing -------------------------------------------------
if cross_up and gate and strategy.position_size <= 0
    strategy.entry("L", strategy.long, qty=1, comment="tick gated long")

if cross_down and gate and strategy.position_size >= 0
    strategy.entry("S", strategy.short, qty=1, comment="tick gated short")

Overview

PF kanuck-probe-02-calc-on-every-tick generates buy signals when the fast EMA crosses above the slow EMA and the tick counter is divisible by the step value. It generates sell signals on the opposite cross under condition. The tick counter increments on every script evaluation. Inputs adjust the modulo step, fast EMA length, and slow EMA length. The strategy uses fixed position size of one and contains no stop loss or target levels. Because of calc_on_every_tick=true, signals can repaint on the live bar.

Details

Published by

pineforge-4pass on GitHub

Code credit

PineForge contributors 2026, as written in the script's header

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Oscillators & momentum, Moving averages

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)
  • The strategy enters trades without a stop loss

Topics

algorithmic-tradingbacktestingparitypine-scriptpinescriptquantitative-financetest-corpustradingview

Settings

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

SettingTypeDefaultVariable
Tick-counter modulo stepint3i_step
EMA fast lengthint8i_fast
EMA slow lengthint21i_slow
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

330 stars

2 EMA/SMA + RSI Strategy [Alorse] combines three configurable moving averages with a short-period Relative Strength Index filter. It plots fast, slow, and trend moving averages on the price chart. Long entries trigger when the fast moving average is above the

Strategy v4 TrendOscillators & momentum
Updated 2 months ago · None stated GitHub repository of 2 EMA/SMA + RSI Strategy [Alorse]

Acrypto - Weighted Strategy

by AlbertoCuadra
318 stars

This strategy plots on the price chart and opens long or short positions when a weighted score from MACD, Stochastic RSI, RSI, Supertrend and a moving-average crossover exceeds a user-set trigger. Each component has its own weight and candle delay. Entries can

Strategy v5 TrendOscillators & momentum
Updated 3 years ago · Custom licence GitHub repository of Acrypto - Weighted Strategy

This strategy combines Arnaud Legoux Moving Average percentage price change calculations with an adaptive Gaussian Moving Average to generate trend-following signals. Long and short entries are triggered when the ALMA change calculation crosses above or below

Strategy v5 Moving averagesOscillators & momentum
Updated 6 weeks ago · None stated GitHub repository of ESM2024 - ALMA Smoothed Gaussian Moving Average

MACD Strategy

by TradersPost
218 stars

This overlay strategy is built around MACD inputs for a fast average, a slow average, and a signal line. Comments say the script keeps MACD values available and can draw a histogram and zero line in a separate pane, with an optional overlay on price. Settings

Strategy v6 Oscillators & momentumMoving averages
Updated 3 months ago · None stated GitHub repository of MACD Strategy

255 EMA Strategy

by hasnocool
106 stars

255 EMA Strategy combines an exponential moving average with Average True Range bands and standard MACD crossovers to generate entry signals. Drawn directly on the price chart, it plots the central 255 EMA along with upper and lower volatility envelopes. Trade

Strategy v4 Moving averagesOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of 255 EMA Strategy
104 stars

This overlay strategy combines a machine-learning distance model with a MACD oscillator to open trades on the price chart. It compares recent history using cosine similarity or Euclidean and Lorentzian distance, then filters direction with selectable moving-av

Strategy v5 AI / machine learningOscillators & momentum
Updated 3 years ago · MIT GitHub repository of MLCEL and MACD Strategy

More strategys

Trade Your Charts With a Regulated Broker

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

Compare brokers