Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 6/12/2007(UTC) Posts: 32
|
I want to identify any highs, which I call B1, that break the upper band of a channel while ignoring such highs if they move to far above the same upper band. I do this by ignoring B1s that exceed the upper band by more than 75% of the difference between the upper band and the lower band. The code for this is as follows: -
x:=7; y:=1.05;
{Price Channel} UB:= Mov(C,x,S)*y; LB:= Mov(C,x,E); {high above upper band}
B1:= H>UB;
{Calculation signal}
75Rule:= UB+(0.75*(LB-UB));
{B1s that move to far above upper band}
B1Setup:= if(B1>75Rule,1,0);
B1Seup;
The problem is the code I’ve written will identify all B1s regardless of the amount by which they exceed the upper band. I need help in being shown where I’ve gone wrong?
Yours Turly
Gregor
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 7/12/2007(UTC) Posts: 134 Location: Perth Western Australia
|
Hi Gregor,
Re-defining "B1" so that it meets your requirements will solve your problem.
x:=7; y:=1.05;
{Price Channel} UB:= Mov(C,x,S)*y; LB:= Mov(C,x,E); {Acceptable high price break above upper band}
B1:= H>UB AND H<=UB+(0.75*Abs(LB-UB)); B1
A word of caution if I may........when subtracting one value from another where it makes no difference if the result is positive or negative it is easier to use the Absolute function and that way it does not matter if you are deducting the higher value from the lower value (refer to this line of your original code 75Rule:= UB+(0.75*(LB-UB));).
oz
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.