You are on page 1of 2

Candle Size In Pips

Enhance your trading strategy with precision using this script, designed to measure the range of a candle
from wick to wick in pips. Whether you're implementing a specific pip requirement within a candle for
your strategy, or simply seeking to better understand market dynamics, this tool provides valuable
insights. The script is calculating the amount of pips between the high and the low then compares it to
the minimal size you declared. If the amount of pips is more or equal to minimal size it will show the
label.

Features

Alert Functionality: Opt to receive alerts by checking the checkbox (default: false).
Customizable Pip Threshold: Tailor the script to your needs by setting the minimum required pips to
display on the screen (default: 12).
Different shape: circle, triangle up, triangle down, none

How to Use

Personalize your trading approach by integrating this script with your preferred strategy. For instance, in
my strategy involving a 3M continuation, I leverage this tool to determine the pip count of the M15
candle before making entry decisions.

Note: Ensure you understand your strategy's requirements and adjust the script settings accordingly for
optimal results.

Feel free to reach out if you have any questions or require further assistance in maximizing the utility of
this script.

//@version=5

indicator("Candle size in pips", shorttitle="Candle pips", overlay=true)

// Set the minimal candle size in pips

MINIMAL_SIZE = input.float(12, title="Minimal candle size in pips")

// Calculate the number of pips

PIPS = math.abs(high - low) / syminfo.mintick

// Convert to an integer (floor to handle negative values)


PIPS_INT = high > low ? math.floor(PIPS) : math.ceil(PIPS)

PIPS_INT_FLOAT = PIPS_INT / 10

// Choose the label shape

LABEL_SHAPE = input.string("triangle up", title="Label Shape", options=["none", "circle", "triangle up",


"triangle down"])

ALERT_AUTHORIZED = input.bool(false, title="Get alerts")

// Determine the label position based on the direction of the candle

label_position = close > open ? high + syminfo.mintick * 25 : low - syminfo.mintick * 25

plot(MINIMAL_SIZE)

// Display the number of pips above or below the candle only if it's more than 12

if (barstate.isconfirmed and PIPS_INT_FLOAT >= MINIMAL_SIZE)

label.new(bar_index, label_position, text=str.tostring(PIPS_INT_FLOAT) + " pips", style=LABEL_SHAPE


== "none" ? label.style_none : (LABEL_SHAPE == "circle" ? label.style_circle : (LABEL_SHAPE == "triangle
up" ? label.style_triangleup : label.style_triangledown)), color=color.new(close > open ? color.green :
color.red, 0), textalign=text.align_center, size=size.tiny)

// Trigger alert when the candle closes and its size is more than the minimal size

alertcondition(ALERT_AUTHORIZED and PIPS_INT_FLOAT >= MINIMAL_SIZE and barstate.isconfirmed,


title="Alert on Candle", message="The candle is more or equal than minimal size!")

You might also like