| Svapo Oscillator Code
 
 Printed From: BullCharts Forum
 Category:  BullCharts
 Forum Name:  BullScript
 Forum Discription:  Technical discussion related specifically to the BullScript programming language.
 URL: http://www.bullcharts.com.au/forum/forum_posts.asp?TID=692
 Printed Date: 01 Nov 2025 at 6:43am
 Software Version: Web Wiz Forums 9.69 - http://www.webwizforums.com
 
 
 Topic: Svapo Oscillator Code
 Posted By: wacazac
 Subject: Svapo Oscillator Code
 Date Posted: 13 Mar 2011 at 10:20pm
 
 
        
          | Metastock Formular 
 {calculate the heikin-ahhi closing average haCl and get the input variables}
 haOpen:=(Ref((O+H+L+C)/4,-1) + PREV)/2;
 haCl:=((O+H+L+C)/4+haOpen+Max(H,haOpen)+Min(L,haOpen))/4;
 period:= Input("SVAPO period :", 2, 20, 8);
 cutoff:= Input("Minimum %o price change :",0,10,1);
 {Inputs for standard deviation bands}
 devH:= Input("Standard Deviation High :", 0.1, 5, 1.5);
 devL:= Input("Standard Deviation Low :", 0.1, 5, 1.3);
 stdevper:= Input("Standard Deviation Period :", 1, 200, 100);
 {Smooth HaCl closing price}
 haC:=Tema(haCl,period/1.6);
 {Medium term MA of Volume to limit extremes and division factor}
 vave:=Ref(Mov(V,period*5,S),-1);
 vmax:=vave*2;
 vc:=If(V<vmax,V,vmax);
 {Basic volume trend}
 vtr:=Tema(LinRegSlope(V,period),period);
 {SVAPO result of price and volume}
 SVAPO:=Tema(Sum(If(haC>(Ref(haC,-1)*(1+cutoff/1000))
 AND Alert(vtr>=Ref(vtr,-1),2), vc, 
If(haC<(Ref(haC,-1)*(1-cutoff/1000)) AND 
Alert(vtr>Ref(vtr,-1),2),-vc,0)),period)/(vave+1),period);
 devH*Stdev(SVAPO,stdevper);
 -devL*Stdev(SVAPO,stdevper);
 zeroref:=0;
 zeroref;
 SVAPO
 ######################{the code appears to be correct to here but the I get error messge "operater expected,not there" can some kind sole correct this code please
  ? 
 declare upper;
 
 input SVAPOLength = 8;
 input MinPctODelta = 1;
 input STDevHi = 1.5;
 input STDevLo = 1.3;
 input STDPeriod = 100;
 ############################
 #Heiken Ashi Data set
 #############################
 
 def Vclose = (Open + High + Low + Close) / 4;
 rec Vopen = compoundValue(1, ((open[1] + high[1] + low[1] + close[1]) / 4 + vopen[1]) / 2, hl2);
 
 def HaC = TEMA(Vclose, SVAPOLength /1.6);
 REC vave =(SIMPLeMovingAvg(Volume,SVAPOLength*5)[1]);
 def vMax=vave*2;
 def VC= if (Volume<vMax,Volume,vMax);
 def VTR=TEMA(LINearRegressionSlope(volume,SVAPOLength),SVAPOLength);
 
 plot
 SVAPO=TEMA(sum (if (HaC>(HaC[1]*(1+MinPctODelta/1000)) and 
VTR>=VTR[1],VC, If(haC<(haC[1]*(1-MinPctODelta/1000)) AND 
vtr>vtr[1],-VC,0)),SVAPOLength)/(vave+1),SVAPOLength);
 |  
 
 Replies:
 Posted By: maximo
 Date Posted: 14 Mar 2011 at 5:25pm
 
 
        
          | BullCharts formulaaah  [Description='SVAPO is an indicator presented by Sylvain Vervoort in the Nov 07 issue of the Stocks & Commodities magazine.
 This indicator combines price and volume information into a Short-Term Volume And Price Oscillator.]
 {heikin ashi closing average haCl and input variables} haO:=(Ref((O+H+L+C)/4,-1) + PREV)/2;
 haC:=((O+H+L+C)/4+haO+Max(H,haO)+Min(L,haO))/4;
 {input SVAPO period and smooth HA closing Price}
 period:= Input("SVAPO period :",20,8);
 sHaC:= Tema(haC,period/1.6,E);
 {input minimum per thousand price change}
 cutoff:= Input("Minimum %o price change :",10,1);
 {Inputs for standard deviation bands}
 devH:= Input("Standard Deviation High :",1.5,0.1);
 devL:= Input("Standard Deviation Low :",1.3,0.1);
 stdevper:= Input("Standard Deviation Period :", 100,100);
 vc:=Ref(Ma(C,period*5,S),-1);
 {Basic trend}
 vtr:=Tema(LinRegSlope(C,period),period);
 {SVAPO result of price only}
 SVAPO:= Tema(sum(if(HaC>(ref(sHaC,-1)*(1+cutoff/10000)) AND BarsSince(vtr>=ref(vtr,-1))<=2,vc, if(sHaC<(ref(sHaC,-1)*(1-cutoff/10000)) AND BarsSince(vtr>ref(vtr,-1))<=2,-vc,0)),period) /(vc+1), period,E);
 [color=red]devH*Stdev(SVAPO,stdevper); [color=lime green]-devL*Stdev(SVAPO,stdevper);
 [color=black]0;
 [color=blue]SVAPO
   |  
 
 |