Welcome Guest! To enable all features please Login or Register.

Error

 Previous Topic Next Topic
 mutkan #1 Posted : Monday, December 14, 2015 4:55:59 PM(UTC) Rank: NewbieGroups: Registered Users, Subscribers, Unverified UsersJoined: 12/14/2015(UTC)Posts: 6Thanks: 1 times Hi,   I am having trouble in getting rid of PREV. Can you help out advising another formula to replace PREV.   ma1:=Mov(ROC(C,1,\$)*V,14,S); ma2:=Mov(ROC(C,1,\$)*V,28,S); bset:=Cross(ma1,ma2); sset:=Cross(ma2,ma1) AND Max(ma1,ma2)<0; setup:=If(bset,1, If(sset,-1,PREV)); xs:=Cross(C,ValueWhen(1,bset,H)) AND setup=1; es:=Cross(ValueWhen(1,sset,L),C) AND BarsSince(sset)<=20 AND setup=-1; trade:=If(es,1,If(xs,0,PREV)); Cross(trade=1,0.5)
 Wanna join the discussion?! Login to your Discussions forum accountor Register a new forum account.
 mstt #2 Posted : Monday, December 14, 2015 8:45:04 PM(UTC) Rank: Advanced MemberGroups: Registered, Registered Users, SubscribersJoined: 7/25/2005(UTC)Posts: 1,042Was thanked: 57 time(s) in 54 post(s) Hi mutkan This modified code will miss the first signal but all other signals agree with the code you include. The offset lines of setup and trade have been changed and now use ValueWhen() rather than PREV. It's possible to include the first (missing) signal bit it requires the the use of what I call the "I" or "Initialize" variable to allow the first signal to be recognized.What the I variable does is mark the bar when two (or more if used) inputs (both or all) generate a valid rather than N/A signal. An I variable prevents an active signal from being masked by an N/A plot elsewhere in your code. I can give examples, but not right now. Write to me at rlarsen@quik.co.nz if you need more information. I notice that this code is only generating entry signals, and not any exit signals, so i suspect what you've posted is not the complete original formula.. ma1:=Mov(ROC(C,1,\$)*V,14,S); ma2:=Mov(ROC(C,1,\$)*V,28,S); bset:=Cross(ma1,ma2); sset:=Cross(ma2,ma1) AND Max(ma1,ma2)<0; setup:=ValueWhen(1,bset OR sset,bset-sset); xs:=Cross(C,ValueWhen(1,bset,H)) AND setup=1; es:=Cross(ValueWhen(1,sset,L),C) AND BarsSince(sset)<=20 AND setup=-1; trade:=ValueWhen(1,es OR xs,If(es,1,0)); Cross(trade=1,0.5); Roy
 musician #3 Posted : Thursday, December 17, 2015 2:19:24 PM(UTC) Rank: NewbieGroups: Registered Users, SubscribersJoined: 12/17/2015(UTC)Posts: 1 Hi Guys, I have a similir problem like mutkan. Please see my codes below, i neen to eliminate all of the PREVs. İ would be grateful to anyone can help me about it. A1:=Mov( C,7,E) ; A2:=If(A1*0.9>PREV,A1*0.9,If(A1*0.95