Perfected FlowScript
flexible volume
Flexible Volume Profile is indexed as 352_flexible_volume.flowscript. The exact FlowScript is viewable here; chart observe and trading automation use the current mmflow chart/recipe signal proxy until FlowScript v2 transpilation is available.
This exact FlowScript uses the v2 source dialect. It is viewable and connected to the chart/automation proxy, but direct editor execution needs the FlowScript v2 transpiler.
Dialect
flowscript-v2
Compatibility
flowscript-v2-needs-transpile
Position
onchart
Axis
false
Size
2.5 KB
Lines
85
Native Signal Candidates
1 source-level chart marker triggers extracted from guarded FlowScript v2 blocks.
Point of Control
line 33:5
Trigger
(showPoc)
Value
pocPrice
Deps
showPoc:input
352_flexible_volume.flowscript
source path: kscripts/perfected/352_flexible_volume.flowscript · sha256:ae2323a9d1a2deda13e8e995eb9cc547fd07beea43dc8b93ae5abcc8218e9bdd
//@version=2
// Source: kiyotaka.ai/hub/kscript (original)
// Original title: flexible volume
define(title="Flexible Volume Profile", position="onchart", axis=false)
// === USER INPUTS ===
var showVolumeProfile = input(name="showVolumeProfile", type="boolean", defaultValue=true, label="Show Volume Profile")
var showPoc = input(name="showPoc", type="boolean", defaultValue=true, label="Show Point of Control")
var pocColor = input(name="pocColor", type="color", defaultValue="#ffffff", label="POC Color")
var pocWidth = input(name="pocWidth", type="number", defaultValue=2, label="POC Width")
var showVolumeStats = input(name="showVolumeStats", type="boolean", defaultValue=true, label="Show Volume Statistics")
// === DATA SOURCES ===
timeseries vp = volume_profile(symbol=currentSymbol, exchange=currentExchange)
// === GUARD & STATE ===
if (isnan(vp[0])) {
return
}
static barCount = 0
static lastBarIndex = 0
if (!isnan(bar_index[0]) && bar_index[0] != lastBarIndex) {
lastBarIndex = bar_index[0]
barCount = barCount + 1
}
// === PLOTTING ===
// Draw Point of Control
if (showPoc) {
var pocPrice = vpPoc(vp)
plotShape(
value=pocPrice,
shape="triangleup",
colorIndex=pocColor,
width=pocWidth,
label=["Point of Control"],
desc=["Point of control marker"]
)
}
// Show volume statistics
if (showVolumeStats) {
var pocVol = vpPocVolume(vp)
var buyVol = vpBuy(vp)
var sellVol = vpSell(vp)
var netVol = vpDelta(vp)
// Plot volume statistics
plotLine(
value=[pocVol, buyVol, sellVol, netVol],
colors=["#ffffff", "#26a69a", "#ef5350", "#ff9800"],
label=["POC Volume", "Buy Volume", "Sell Volume", "Net Volume"],
desc=["Point of Control Volume", "Buy Volume", "Sell Volume", "Net Volume"]
)
}
// Draw a simplified volume profile visualization
if (showVolumeProfile) {
// Create a simple visual representation of volume distribution
var pocPrice = vpPoc(vp)
var totalVol = vpTotal(vp)
// Draw a horizontal line representing the total volume
plotLine(
value=pocPrice,
colors=["#9e9e9e"],
width=1,
label=["Volume Base"],
desc=["Volume distribution base line"]
)
}
// === TABLE ===
if (isLastBar) {
var pocPrice = vpPoc(vp)
plotTable(
rows=[
["Bars Processed", tostring(barCount)],
["POC Price", tostring(pocPrice)]
],
position="top_right"
)
}