|
楼主 |
发表于 2009-2-16 11:22 PM
|
显示全部楼层
能不能把你的AmiBroker代码贴一下。谢谢!
CoolMax 发表于 2009-2-15 22:53
算法很简单, investorpedia有介绍,“VWAP is calculated by adding up the dollars traded for every transaction (price multiplied by number of shares traded) and then dividing by the total shares traded for the day.”
其中一种比较popular的coding 如下,用close price结算,
_SECTION_BEGIN("Intraday VWAP");
Intraday_Bars = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == 093000, BarIndex());
IIf (BarIndex() >= StartBar,
VWAP = Sum (C * V, intraday_bars ) / Sum(V,Intraday_Bars),0);
Plot (VWAP,"VWAP",colorWhite);
_SECTION_END();
当然也可以用(H+L)/2来算,就是如何取平均值的问题,差不离几。 |
|