Pivotboss (CPR, Camarilla, Market Profile)
Pivotboss (CPR, Camarilla, Market Profile)
Pivotboss (CPR, Camarilla, Market Profile)
//Previous D datas
PrevDClose = getSeries(close[1], 'D')
PrevDOpen = getSeries(open[1], 'D')
PrevDHigh = getSeries(high[1], 'D')
PrevDLow = getSeries(low[1], 'D')
//Daily CPR
DPivot = (PrevDHigh + PrevDLow + PrevDClose) / 3.0
DBC = (PrevDHigh + PrevDLow) / 2.0
DTC = (DPivot - DBC) + DPivot
DR1 = (2 * DPivot) - PrevDLow
DS1 = (2 * DPivot) - PrevDHigh
DR2 = DPivot + (PrevDHigh - PrevDLow)
DS2 = DPivot - (PrevDHigh - PrevDLow)
DR3 = PrevDHigh + 2 * (DPivot - PrevDLow)
DS3 = PrevDLow - 2 * (PrevDHigh - DPivot)
DR4 = DR3 + (DR2 - DR1)
DS4 = DS3 - (DS1 - DS2)
//Daily Camarilla
dh5 = (PrevDHigh/PrevDLow) * PrevDClose
dh4 = PrevDClose + (PrevDHigh - PrevDLow) * 1.1 / 2.0
dh3 = PrevDClose + (PrevDHigh - PrevDLow) * 1.1 / 4.0
dl3 = PrevDClose - (PrevDHigh - PrevDLow) * 1.1 / 4.0
dl4 = PrevDClose - (PrevDHigh - PrevDLow) * 1.1 / 2.0
dl5 = PrevDClose - (dh5 - PrevDClose)
//Previous W datas
PrevWClose = getSeries(close[1], 'W')
PrevWOpen = getSeries(open[1], 'W')
PrevWHigh = getSeries(high[1], 'W')
PrevWLow = getSeries(low[1], 'W')
//Weekly CPR
WPivot = (PrevWHigh + PrevWLow + PrevWClose) / 3
WBC = (PrevWHigh + PrevWLow) / 2
WTC = (WPivot - WBC ) + WPivot
WR1 = (2 * WPivot) - PrevWLow
WS1 = (2 * WPivot) - PrevWHigh
WR2 = WPivot + (PrevWHigh - PrevWLow)
WS2 = WPivot - (PrevWHigh - PrevWLow)
WR3 = PrevWHigh + 2 * (WPivot - PrevWLow)
WS3 = PrevWLow - 2 * (PrevWHigh - WPivot)
WR4 = WR3 + (WR2 - WR1 )
WS4 = WS3 - (WS1 - WS2 )
//Weekly Camarilla
wh5 = (PrevWHigh/PrevWLow) * PrevWClose
wh4 = PrevWClose + (PrevWHigh - PrevWLow) * 1.1 / 2.0
wh3 = PrevWClose + (PrevWHigh - PrevWLow) * 1.1 / 4.0
wl3 = PrevWClose - (PrevWHigh - PrevWLow) * 1.1 / 4.0
wl4 = PrevWClose - (PrevWHigh - PrevWLow) * 1.1 / 2.0
wl5 = PrevWClose - (wh5 - PrevWClose)
//Previous M datas
PrevMClose = getSeries(close[1], 'M')
PrevMOpen = getSeries(open[1], 'M')
PrevMHigh = getSeries(high[1], 'M')
PrevMLow = getSeries(low[1], 'M')
//Monthly CPR
MPivot = (PrevMHigh + PrevMLow + PrevMClose) / 3
MBC = (PrevMHigh + PrevMLow) / 2
MTC = (MPivot - MBC ) + MPivot
MR1 = (2 * MPivot) - PrevMLow
MS1 = (2 * MPivot) - PrevMHigh
MR2 = MPivot + (PrevMHigh - PrevMLow)
MS2 = MPivot - (PrevMHigh - PrevMLow)
MR3 = PrevMHigh + 2 * (MPivot - PrevMLow)
MS3 = PrevMLow - 2 * (PrevMHigh - MPivot)
MR4 = MR3 + (MR2 - MR1 )
MS4 = MS3 - (MS1 - MS2 )
//Monthly Camarilla
mh5 = (PrevMHigh/PrevMLow) * PrevMClose
mh4 = PrevMClose + (PrevMHigh - PrevMLow) * 1.1 / 2.0
mh3 = PrevMClose + (PrevMHigh - PrevMLow) * 1.1 / 4.0
ml3 = PrevMClose - (PrevMHigh - PrevMLow) * 1.1 / 4.0
ml4 = PrevMClose - (PrevMHigh - PrevMLow) * 1.1 / 2.0
ml5 = PrevMClose - (mh5 - PrevMClose)
// ||-- Inputs:
percent_of_tpo = input(0.70)
tf_high = high
tf_low = low
tf_close = close
// ||-- Bars since session started:
session_bar_counter = bar_index - valuewhen(change(time(session_timeframe)) != 0,
bar_index, 0)
//plot(session_bar_counter)
// ||-- session high, low, range:
session_high = tf_high
session_low = tf_low
session_range = tf_high - tf_low
tpo_sum = 0.0
current_poc_position = 0.0
current_poc_value = 0.0
for _i = 0 to 20 by 1
_get_tpo_value = f_get_tpo_count_1(_i)
tpo_sum := tpo_sum + _get_tpo_value
if _get_tpo_value > current_poc_value
current_poc_position := _i
current_poc_value := _get_tpo_value
current_poc_value
//plot(series=tpo_sum, title='tpo_sum', color=red)
poc_upper = session_high - tpo_section_range * current_poc_position
poc_lower = session_high - tpo_section_range * (current_poc_position + 1)
//plot(series=poc_upper, title='POC Upper', color=black)
//plot(series=poc_lower, title='POC Lower', color=black)
//plot(series=current_poc_position, title='current_poc_position', color=blue)
//plot(series=current_poc_value, title='current_poc_value', color=blue)
for _i = 0 to 20 by 1
if current_sum < tpo_sum * percent_of_tpo
vah_position := max(0, vah_position - 1)
current_sum := current_sum + f_get_tpo_count_2(round(vah_position))
current_sum
if current_sum < tpo_sum * percent_of_tpo
val_position := min(20, val_position + 1)
current_sum := current_sum + f_get_tpo_count_2(round(val_position))
current_sum
f_gapper(_return_value) =>
_return = _return_value
if session_bar_counter == 0
_return := na
_return
_return