Indicator · Pine Script v5 · On the chart

Scalping Money Management

by stupenkov· code credited to stupean

This TradingView indicator provides scalping money management tools by displaying a customizable panel on the chart.

View on GitHub

GitHub stars4on the repository
Pine versionv5runs as is
Lines of code179
Settings37inputs
LicenceMIT
Last update3 years ago30 Sep 2023

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

179 lines of Pine Script v5 from scalping-money-management.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

scalping-money-management.pine
// Author: Anton Stupenkov
// Email: stupean@gmail.com
// Screener: https://t.me/LazyScalp
// ©stupean

//@version=5
indicator("Scalping money management 1.0.0", overlay = true)

// risk management
var string riskManagementGroup = "risk management" 
float deposit = input.float(defval = 1000, title = "Deposit", group = riskManagementGroup)
float lossPerTrade = input.float(defval = 1, title = "Maximum risk per trade, %", group = riskManagementGroup)
float commission = input.float(defval= 0.1, title = "Commission and other, %", tooltip = "Add to stoploss", group = riskManagementGroup)

// panel
var string infoPanelSettingsGroup = "info panel settings"
string position = input.string(defval = position.bottom_right, options = [position.bottom_right, position.bottom_center, position.bottom_left, position.top_right, position.top_center, position.top_left], group = infoPanelSettingsGroup)
color tableBgColor = input.color(defval = color.new(#363636, 50) , title = "Background color", group = infoPanelSettingsGroup)
color tableTextColor = input.color(defval = color.white, title = "Text color", group = infoPanelSettingsGroup)
bool showTableTitle = input.bool(defval = true, title = "Show titles", group = infoPanelSettingsGroup)
bool showPips = input.bool(defval = true, title = "Show stop loss in pips", group = infoPanelSettingsGroup)

// ATR SL
bool showAtrSL = input.bool(defval = true, title = "Show ATR stop loss", group = "Stop loss by ATR")
string timeframeSL = input.timeframe(defval = "1", title = "ATR timeframe", group = "Stop loss by ATR")
int lengthSL = input.int(defval = 200, title = "Stop less length", group = "Stop loss by ATR")
color colorAtrSL = input.color(defval = color.yellow, title = "ATR stop loss color", group = "Stop loss by ATR")

bool showStopLoss1 = input.bool(defval = true, title = "", group = "Stoploss", inline = "l1")
float stopLoss1 = input.float(defval = 0.1, title = "Stop loss, %", group = "Stoploss", inline = "l1")

bool showStopLoss2 = input.bool(defval = true, title = "", group = "Stoploss", inline = "l2")
float stopLoss2 = input.float(defval = 0.2, title = "Stop loss, %", group = "Stoploss", inline = "l2")

bool showStopLoss3 = input.bool(defval = true, title = "", group = "Stoploss", inline = "l3")
float stopLoss3 = input.float(defval = 0.3, title = "Stop loss, %", group = "Stoploss", inline = "l3")

bool showStopLoss4 = input.bool(defval = true, title = "", group = "Stoploss", inline = "l4")
float stopLoss4 = input.float(defval = 0.4, title = "Stop loss, %", group = "Stoploss", inline = "l4")

bool showStopLoss5 = input.bool(defval = true, title = "", group = "Stoploss", inline = "l5")
float stopLoss5 = input.float(defval = 0.5, title = "Stop loss, %", group = "Stoploss", inline = "l5")

bool showStopLoss6 = input.bool(defval = true, title = "", group = "Stoploss", inline = "l6")
float stopLoss6 = input.float(defval = 0.6, title = "Stop loss, %", group = "Stoploss", inline = "l6")

bool showStopLoss7 = input.bool(defval = true, title = "", group = "Stoploss", inline = "l7")
float stopLoss7 = input.float(defval = 0.7, title = "Stop loss, %", group = "Stoploss", inline = "l7")

bool showStopLoss8 = input.bool(defval = true, title = "", group = "Stoploss", inline = "l8")
float stopLoss8 = input.float(defval = 0.8, title = "Stop loss, %", group = "Stoploss", inline = "l8")

bool showStopLoss9 = input.bool(defval = true, title = "", group = "Stoploss", inline = "l9")
float stopLoss9 = input.float(defval = 0.9, title = "Stop loss, %", group = "Stoploss", inline = "l9")

bool showStopLoss10 = input.bool(defval = true, title = "", group = "Stoploss", inline = "l10")
float stopLoss10 = input.float(defval = 1, title = "Stop loss, %", group = "Stoploss", inline = "l10")

// Money to lots
var string volumeToLotsGroup = "Money to lots"
bool showMoneyLevel1 = input.bool(defval = true, title = "", group = volumeToLotsGroup, inline = "moneyLevel1")
int moneyLevel1 = input.int(defval = 100000, title = "Volume in money 1", group = volumeToLotsGroup, inline = "moneyLevel1")

bool showMoneyLevel2 = input.bool(defval = true, title = "", group = volumeToLotsGroup, inline = "moneyLevel2")
int moneyLevel2 = input.int(defval = 500000, title = "Volume in money 2", group = volumeToLotsGroup, inline = "moneyLevel2")

string moneyToLotsPanelPosition = input.string(
  title = "Panel position",
  defval = position.bottom_center,
  options = [position.bottom_right, position.bottom_center, position.bottom_left, position.middle_right, position.middle_center, position.middle_left, position.top_right, position.top_center, position.top_left], 
  group = volumeToLotsGroup)

type modelType
    float sl
    float money
    int pips
    color textColor
    bool isShow

createModel(float stopLoss, bool isShow, color textColor = na) =>
    modelType.new(
      sl = stopLoss,
      money = (deposit * lossPerTrade) / (stopLoss + commission),
      pips = math.round(stopLoss / 100 * close / syminfo.mintick),
      isShow = isShow,
      textColor = na(textColor) ? tableTextColor : textColor)

float atrSL = (request.security(syminfo.ticker, timeframeSL, ta.atr(lengthSL)) / close) * 100

array<modelType> models = array.new<modelType>()
models.push(createModel(atrSL, showAtrSL, colorAtrSL))
models.push(createModel(stopLoss1, showStopLoss1))
models.push(createModel(stopLoss2, showStopLoss2))
models.push(createModel(stopLoss3, showStopLoss3))
models.push(createModel(stopLoss4, showStopLoss4))
models.push(createModel(stopLoss5, showStopLoss5))
models.push(createModel(stopLoss6, showStopLoss6))
models.push(createModel(stopLoss7, showStopLoss7))
models.push(createModel(stopLoss8, showStopLoss8))
models.push(createModel(stopLoss9, showStopLoss9))
models.push(createModel(stopLoss10, showStopLoss10))

var table indicatorPanel = table.new(
  position = position,
  columns = 3,
  rows = 15)

//#region Stoploss size
if barstate.islast
    if showTableTitle
        table.cell(table_id = indicatorPanel, column = 0, row = 0, text = "SL", bgcolor = tableBgColor, text_color = tableTextColor, tooltip = "Stop loss in %")
        if showPips
            table.cell(table_id = indicatorPanel, column = 1, row = 0, text = "Pips", bgcolor = tableBgColor, text_color = tableTextColor, tooltip = "Stop loss in pips")
        table.cell(table_id = indicatorPanel, column = 2, row = 0, text = "Money", bgcolor = tableBgColor, text_color = tableTextColor, tooltip = "money")

    for i = 0 to models.size() - 1
        modelType model = models.get(i)
        if not model.isShow
            continue
        table.cell(
          table_id = indicatorPanel, 
          column = 0, 
          row = i + 1, 
          text = str.tostring(math.round(model.sl, 2)) + "%", 
          bgcolor = tableBgColor, 
          text_color = model.textColor, 
          tooltip = "Stop loss")        
        if showPips
            table.cell(
              table_id = indicatorPanel, 
              column = 1,
              row = i + 1, 
              text = str.tostring(model.pips),
              bgcolor = tableBgColor,
              text_color = model.textColor, 
              tooltip = "pips")        
        table.cell(
          table_id = indicatorPanel, 
          column = 2, 
          row = i + 1, 
          text = "💵" + str.tostring(math.round(model.money)), 
          bgcolor = tableBgColor, 
          text_color = model.textColor, 
          tooltip = "money", 
          text_halign = text.align_left)
//#endregion

//#region Money to lots
moneyToLots(int money) =>
  money / close

var table moneyToLotsPanel = table.new(
  position = moneyToLotsPanelPosition,
  columns = 3,
  rows = 15)

if barstate.islast
    if showMoneyLevel1
        int lotsLevel1 = math.round(moneyToLots(moneyLevel1))
        table.cell(
          table_id = moneyToLotsPanel,
          column = 0, 
          row = 0, 
          text = str.format("💵{0,number} = {1,number} Lots", moneyLevel1, lotsLevel1), 
          bgcolor = tableBgColor, 
          text_color = tableTextColor, 
          tooltip = "")
    if showMoneyLevel2
        int lotsLevel2 = math.round(moneyToLots(moneyLevel2))
        table.cell(
          table_id = moneyToLotsPanel,
          column = 0, 
          row = 1, 
          text = str.format("💵{0,number} = {1,number} Lots", moneyLevel2, lotsLevel2), 
          bgcolor = tableBgColor, 
          text_color = tableTextColor, 
          tooltip = "")

//#endregion

Overview

Scalping Money Management shows risk management details such as deposit size, maximum risk per trade as a percentage, and commission adjustments. The indicator plots multiple fixed stop loss percentages ranging from 0.1% to 0.9% and optionally draws an ATR-based stop loss line calculated over a user-defined period and timeframe. Settings control panel position, background and text colors, visibility of pips and titles, and individual stop loss levels. The tool calculates position sizing and stop loss distances to help manage risk during short-term trades but offers no automatic entry or exit signals.

Details

Published by

stupenkov on GitHub

Code credit

stupean, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Scalping, Screeners & dashboards, Volatility & bands, Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

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

pinescriptpinescript-indicatorstradingview

Settings

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

SettingTypeDefaultVariable
Depositfloat1000deposit
Maximum risk per trade, %float1lossPerTrade
Commission and other, %float0.1commission
positionstringposition.bottom_rightposition
Background colorcolorcolor.new(#363636, 50)tableBgColor
Text colorcolorcolor.whitetableTextColor
Show titlesbooltrueshowTableTitle
Show stop loss in pipsbooltrueshowPips
Show ATR stop lossbooltrueshowAtrSL
ATR timeframetimeframe1timeframeSL
Stop less lengthint200lengthSL
ATR stop loss colorcolorcolor.yellowcolorAtrSL
Show all 37 settings
SettingTypeDefaultVariable
showStopLoss1booltrueshowStopLoss1
Stop loss, %float0.1stopLoss1
showStopLoss2booltrueshowStopLoss2
Stop loss, %float0.2stopLoss2
showStopLoss3booltrueshowStopLoss3
Stop loss, %float0.3stopLoss3
showStopLoss4booltrueshowStopLoss4
Stop loss, %float0.4stopLoss4
showStopLoss5booltrueshowStopLoss5
Stop loss, %float0.5stopLoss5
showStopLoss6booltrueshowStopLoss6
Stop loss, %float0.6stopLoss6
showStopLoss7booltrueshowStopLoss7
Stop loss, %float0.7stopLoss7
showStopLoss8booltrueshowStopLoss8
Stop loss, %float0.8stopLoss8
showStopLoss9booltrueshowStopLoss9
Stop loss, %float0.9stopLoss9
showStopLoss10booltrueshowStopLoss10
Stop loss, %float1stopLoss10
showMoneyLevel1booltrueshowMoneyLevel1
Volume in money 1int100000moneyLevel1
showMoneyLevel2booltrueshowMoneyLevel2
Volume in money 2int500000moneyLevel2
Panel positionstringposition.bottom_centermoneyToLotsPanelPosition
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

218 stars

This indicator maps market structure and supply and demand zones on the price chart. It marks validated and optional unvalidated swing highs and lows using a pivot length and extra confirmation bars. Consolidation and impulse moves are measured against ATR to

Indicator v6 SMC / ICT / price actionSupport & resistance Repaints
Updated 3 months ago · None stated GitHub repository of Market Structure + Supply/Demand
56 stars

This indicator marks forex trading sessions and opening ranges on the price chart. It can draw Sydney, Tokyo, Frankfurt, London, and New York session boxes or five- and fifteen-minute opening ranges, plus an optional opening channel and a day-open range. Day r

Indicator v5 Sessions & timeSupport & resistance Repaints
Updated 2 months ago · None stated GitHub repository of Day Trading Booster by DGT

ADR levels

by TamaraKGreen
46 stars

This indicator plots average daily range levels on the price chart, together with optional standard-deviation and Fibonacci levels scaled from that range. Users set the lookback in days, a scale factor, and the visibility, color, and line style of the ADR line

Indicator v5 Support & resistanceVolatility & bands
Updated 7 weeks ago · None stated GitHub repository of ADR levels
41 stars

ATR Matrix calculates Average True Range and a 50-period Simple Moving Average to display multi-tier volatility levels and risk-reward metrics. It project stop levels using negative ATR multiples from an entry price, alongside target levels from 0x to 11x ATR

Indicator v5 Volatility & bandsSupport & resistance

Zen Trading Toolkit

by Zen-Tim
29 stars

This indicator plots average bar range (ABR) measured move targets, opening range boxes, and historical key reference levels directly on the price chart. It projects bullish and bearish targets (0.5x, 1.0x, 1.5x, 2.0x ABR) from the previous session's close, al

Indicator v6 Support & resistanceVolatility & bands
Updated 2 weeks ago · MIT GitHub repository of Zen Trading Toolkit
20 stars

This indicator calculates a base moving average (EMA, SMA, WMA, or HMA) and projects multiple symmetrical envelope bands around it directly on the price chart. Users can adjust the length, source, moving average type, and initial envelope multiplier. Additiona

Indicator v5 Moving averagesVolatility & bands
Updated 1 year ago · None stated GitHub repository of Multiple Moving Average Envelope

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers