Code
Code
shorttitle="PIVOTS_STRAT", overlay=true)
offs_daily = 0
signal_bull_last = is_last_doji and (high[1] < avg[1]) and (close > high[1])
signal_bear_last = is_last_doji and (low[1] > avg[1]) and (close < low[1])
signal_bull_last2 = is_last2_doji and (high[2] < avg[2]) and (close > high[2])
signal_bear_last2 = is_last2_doji and (low[2] > avg[2]) and (close < low[2])
typicalAtr = atr(lookbackPeriod)
bull_signal = firstBar_signal and (close[1] < open[1]) and (close > open)
bear_signal = firstBar_signal and (close[1] > open[1]) and (close < open)
location.belowbar, green,
location.abovebar, red,
typicalAtr = atr(lookbackPeriod)
bear_signal = (high > high[1]) and (close < low[1]) and firstBar_signal
// lazybear
// Calculate BB
source = close
// Calculate KC
ma = sma(source, lengthKC)
bcolor = iff( val > 0, iff( val > nz(val[1]), lime, green),iff( val < nz(val[1]), red, maroon))
stratergy(“Wick”)
longCondition = bull_signal
if (longCondition)
strategy.entry("Long", strategy.long)
shortCondition = bear_signal
if (shortCondition)
strategy.entry("Short", strategy.short)
Example
longCondition = close >dtime_h4 and open < dtime_h4 and EMA < close
if (longCondition)
strategy.entry("Long", strategy.long)
shortCondition = close <dtime_l4 and open >dtime_l4 and EMA > close
if (shortCondition)
strategy.entry("Short", strategy.short)
Test code
strategy.entry("Long", strategy.long)
shortCondition = bear_signal
strategy.entry("Short", strategy.short)
shortCondition = bear_signal
strategy.entry("Short", strategy.short)
Momentum Indicator
plot(rsi, color=color.purple)
band1 = hline(70)
band0 = hline(30)
// Volume
showMA = input(true)
palette = barColorsOnPrevClose ? close[1] > close ? color.red : color.green : open > close ?
color.red : color.green
bull_color = #77dd77
bear_color = #ff6961
shape_style_up = shape.labelup
shape_style_down = shape.labeldown
shape_transp = 33
shape_size = size.tiny
text_wr = "WR"
text_fr = "FR"
text_er = "ER"
text_dr = "DR"
// wick reversal
minval=0.0, maxval=1.0)
minval=0.0, maxval=1.0)
// fade reversal
minval=0.0, maxval=1.0)
minval=0.0, maxval=1.0)
// doji reversal
recent_atr = atr(atr_period)
// wick reversal
// fade reversal
fr_bull_signal = fr_body_check_fade and (close[1] < open[1]) and (close > open)
fr_bear_signal = fr_body_check_fade and (close[1] > open[1]) and (close < open)
// engulfing reversal
er_bull_signal = extreme_signal and (low < low[1]) and (close > high[1])
er_bear_signal = extreme_signal and (high > high[1]) and (close < low[1])
// doji reversal
dr_early_bull = doji_signal[1] and (close > high[1]) and (high[1] < close[trend_period])
dr_early_bear = doji_signal[1] and (close < low[1]) and (low[1] > close[trend_period])
dr_late_bull = doji_signal[2] and (close > high[2]) and (high[2] < close[trend_period + 1])
dr_late_bear = doji_signal[2] and (close < low[2]) and (low[2] > close[trend_period + 1])
// wick reversal
// fade reversal
// engulfing reversal
// doji reversal
combined_signal = (
wr_bull_signal
or wr_bear_signal
or fr_bull_signal
or fr_bear_signal
or er_bull_signal
or er_bear_signal
or dr_bull_signal
or dr_bear_signal)
//
typicalAtr = atr(lookbackPeriod)
bull_signal = (low < low[1]) and (close > high[1]) and firstBar_signal
bear_signal = (high > high[1]) and (close < low[1]) and firstBar_signal
plotshape(bull_signal, "Bullish Reversal", shape.labelup, location.belowbar, green,
// WICK REVERSAL
//@version=3
//Extreme Reversal
//@version=3
typicalAtr = atr(lookbackPeriod)
bull_signal = firstBar_signal and (close[1] < open[1]) and (close > open)
bear_signal = firstBar_signal and (close[1] > open[1]) and (close < open)
//PIVOT TRIGGER
//@version=3
bull_color = #77dd77
bear_color = #ff6961
shape_style_up = shape.labelup
shape_style_down = shape.labeldown
shape_transp = 33
shape_size = size.tiny
text_wr = "👠"
text_fr = "👠"
text_er = "👠"
text_dr = "👠"
// wick reversal
minval=0.0, maxval=1.0)
minval=0.0, maxval=1.0)
// fade reversal
minval=0.0, maxval=1.0)
minval=0.0, maxval=1.0)
// doji reversal
recent_atr = atr(atr_period)
// wick reversal
// fade reversal
fr_bull_signal = fr_body_check_fade and (close[1] < open[1]) and (close > open)
fr_bear_signal = fr_body_check_fade and (close[1] > open[1]) and (close < open)
// engulfing reversal
er_bull_signal = extreme_signal and (low < low[1]) and (close > high[1])
er_bear_signal = extreme_signal and (high > high[1]) and (close < low[1])
// doji reversal
dr_early_bull = doji_signal[1] and (close > high[1]) and (high[1] < close[trend_period])
dr_early_bear = doji_signal[1] and (close < low[1]) and (low[1] > close[trend_period])
dr_late_bull = doji_signal[2] and (close > high[2]) and (high[2] < close[trend_period + 1])
dr_late_bear = doji_signal[2] and (close < low[2]) and (low[2] > close[trend_period + 1])
// wick reversal
// fade reversal
// engulfing reversal
// doji reversal
combined_signal = (
wr_bull_signal
or wr_bear_signal
or fr_bull_signal
or fr_bear_signal
or er_bull_signal
or er_bear_signal
or dr_bull_signal
or dr_bear_signal)
size=shape_size, transp=100)
// VWAP
src=close
b=vwap(src)
length=input(34)
//Boring Candle
//Boring Candles or Basing Candles Body Range <= 50% of Candle Range
//GAPS
// Market Profile
// ||-- Inputs:
session_timeframe = input('D')
percent_of_tpo = input(0.70)
tf_high = high
tf_low = low
tf_close = close
session_bar_counter = n - valuewhen(change(time(session_timeframe)) != 0, n, 0)
//plot(session_bar_counter)
session_high = tf_high
session_low = tf_low
if session_bar_counter == 0
session_high := tf_high
session_low := tf_low
session_high := tf_high
session_range := session_high - session_low
session_low := tf_low
tpo_section_range = session_range / 21
_frequency = 0
for _i = 0 to _adjusted_length-1
_frequency := _frequency + 1
f_get_tpo_count(_value)=>
_return = 0.0
if _value == 0
_return := tpo_00
if _value == 1
_return := tpo_01
if _value == 2
_return := tpo_02
if _value == 3
_return := tpo_03
if _value == 4
_return := tpo_04
if _value == 5
_return := tpo_05
if _value == 6
_return := tpo_06
if _value == 7
_return := tpo_07
if _value == 8
_return := tpo_08
if _value == 9
_return := tpo_09
if _value == 10
_return := tpo_10
if _value == 11
_return := tpo_11
if _value == 12
_return := tpo_12
if _value == 13
_return := tpo_13
if _value == 14
_return := tpo_14
if _value == 15
_return := tpo_15
if _value == 16
_return := tpo_16
if _value == 17
_return := tpo_17
if _value == 18
_return := tpo_18
if _value == 19
_return := tpo_19
if _value == 20
_return := tpo_20
_return
tpo_sum = 0.0
current_poc_position = 0.0
current_poc_value = 0.0
for _i = 0 to 20
_get_tpo_value = f_get_tpo_count(_i)
current_poc_position := _i
current_poc_value := _get_tpo_value
vah_position = current_poc_position
val_position = current_poc_position
current_sum = current_poc_value
for _i = 0 to 20