0bps

Strategy vault / Other

Brick count Renko

Brick Indicator

Pine ScriptOther
Author
Zer3192
Complexity
Starter · 36 lines
Parameters
0
Backtest bar
4h · intraday
Tested on
BTC/USDT · futures

Brick Indicator

Source Pine Script

/*backtest
start: 2021-05-08 00:00:00
end: 2022-05-07 23:59:00
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/

//@version=4
study("Renko count", overlay=false) 


counter_green = iff(close > open, 1, 0)
counter_red = iff(close > open, 0, 1)

size = iff(bar_index>39, 40, bar_index+1)
// function to create a rolling sum and return an integer value using series and series objects

pine_sum(x, y) =>
    sum = 0.0
    for i = 0 to y - 1
        sum := sum + x[i]

brick_red = pine_sum(counter_red, size)
brick_green = pine_sum(counter_green, size)
if cross(brick_red, brick_green)
    label.new(bar_index, brick_red, style = label.style_arrowdown, size = size.normal, xloc =xloc.bar_index, color = color.green)

plot(brick_red, color = color.red)
plot(brick_green, color = color.green)
if brick_red
   strategy.entry("buy", strategy.long)
else if brick_green
    strategy.entry("sell", strategy.short)

Published by Zer3192 on the FMZ strategy square · last modified 2022-06-12. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Brick-count-Renko.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open