Closed workingbuddy10 closed 11 months ago
The root cause of this issue is in the data set there can be a few data points which may not have Volume data. This case is not being handled currently.
It can be fixed by tweaking prepareData in VWAP.js :
prepareData() {
if (this.series) {
let period = this.get("period", Infinity);
const stockSeries = this.get("stockSeries");
const volumeSeries = this.get("volumeSeries");
const dataItems = stockSeries.dataItems;
if (volumeSeries) {
let data = this._getDataArray(dataItems);
let i = 0;
let totalVolume = 0;
let totalVW = 0;
$array.each(data, (dataItem) => {
const volumeDI = volumeSeries.dataItems[i];
if (volumeDI && volumeDI.get("valueY")) {
const volume = volumeDI.get("valueY", 0);
const vw = dataItem.value_y * volume;
dataItem.vw = vw;
dataItem.volume = volume;
totalVW += vw;
totalVolume += volume;
if (i >= period) {
let volumeToRemove = data[i - period].volume;
let vwToRemove = data[i - period].vw;
if (volumeToRemove != null) {
totalVolume -= volumeToRemove;
}
if (vwToRemove != null) {
totalVW -= vwToRemove;
}
}
dataItem.totalVW = totalVW;
dataItem.vwap = totalVW / totalVolume;
} else {
dataItem.vw = null;
dataItem.volume = null;
dataItem.totalVW = null;
dataItem.vwap = null;
}
i++;
});
this.series.data.setAll(data);
}
}
}
@martynasma
So I theoretically can imagine that there is no data item in volume series - I can add the if. But your second condition: && volumeDI.get("valueY")
would mean that if volume data item exists but value is ==0, then the condition is not met. I think the correct way would be only to check if dataItem exists.
@zeroin Just wanted to handle the case where in the data set there can be A FEW data points which may not have Volume data, rest other data points are having volume data for VWAP indicator.
If I am not adding this check the indicator is going infinity && volumeDI.get("valueY")
Fixed in 5.7.0.
Serializer
setting: fullSettings
. Will ignore depth settings for keys listed in fullSettings
.StockAxis
toolbar control: DataSaveControl
. Allows to automatically or manually save all drawings and indicators to browser's local storage, as well as restore them across sessions. More info.SettingsControl
: Auto-save drawings and indicators.SettingsControl
: autoSave
. Enables user to toggle auto-saving of indicators/drawings via Settings dropdown.DropdownList
and DropdownListControl
: exclude
. Can be set to an array of item IDs that should not appear in the list. Can be used to disable default list items.StockChart
: spriteResizer
. Holdes an instance of SpriteResizer
which is used among drawing tools.zoomable
setting added to Axis. If set to false, calling axis.zoom() won't do anything, meaning that the axis won't be zoomed with scrollbars, wheel, cursor etc.StockChart
will only sync zoom between X axes that are of the same type as the main axis.SpriteResizer
.IndictorControl
is now searchable by default (searchable: true
).PeriodSelector
's buttons were not being reset when chart was zoomed manually.StockChart
's control were not being positioned correctly in all cases on a page with RTL direction enabled.StockChart
indicators.StockChart
, indicator's panel X-axis was out of sync with the main panel's X-axis if the latter's scale was longer to some other series on the main panel.StockChart
label drawing tools.GaplessDateAxis
was not always including the first date when using axis.zoomToDates(startDate, endDate)
method.Make sure you clear your browser cache after upgrading. And feel free to contact us again if you are still experiencing this issue.
@martynasma @zeroin
VWAP Indicator still not fixed! It's behaving the same. Though I have updated the amcharts version to 5.7.0
Indeed, sorry, we will fix it in next release.
No issues @zeroin
Fixed in 5.7.1.
DataSaveControl
was always clearing manually-saved drawings/indicators unless auto-save was enabled.DataSaveControl
.VolumeProfileIndicator
was not working if added via API.VolumeProfileIndicator
was drawn detached from the Y-axis in some cases.VWAP
indicator with data that contained zero-volume items.Make sure you clear your browser cache after upgrading. And feel free to contact us again if you are still experiencing this issue.
VWAP Indicator is not Working properly. It went to infinity.
Just select VWAP indicator. Code pen link : https://codepen.io/Ansh-m-the-reactor/pen/QWYBNvZ