Hi folks,
Can anybody assist in coding this SIROC Metastock indicator into MQ4 please?
I think it would be a first. The exact SIROC code is proprietary.
You can read about the Smoothed Index Rate of Change (SIROC) indicator here: http://thebull.com.au/articles_detail.php?id=340
It's what is referred to as a "leading" indicator - if there is such a thing!
-JR
Can anybody assist in coding this SIROC Metastock indicator into MQ4 please?
I think it would be a first. The exact SIROC code is proprietary.
You can read about the Smoothed Index Rate of Change (SIROC) indicator here: http://thebull.com.au/articles_detail.php?id=340
It's what is referred to as a "leading" indicator - if there is such a thing!
-JR
Inserted Code
---8<------------------------------------- { Siroc v3.0 System1: trigger crossovers. System2: auto over-bought/sold crossovers. Trade at own risk. ©Copyright 2001~2007 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { Indicator/User inputs } prd1:=Input("First Siroc periods",2,252,21); prd2:=Input("Second Siroc periods",2,252,10); prd3:=Input("Siroc crossover periods",2,252,5); x:=Input("use [1]Open [2]High [3]Low [4]Close [5]Weighted Cl",1,5,5); type:=Input("Siroc type: [1], [2]",1,2,1); plot:=Input("plot: [1]System 1, [2]System 2, [3]Siroc",1,3,3); { Select data array } x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,WC(),C)))); { Siroc I } z:=Mov((x-Mov(x,prd1,E)) /Ref(Mov(x,prd1,E),-prd1),prd2,E); Siroc1:=100 *Mov(If(z>Ref(z,-1),z-Ref(z,-1),0),prd3,E) /Max(Mov(If(z>Ref(z,-1),z-Ref(z,-1),0),prd3,E) +Mov(If(z<Ref(z,-1),Ref(z,-1)-z,0),prd3,E), .000001); { Siroc II } prd2:=prd2*2-1; y:=(Mov((x-Mov(x,prd1,E))/Ref(Mov(x,prd1,E),-prd1),prd1,E))-Ref((Mov((x-Mov(x,prd1,E))/Ref(Mov(x,prd1,E),-prd1),prd1,E)),-1); Siroc:=100-100/(1+If(Mov(If((Mov((x-Mov(x,prd1,E))/Ref(Mov(x,prd1,E),-prd1),prd1,E))<Ref((Mov((x-Mov(x,prd1,E))/Ref(Mov(x,prd1,E),-prd1),prd1,E)),-1),-y,0),prd2,E)=0,1000000,Mov(If((Mov((x-Mov(x,prd1,E))/Ref(Mov(x,prd1,E),-prd1),prd1,E))>Ref((Mov((x-Mov(x,prd1,E))/Ref(Mov(x,prd1,E),-prd1),prd1,E)),-1),y,0),prd2,E)/Max(Mov(If((Mov((x-Mov(x,prd1,E))/Ref(Mov(x,prd1,E),-prd1),prd1,E))<Ref((Mov((x-Mov(x,prd1,E))/Ref(Mov(x,prd1,E),-prd1),prd1,E)),-1),-y,0),prd2,E),.000001))); { Select Siroc type } Siroc:=If(type=1,Siroc1,Siroc); trigger:=Mov(Siroc,prd3,E); { Auto overBought/Sold historical levels } avg:=Cum(Siroc)/Cum(IsDefined(Siroc)); pk:=Ref(Siroc,-1)=HHV(Siroc,3) AND Ref(Siroc,-1)>avg; pkVal:=ValueWhen(1,pk,Ref(Siroc,-1)); oBought:=Cum(pkVal)/Cum(IsDefined(pkVal)); tr:=Ref(Siroc,-1)=LLV(Siroc,3) AND Ref(Siroc,-1)<avg; trVal:=ValueWhen(1,tr,Ref(Siroc,-1)); oSold:=Cum(trVal)/Cum(IsDefined(trVal)); { System signals } System1:= Cross(Siroc,trigger)-Cross(trigger,Siroc); System2:= Cross(Siroc,oSold)-Cross(Siroc,oBought); { Plot in own window } If(plot=3,oBought,0); If(plot=3,oSold,0); If(plot=3,trigger,0); If(plot=3,Siroc,If(plot=1,System1,System2)) ---8<-------------------------------------
Be happy, be humble.