Initial Commit ...
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
|
||||
// © Shuttle_Club
|
||||
//@version=4
|
||||
|
||||
study('Volume fight')
|
||||
ma = input(24, 'Search_range', minval=1,tooltip='The range of estimation of the predominance of bullish or bearish volume (quantity bars). The smaller the TF, the higher the range value should be used to filter out false signals.\n\nДиапазон оценки преобладания бычьего или медвежьего объема (количество баров). Чем меньше ТФ, тем выше следует использовать значение диапазона, чтобы отфильтровать ложные сигналы.')
|
||||
delta = input(15, 'Smoothing_for_flat,%', step=0.5, minval=0,tooltip='Smoothing to reduce false signals and highlight the flat zone. If you set the percentage to zero, the flat zones will not be highlighted, but there will be much more false signals, since the indicator becomes very sensitive when the smoothing percentage decreases.\n\nСглаживание для уменьшения ложных сигналов и выделения зоны флета. Если выставить процент равным нулю, то зоны флета выделяться не будут, но будет гораздо больше ложных сигналов, так как индикатор становится очень чувствительным при снижении процента сглаживания')
|
||||
bgshow = input(false, 'Show background zones',tooltip='Show the color background of the current trading zone.\n\nПоказывать цветовой фон текущей торговой зоны.')
|
||||
all_signal_show = input(false, 'Show each setup in zone',tooltip='Show and use signals every time in trading zone.\n\nПоказывать и использовать каждый сигнал в торговой зоне.')
|
||||
|
||||
///// CALCULATION
|
||||
bull_vol = open<close ? volume : volume*(high-open)/(high-low) //determine the share of bullish volume
|
||||
bear_vol = open>close ? volume : volume*(open-low)/(high-low) //determine the share of bearish volume
|
||||
avg_bull_vol = vwma(bull_vol,ma), avg_bear_vol = vwma(bear_vol,ma) //determine vwma
|
||||
diff_vol = sma((avg_bull_vol/volume-1)-(avg_bear_vol/volume-1),ma) //normalize and smooth the values
|
||||
vol_flat = abs(avg_bull_vol+avg_bear_vol)/2 //determine average value for calculation flat-filter
|
||||
|
||||
///// SIGNALS
|
||||
up = int(na), up := nz(up[1]), dn = int(na), dn := nz(dn[1]) //variables
|
||||
bull = avg_bull_vol>avg_bear_vol and vol_flat/avg_bull_vol<(1-delta/100) //determine up zones
|
||||
bear = avg_bull_vol<avg_bear_vol and vol_flat/avg_bear_vol<(1-delta/100) //determine dn zones
|
||||
if bull
|
||||
up += 1, dn := 0
|
||||
if bear
|
||||
dn += 1, up := 0
|
||||
if not bull and not bear and all_signal_show
|
||||
up :=0, dn := 0
|
||||
|
||||
alertcondition(bull and up==1,'UP','UP - Bullish movement') //UP - alert
|
||||
alertcondition(bear and dn==1,'DN','DN - Bearish movement') //DN - alert
|
||||
|
||||
///// PLOTTING
|
||||
plotshape(bull and up==1, 'UP', location=location.bottom, style = shape.triangleup, color=color.green, size=size.tiny)
|
||||
plotshape(bear and dn==1, 'DN', location=location.top, style = shape.triangledown, color=color.red, size=size.tiny)
|
||||
bgcolor(title='Trading zones',color = bgshow and avg_bull_vol>avg_bear_vol and vol_flat/avg_bull_vol<(1-delta/100) ? color.new(color.green,85) : bgshow and avg_bull_vol<avg_bear_vol and vol_flat/avg_bear_vol<(1-delta/100) ? color.new(color.red,85) : na)
|
||||
plot(diff_vol, 'Volume difference', style=plot.style_area, color = avg_bull_vol>avg_bear_vol and vol_flat/avg_bull_vol<(1-delta/100) ? color.new(color.green,0) : avg_bull_vol<avg_bear_vol and vol_flat/avg_bear_vol<(1-delta/100) ? color.new(color.red,0) : color.new(color.gray,50))
|
||||
Reference in New Issue
Block a user