Rank: Advanced Member
Groups: Moderators, Registered, Registered Users, Subscribers Joined: 10/8/2010(UTC) Posts: 1,960
Thanks: 92 times Was thanked: 155 time(s) in 150 post(s)
|
Originally Posted by: anthonyaj Hello, I have pasted the RVI formula below but I am wondering if someone can show me how I create a symbol when the green trigger line (value 1) crosses the red line (value 2). ti:=Input("length",2,20,10); v1:=((C-O)+(2*Ref(C-O,-1))+(2*Ref(C-O,-2))+Ref(C-O,-3))/6; v2:=((H-L)+(2*Ref(H-L,-1))+(2*Ref(H-L,-2))+Ref(H-L,-3))/6; temp:=If(Sum(v2,ti)=0,0.0001,Sum(v2,ti)); rv:=Sum(v1,ti)/temp; rvsig:= (rv+Ref(2*rv,-1)+Ref(2*rv,-2)+Ref(rv,-3))/6; rv; I have tried but I just cannot get it. Any help appreciated. Regards, Anthony
Hello, It appears your formula only has one output "rv". Are you wanting to use the Expert Advisor to put a symbol on your chart when RV crosses above/below RVSIG? You could have a single expert symbol for this, or you could have an expert symbol for the cross above and another symbol for the cross below.
You would have to modify the formula to replace the "Input" function in your "ti" variable. The Input function will not work within the Expert Advisor, but you could modify the formula to simply refer to a fixed variable value (which you could adjust as desired). For example, if you create a New Expert Advisor, you can click on the Symbols tab and click New to create a New Symbol:
Name: Cross Up Condition: Code:ti:=10;
v1:=((C-O)+(2*Ref(C-O,-1))+(2*Ref(C-O,-2))+Ref(C-O,-3))/6;
v2:=((H-L)+(2*Ref(H-L,-1))+(2*Ref(H-L,-2))+Ref(H-L,-3))/6;
temp:=If(Sum(v2,ti)=0,0.0001,Sum(v2,ti));
rv:=Sum(v1,ti)/temp;
rvsig:= (rv+Ref(2*rv,-1)+Ref(2*rv,-2)+Ref(rv,-3))/6;
Cross(rv,rvsig)
Set the Graphic Tab to a Buy Arrow (Green) with Symbol Position and Label Position set to "Below" then click OK. Click New again.
Name: Cross Down Condition: Code:ti:=10;
v1:=((C-O)+(2*Ref(C-O,-1))+(2*Ref(C-O,-2))+Ref(C-O,-3))/6;
v2:=((H-L)+(2*Ref(H-L,-1))+(2*Ref(H-L,-2))+Ref(H-L,-3))/6;
temp:=If(Sum(v2,ti)=0,0.0001,Sum(v2,ti));
rv:=Sum(v1,ti)/temp;
rvsig:= (rv+Ref(2*rv,-1)+Ref(2*rv,-2)+Ref(rv,-3))/6;
Cross(rvsig,rv)
Set the Graphic Tab to a Sell Arrow (Red) with Symbol Position and Label Position set to "Above" then click OK. Open the Expert Advisor, locate your new Expert and Attach it to the chart.
|