Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Simple VWAP for Amibroker (AFL)
Rating:
5 / 5 (Votes 1)
Tags:
amibroker, oscillator, vwap
Preclosing Trading with VWAP strategies.
Screenshots
Indicator / Formula
Copy & Paste Friendly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | function Lastthursday() { Daysinmonth = IIf ( Month () == 1 OR Month () == 3 OR Month () == 5 OR Month () == 7 OR Month () == 8 OR Month () == 10 OR Month () == 12, 31, 30 ); Daysinmonthfeb = IIf ( Year () % 4 == 0 AND Year () % 100 != 0, 29, 28 ); Daysinmonthfinal = IIf ( Month () == 2, Daysinmonthfeb, Daysinmonth ); returnvalue = IIf ( Daysinmonthfinal - Day () < 7 AND DayOfWeek () == 4, 1, IIf ( Daysinmonthfinal - Day () < 8 AND DayOfWeek () == 3 AND Ref ( DayOfWeek (), 1 ) != 4 AND Day () != Daysinmonthfinal , 1, 0 ) ); return returnvalue; } Period = ParamList ( "Base" , "Daily|Weekly|Monthly|Lastthursday|Yearly" , 1 ); if (Period== "Daily" ) { Bars_so_far_today = 1 + BarsSince ( Day () != Ref ( Day (), -1)); StartBar = ValueWhen ( TimeNum () == 091500, BarIndex ()); TodayVolume = Sum ( V ,Bars_so_far_today); average = ( H + L + C )/3; IIf ( BarIndex () >= StartBar, VWAP = Sum (average * V , Bars_so_far_today ) / TodayVolume,0); } if (Period== "Weekly" OR Interval ()==24 * 3600 ) { Bars_so_far_today = 1 + BarsSince ( DayOfWeek () < Ref ( DayOfWeek (), -1 )); StartBar = ValueWhen ( TimeNum () == 091500, BarIndex ()); Vol = TimeFrameGetPrice ( "V" , inWeekly , 0); TodayVolume = Sum (Vol,Bars_so_far_today); average = ( H + L + C )/3; IIf ( BarIndex () >= StartBar, VWAP = Sum (average * Vol, Bars_so_far_today ) / TodayVolume,0); } if (Period== "Monthly" ) { Bars_so_far_today = 1 + BarsSince ( Month () != Ref ( Month (), -1)); Vol = TimeFrameGetPrice ( "V" , inMonthly , 0); StartBar = ValueWhen ( TimeNum () == 091500, BarIndex ()); TodayVolume = Sum (Vol,Bars_so_far_today); average = ( H + L + C )/3; IIf ( BarIndex () >= StartBar, VWAP = Sum (average * Vol, Bars_so_far_today ) / TodayVolume,0); } Plot (VWAP, "VWAP" , IIf ( Ref (VWAP,2)<VWAP, colorRed , colorBrightGreen ), styleStaircase ); |
2 comments
Leave Comment
Please login here to leave a comment.
Back
Dear Ricky,
I’m feeling curious on why you put this code on plot ? Why you use Ref +2 ?
IIf(Ref(VWAP,2)<VWAP,colorRed,colorBrightGreen)
Thank you for your kind explanation.
Cheers,
Hendra
Good indicator with good success rate.Keep it