//@version=5 //====================================================== // Adapted SMU Binary Candle indicator // Version 0.1.B // Modded by GreenDragon //====================================================== // Tip jar - any help gratefully accepted // ETH 0x3D07FD9253479f76bC19bfDba594ed76C2F9E973 // BTC 3GDbgSvKiHkAeKuS1CMWASSgmSmK6R6Cgs //====================================================== // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © stockmarketupdate //This script creates a Decimal and Binary representation of the price using ROC. The idea is to simplify the price action into a distance from Zero to upside and downside. //You can see clearly rend develops in the ROC in the decimal view, kind of like AMCD but based on raw price action change. I'm' a big fan of raw price action, so my scripts are super simple. //You can also use this script in a binary mode close higher = 1 and lower is -1. I use the binary mode to remove the phycological pressure of watching the stock going against me. I turn off the actual price and only focus on // Simple up and down movements are counting the number of red and Blue. On a Quntum physics level, when I short, I wish for more reds. // // 2021-10-10 - GD Updated candle colours to red green and removed black candle borders so improves visibility when compressing candles, no longer turns black. // 2021-10-10 - GD Updated to Version 5 Pine Script //====================================================== indicator('GD-SMU BDC Ver 0.1.B', overlay=false) //Choose between binary and decimal _binary = input(defval=false, title='Binary On') //Length of ROC _length = input(defval=15, title='ROC Length') //Scale the movements for better visibility _scale = input(defval=10, title='Scale') //Calculate the price based on ROC _roc_close = ta.roc(close, _length) * _scale _roc_high = ta.roc(high, _length) * _scale _roc_low = ta.roc(low, _length) * _scale //Assign values. Open is set to xero because it is an interference and dont need to track it _high = _roc_high _open = 0 _close = _roc_close _low = _roc_low //Option for binary _bin = -1 if _close > 0 _bin := 1 if _binary == true _high := 0 _open := 0 _close := _bin _low := 0 //Set Colours and Plot Candles drawcolor = _roc_close > 0 ? color.green : color.red plotcandle(_open, _high, _low, _close, color=drawcolor, wickcolor=drawcolor,bordercolor=drawcolor)