Hi h153tu,
Please try this , by adding these lines
TimeFrameSet( inDaily) ;
Bars_so_far_today = 1+BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum( ) == 093000, BarIndex());
TodayVolume = Sum(V,Bars_so_far_today) ;
IIf (BarIndex() >= StartBar, VWAPd = Sum (C * V, Bars_so_far_today ) /
TodayVolume, 0);
TimeFrameRestore( );
Plot ( VWAPd,"VWAPd",colorRed, styleThick);
cheers
RVLV
----------------------------------------------------------------
--- On Sun, 11/15/09, h153tu <h153tu@xxxxxxxxx> wrote:
From: h153tu <h153tu@xxxxxxxxx> Subject: [amibroker] Plz Correct My AFL [2 Attachments] To: amibroker@xxxxxxxxxxxxxxx Date: Sunday, November 15, 2009, 12:36 AM
Dear all...
I send u 2 attachment file which show different value of VWAP (volume weighted average price)
I want to export VWAP values in1Minutes chart into daily chart, and here my AFL code: In 1 minutes chart i plot this AFL: Bars_so_far_ today = 1 + BarsSince( Day() != Ref(Day(), -1)); StartBar = ValueWhen(TimeNum( ) == 093000, BarIndex()); TodayVolume = Sum(V,Bars_so_ far_today) ; IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_ today ) / TodayVolume, 0);
It WORKs in 1minutes chart
in Daily chart i plot this AFL: TimeFrameSet( in1Minute) ; Bars_so_far_ today = 1+BarsSince( Day() != Ref(Day(), -1)); StartBar = ValueWhen(TimeNum( ) == 093000, BarIndex()); TodayVolume = Sum(V,Bars_so_ far_today) ; IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_ today ) / TodayVolume, 0); TimeFrameRestore( ); Plot (TimeFrameExpand(
VWAP,in1Minute) ,"VWAP",colorOra nge, styleThick);
In daily chart i face the problem, this AFL calculate with this logic as u know VWAP its calculate close every 1 minutes bar * its volume divide by all day volume, but in daily chart the logic became close yesterday daily bar*its daily volume and divide by daily volume so the result in daily chart is yesterday close as in attachment file
Could u help me through this problem, coz i've been facing it 1 month ago and can't get the answer
tq a lot
Always Learn, Always Better S'2 |
Get your new Email address! Grab the Email name you've always wanted before someone else does!
|