PINE LIBRARY
Updated SMCFunctions

Library "SMCFunctions"
findSwingPoints(high, low, swing_size)
Parameters:
high (float)
low (float)
swing_size (int)
detectBOS(close, high, low, prevHigh, prevLow, highActive, lowActive, bos_conf_type)
Parameters:
close (float)
high (float)
low (float)
prevHigh (float)
prevLow (float)
highActive (bool)
lowActive (bool)
bos_conf_type (string)
getBOSDetails(highBroken, lowBroken, prevHigh, prevLow, prevSwing, prevHighIndex, prevLowIndex, input_show_choch)
Parameters:
highBroken (bool)
lowBroken (bool)
prevHigh (float)
prevLow (float)
prevSwing (int)
prevHighIndex (int)
prevLowIndex (int)
input_show_choch (bool)
calculateRetracementLevels(start_price, end_price)
Parameters:
start_price (float)
end_price (float)
findSwingPoints(high, low, swing_size)
Parameters:
high (float)
low (float)
swing_size (int)
detectBOS(close, high, low, prevHigh, prevLow, highActive, lowActive, bos_conf_type)
Parameters:
close (float)
high (float)
low (float)
prevHigh (float)
prevLow (float)
highActive (bool)
lowActive (bool)
bos_conf_type (string)
getBOSDetails(highBroken, lowBroken, prevHigh, prevLow, prevSwing, prevHighIndex, prevLowIndex, input_show_choch)
Parameters:
highBroken (bool)
lowBroken (bool)
prevHigh (float)
prevLow (float)
prevSwing (int)
prevHighIndex (int)
prevLowIndex (int)
input_show_choch (bool)
calculateRetracementLevels(start_price, end_price)
Parameters:
start_price (float)
end_price (float)
Release Notes
v2Added:
addSwingPoint(swing_points_array, bar_index, price, type, direction, max_size)
Parameters:
swing_points_array (array<SwingPointData>)
bar_index (int)
price (float)
type (string)
direction (int)
max_size (int)
addBOS(bos_details_array, bar_index, price, bos_text, direction, original_price, creation_bar, max_size)
Parameters:
bos_details_array (array<BOSData>)
bar_index (int)
price (float)
bos_text (string)
direction (int)
original_price (float)
creation_bar (int)
max_size (int)
addRetracementLevel(retracement_levels_array, bar_index, price, type, direction, start_bar_index, max_size)
Parameters:
retracement_levels_array (array<RetracementData>)
bar_index (int)
price (float)
type (string)
direction (int)
start_bar_index (int)
max_size (int)
getBufferedSwingPoints(swing_points_array, lookback_bars)
Parameters:
swing_points_array (array<SwingPointData>)
lookback_bars (int)
getBufferedBOSDetails(bos_details_array, lookback_bars)
Parameters:
bos_details_array (array<BOSData>)
lookback_bars (int)
getBufferedRetracementLevels(retracement_levels_array, lookback_bars)
Parameters:
retracement_levels_array (array<RetracementData>)
lookback_bars (int)
getBufferedSwingPointsSize(swing_points_array)
Parameters:
swing_points_array (array<SwingPointData>)
getBufferedBOSDetailsSize(bos_details_array)
Parameters:
bos_details_array (array<BOSData>)
getBufferedRetracementLevelsSize(retracement_levels_array)
Parameters:
retracement_levels_array (array<RetracementData>)
SwingPointData
Fields:
bar_index (series int)
price (series float)
type (series string)
direction (series int)
BOSData
Fields:
bar_index (series int)
price (series float)
bos_text (series string)
direction (series int)
original_price (series float)
creation_bar (series int)
RetracementData
Fields:
bar_index (series int)
price (series float)
type (series string)
direction (series int)
start_bar_index (series int)
Release Notes
v3Updated:
findSwingPoints(highSeries, lowSeries, swing_size)
Parameters:
highSeries (float)
lowSeries (float)
swing_size (int)
detectBOS(closeSeries, highSeries, lowSeries, prevHigh, prevLow, highActive, lowActive, bos_conf_type)
Parameters:
closeSeries (float)
highSeries (float)
lowSeries (float)
prevHigh (float)
prevLow (float)
highActive (bool)
lowActive (bool)
bos_conf_type (string)
getBOSDetails(highBroken, lowBroken, prevHigh, prevLow, prevSwingType, prevHighIndex, prevLowIndex, showChoch)
Parameters:
highBroken (bool)
lowBroken (bool)
prevHigh (float)
prevLow (float)
prevSwingType (int)
prevHighIndex (int)
prevLowIndex (int)
showChoch (bool)
addSwingPoint(swing_points_array, b_index, p, t, dir, max_size)
Parameters:
swing_points_array (array<SwingPointData>)
b_index (int)
p (float)
t (string)
dir (int)
max_size (int)
addBOS(bos_details_array, b_index, p, txt, dir, orig_p, cr_bar, max_size)
Parameters:
bos_details_array (array<BOSData>)
b_index (int)
p (float)
txt (string)
dir (int)
orig_p (float)
cr_bar (int)
max_size (int)
addRetracementLevel(retracement_levels_array, b_index, p, t, dir, start_b_index, max_size)
Parameters:
retracement_levels_array (array<RetracementData>)
b_index (int)
p (float)
t (string)
dir (int)
start_b_index (int)
max_size (int)
Release Notes
v4Added:
classifySwingPoint(pivHi, pivLo, prevHigh, prevLow, prevSwing)
Parameters:
pivHi (float)
pivLo (float)
prevHigh (float)
prevLow (float)
prevSwing (int)
detectRetracementTrigger(prevSwing, prevSwingPrev, current_bar_index, prevHigh, prevLow, pivHi, pivLo, swing_size)
Parameters:
prevSwing (int)
prevSwingPrev (int)
current_bar_index (int)
prevHigh (float)
prevLow (float)
pivHi (float)
pivLo (float)
swing_size (int)
detectFVG(high, low, bar_time)
Parameters:
high (float)
low (float)
bar_time (int)
checkFVGMitigation(fvg, high, low, close, open, mitigation_type)
Parameters:
fvg (FVGData)
high (float)
low (float)
close (float)
open (float)
mitigation_type (string)
detectBPR(fvg_array)
Parameters:
fvg_array (array<FVGData>)
detectVolumeSpike(close, prev_close, volume, ema_volume, threshold)
Parameters:
close (float)
prev_close (float)
volume (float)
ema_volume (float)
threshold (float)
addFVG(fvg_array, high_time, low_time, high_price, low_price, is_bullish, max_size)
Parameters:
fvg_array (array<FVGData>)
high_time (int)
low_time (int)
high_price (float)
low_price (float)
is_bullish (bool)
max_size (int)
addVolumeSpike(spike_array, bar_time, price, percent_oi, normalized_volume, max_size)
Parameters:
spike_array (array<VolumeSpikeData>)
bar_time (int)
price (float)
percent_oi (float)
normalized_volume (float)
max_size (int)
getBufferedFVGs(fvg_array, lookback_bars, bar_time)
Parameters:
fvg_array (array<FVGData>)
lookback_bars (int)
bar_time (int)
getBufferedVolumeSpikes(spike_array, lookback_bars, bar_time)
Parameters:
spike_array (array<VolumeSpikeData>)
lookback_bars (int)
bar_time (int)
getBufferedFVGSize(fvg_array)
Parameters:
fvg_array (array<FVGData>)
getBufferedVolumeSpikeSize(spike_array)
Parameters:
spike_array (array<VolumeSpikeData>)
FVGData
Fields:
high_time (series int)
low_time (series int)
high_price (series float)
low_price (series float)
is_bullish (series bool)
mitigated (series bool)
VolumeSpikeData
Fields:
bar_time (series int)
price (series float)
percent_oi (series float)
normalized_volume (series float)
Updated:
findSwingPoints(high, low, swing_size)
Parameters:
high (float)
low (float)
swing_size (int)
detectBOS(close, high, low, prevHigh, prevLow, highActive, lowActive, bos_conf_type)
Parameters:
close (float)
high (float)
low (float)
prevHigh (float)
prevLow (float)
highActive (bool)
lowActive (bool)
bos_conf_type (string)
getBOSDetails(highBroken, lowBroken, prevHigh, prevLow, prevSwing, prevHighIndex, prevLowIndex, input_show_choch)
Parameters:
highBroken (bool)
lowBroken (bool)
prevHigh (float)
prevLow (float)
prevSwing (int)
prevHighIndex (int)
prevLowIndex (int)
input_show_choch (bool)
addSwingPoint(swing_points_array, bar_index, price, type, direction, max_size)
Parameters:
swing_points_array (array<SwingPointData>)
bar_index (int)
price (float)
type (string)
direction (int)
max_size (int)
addBOS(bos_details_array, bar_index, price, bos_text, direction, original_price, creation_bar, max_size)
Parameters:
bos_details_array (array<BOSData>)
bar_index (int)
price (float)
bos_text (string)
direction (int)
original_price (float)
creation_bar (int)
max_size (int)
addRetracementLevel(retracement_levels_array, bar_index, price, type, direction, start_bar_index, max_size)
Parameters:
retracement_levels_array (array<RetracementData>)
bar_index (int)
price (float)
type (string)
direction (int)
start_bar_index (int)
max_size (int)
Release Notes
v5Release Notes
v6Added:
processSwingLogic(currentHigh, currentLow, swing_size_input, prevHigh_in, prevLow_in, prevHighIndex_in, prevLowIndex_in, prevSwingType_in)
Parameters:
currentHigh (float)
currentLow (float)
swing_size_input (int)
prevHigh_in (float)
prevLow_in (float)
prevHighIndex_in (int)
prevLowIndex_in (int)
prevSwingType_in (int)
processBOSDetection(current_close_price, current_high_price, current_low_price, prev_high_to_break, prev_low_to_break, is_prev_high_active, is_prev_low_active, prev_swing_type_for_choch, prev_high_idx_for_choch, prev_low_idx_for_choch, bos_confirmation_type, show_choch_option)
Parameters:
current_close_price (float)
current_high_price (float)
current_low_price (float)
prev_high_to_break (float)
prev_low_to_break (float)
is_prev_high_active (bool)
is_prev_low_active (bool)
prev_swing_type_for_choch (int)
prev_high_idx_for_choch (int)
prev_low_idx_for_choch (int)
bos_confirmation_type (string)
show_choch_option (bool)
identifyExpansionAndRetracement(swing_points_buffer, show_half_retracement_input)
Parameters:
swing_points_buffer (array<SwingPointData>)
show_half_retracement_input (bool)
detectAndManageFVGs(H, L, O, C, fvgs_array_in, lookback_param, mitigation_type_param, max_fvgs_to_display)
Parameters:
H (float)
L (float)
O (float)
C (float)
fvgs_array_in (array<FVGData>)
lookback_param (int)
mitigation_type_param (string)
max_fvgs_to_display (int)
SwingStateAndPoint
Fields:
prevHigh (series float)
prevLow (series float)
prevHighIndex (series int)
prevLowIndex (series int)
prevSwingType (series int)
newSwingPoint (SwingPointData)
Updated:
addSwingPoint(swing_points_array, point_data, max_size)
Parameters:
swing_points_array (array<SwingPointData>)
point_data (SwingPointData)
max_size (int)
addBOS(bos_details_array, bos_event_data, max_size)
Parameters:
bos_details_array (array<BOSData>)
bos_event_data (BOSData)
max_size (int)
addRetracementLevel(retracement_levels_array, retracement_level_data, max_size)
Parameters:
retracement_levels_array (array<RetracementData>)
retracement_level_data (RetracementData)
max_size (int)
BOSData
Fields:
bar_index (series int)
price (series float)
bos_text (series string)
direction (series int)
original_swing_bar_index (series int)
creation_bar (series int)
FVGData
Fields:
discovery_bar_index (series int)
top_price (series float)
bottom_price (series float)
is_bullish (series bool)
mitigated (series bool)
bar1_time (series int)
bar1_index (series int)
bar3_time (series int)
bar3_index (series int)
Removed:
findSwingPoints(high, low, swing_size)
classifySwingPoint(pivHi, pivLo, prevHigh, prevLow, prevSwing)
detectBOS(close, high, low, prevHigh, prevLow, highActive, lowActive, bos_conf_type)
getBOSDetails(highBroken, lowBroken, prevHigh, prevLow, prevSwing, prevHighIndex, prevLowIndex, input_show_choch)
detectRetracementTrigger(prevSwing, prevSwingPrev, current_bar_index, prevHigh, prevLow, pivHi, pivLo, swing_size)
detectFVG(high, low, bar_time)
checkFVGMitigation(fvg, high, low, close, open, mitigation_type)
detectBPR(fvg_array)
detectVolumeSpike(close, prev_close, volume, ema_volume, threshold)
addFVG(fvg_array, high_time, low_time, high_price, low_price, is_bullish, max_size)
addVolumeSpike(spike_array, bar_time, price, percent_oi, normalized_volume, max_size)
getBufferedFVGs(fvg_array, lookback_bars, bar_time)
getBufferedVolumeSpikes(spike_array, lookback_bars, bar_time)
getBufferedFVGSize(fvg_array)
getBufferedVolumeSpikeSize(spike_array)
VolumeSpikeData
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.