Thanks Roberto, contacted them and they've been helpful...however, was wondering if anyone could cast their eye over the code and just confirm that there are no glaring errors. It seems to be correct to me, just slightly puzzled as to how it is actually acting on my chart though as it seems to be fanning out i.e. they appear to expand and contract similar to a bollinger band (but not as obviously) which I never expected to be honest
On CQG there are curves for each of the 7 lines, but code all the same on each bar last line has different DevMultiplier option and either add or subtract. The below is code for 1st Deviation line:
Vol1:=IF( HasVal(Vol(@)) AND Vol(@) > 0, Vol(@), 0) ;
priceX:= IF(price = 1, Close(@), IF(price = 2, High(@), IF(price = 3, Low(@), IF(price = 4, Mid(@), IF(price = 5, HLC3(@), IF(price = 6, Avg(@), IF(price=7, Open(@), 0) ) ) ) ) ) ) ;
Bars1:=IF((BarsSince(HasVal(@)=0,1,10000) WHEN BarIx(@,StartOfDay)=0)> 0, BarIx(@,StartOfDay)+1, BarsSince(HasVal(@)=0,1,10000)) ;
VWAP1:= Sum(priceX* Vol1,Bars1)/ Sum( Vol1,Bars1);
Variance1:= Sum( (Vol1/ Sum( Vol1,Bars1))* Power((priceX-VWAP1),2.00000),Bars1);
StdDev1:= SqRoot( Variance1);
VWAP1+(StdDev1*DevMultiplier1)
DevMultiplier1 is an on chart option where you can specify what multiplier to use
ON CQG there are curves for each of the 7 lines, code all the same, just different DevMultiplier option and either add or subtract. The below is just for the 1st Deviation line as an example