Closed Ylelmon closed 3 years ago
Hello @Ylelmon,
There are four required inputs as described in help(ta.vwap)
. What do you want to input or replace? The more specific you are, the better I can help you.
Kind Regards, KJ
Periods like this cumulativePeriod1 = input(210, "Period") Tpv1 = sum(typicalPriceVolume, cumulativePeriod1) cumulativeVolume1 = sum(volume, cumulativePeriod1) vwapValue1 = tpv/ cumulativeVolume1 And have another Vwap but have different input
@Ylelmon,
cumulativePeriod1 = input(210, "Period")
What is input?
I think I understand that:
Tpv1 = sum(typicalPriceVolume, cumulativePeriod1) cumulativeVolume1 = sum(volume, cumulativePeriod1) vwapValue1 = tpv/ cumulativeVolume1
depends on cumulativePeriod1 above. But I still do not understand what you are trying to achieve.
Since vwap has four different inputs: high, low, close, volume
, you can replace one of them or any combination of them but you have to do it explicitly.
For instance, if you wanted the vwap of strictly close
(or high
or low
for that matter) and volume
, you could do:
df = # your ohlcv data
# Default anchor is D for Daily
vwapc = ta.vwap(df.close, df.close, df.close, df.volume, anchor="D") # Default
Here are the other Timeseries Offset Aliases you can use for an anchor
.
Kind Regards, KJ
That one vwap I'm trying to put multiple vwap in the chart and every vwap had different periods like this
@Ylelmon,
Are you sure that is vwap? If so, what is the source (where the image is from)? Are you sure you do not mean vwma, which uses defined periods?
Note: vwma is not vwap. For more info:
import pandas_ta as ta
help(ta.vwma)
KJ
I'm sure it is vwap and the picture from TradingView
That the code
typicalPrice = (high + low + close) / 3 typicalPriceVolume = typicalPrice * volume
cumulativePeriod1 = input(210, "Period") cumulativeTypicalPriceVolume1 = sum(typicalPriceVolume, cumulativePeriod1) cumulativeVolume1 = sum(volume, cumulativePeriod1) vwapValue1 = cumulativeTypicalPriceVolume1 / cumulativeVolume1 plot(vwapValue1,title='210',color=#35e8ff,style=circles)
cumulativePeriod2 = input(400,"Period2") cumulativeTypicalPriceVolume2 = sum(typicalPriceVolume, cumulativePeriod2) cumulativeVolume2 = sum(volume, cumulativePeriod2) vwapValue2 = cumulativeTypicalPriceVolume2 / cumulativeVolume2 plot(vwapValue2,title='400',color=#f995ff,style=circles,transp=1,linewidth=1)
It has the same calculation of the vwap in pandas_ta
that what look like in chart
@Ylelmon,
Ahhhh... so https://github.com/twopirllc/pandas-ta/issues/384#issuecomment-912066556 is a TV Pinescript indicator. Please provide an html link to the source.
It has the same calculation of the vwap in pandas_ta
I would not assume that since TV's builtin vwap is anchor based just like Pandas TA's vwap.
Thanks, KJ
What do u mean by HTML ? HTML the language like by python? Or something else because I don't understand what u what
@Ylelmon,
Whose code is it?
You can't find it if u search it in tradingview it files someone code it and u just copy and pasted in the pin scrip
I already sent to u
@Ylelmon,
Those are all the public TV vwaps. You must have used one of them. If you are unable to identify which one you used, then I can not help you until you figure it out. Nor am I going to spend my time going through each one to figure it out.
It in my script and u can't search it in tradingview but thx for try to help
@Ylelmon,
Ok. To be clear, it's not the same as TV's builtin nor Pandas TA's vwap.
How to have different vwap with different inputs ?