[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: my vwap + standard deviation bands - very slow



PureBytes Links

Trading Reference Links

try this, is not my work i copy from another guy


ND = Day() !=Ref(Day(), -1) ;

P = (H + L ) / 2; 
VWP = P * V; 
BI = BarIndex(); 
BeginBI = ValueWhen(ND, BI); 
BeginBI = BeginBI[BarCount -1]; 
if(BeginBI <= BarCount - 1) {

InRange = BI > BeginBI; 
CumV = Cum(V * InRange); 
CumVWP = Cum(VWP * InRange);  
VWAP = CumVWP / CumV; 
Cuu=Cum(InRange);
S = Cum(Ref(CumV, -1) * V * (P-Ref( VWAP,-1))^2 /CumV ); 
Variance = S / CumV; 
SD = sqrt(Variance);  
VWAP = IIf(InRange,  VWAP, VWAP);

}


Plot( VWAP, " VWAP", colorBlue ); 

Plot( VWAP + 1.96 *SD, "+1SD", colorDarkGreen ); 
Plot( VWAP - 1.96 *SD, "-1SD", colorRed ); 

Plot( VWAP + 2.58 *SD, "+2SD", colorDarkGreen ); 
Plot( VWAP - 2.58 *SD, "-2SD", colorRed ); 



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/