Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 6/12/2007(UTC) Posts: 32
|
When there is an up trend I want to find the price at UB for each price bar and when there is a down trend the price at LB for each price bar? How would I go about this?
{Global Varaible which define the trend}
GBSetup:=(ExtFml("Gvf.GetVar","GBSetup"));
{Band Parmaters}
x:=7; y:=5/100;
STMA:=Mov(C,x,E); UB:=Mov(C,x,S)*(1+y); LB:=Mov(C,x,S)*(1-y);
{Latch
where GBsetup=2 is up trend & GBsetup=1 is down trend }
Exit:=If(GBsetup=2,2,If(GBsetup=1,1, PREV)); Exit;
Gregor
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/29/2004(UTC) Posts: 1,394 Location: Glastonbury, CT
Was thanked: 2 time(s) in 2 post(s)
|
Gregor, you haven't defined what is an uptrend and what is a downtrend? if(uptrend,1,If (downtrend,-1,0)); this will plot +1,-1, or 0 x:=7; y:=5/100;
STMA:=Mov(C,x,E); UB:=Mov(C,x,S)*(1+y); LB:=Mov(C,x,S)*(1-y); if(uptrend,UB,If (downtrend,LB,0)); this will plot UB value,LB value, or 0
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 6/12/2007(UTC) Posts: 32
|
hi Henry
Thanks for your responce.
The problem with my latch is finding the prices of UB or LB at zero, when indicator show zero it will only show the last price until there is a new trend signal. What am looking for is when theres a uptrend then find the prices for UB including those at zero until there is a down trend then find the prices for LB including those at zero until there is a uptrend.
The uptrend and down trend is defined in another formula that I am bring through the global varialbe GBSetup:= (ExtFml("Gvf.GetVar","GBSetup")); This means GBSetup=2 is a up trend and GBSetup=1 is a down trend
Gregor
|
|
|
|
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.