This is what I had in mind Kevin. If the two plots
have different colors then the original (second) plot will cover the exception
plot on all but the crossover bars. The first plot delays the relevant
MA on crossover bars but not others. Not sure if this is what you are looking
for.
HLd:=If(CLOSE>Ref(Mov(H,3,S),-1), {then}1, {else}If(CLOSE<Ref(Mov(L,3,S),-1), {then}-1, {else}0)); HLv:=ValueWhen(1,HLd<>0,HLd); HiLo:=If(HLv=-1, {then}Mov(H,3,S), {else}Mov(L,3,S)); break:=Cross(hlv,0)-Cross(0,hlv); If(break=1,Ref(Mov(H,3,S),-1),If(break=-1,Ref(Mov(L,3,S),-1),hilo)); HiLo;
Roy
----- Original Message -----
Sent: Sunday, February 15, 2009 11:40
AM
Subject: Re: [EquisMetaStock Group] Re:
If Then Else Neutral
Sorry, it I missed seeing the original plot from
MC's code as it was masked by third plot. Great minds think
alike?
Roy
----- Original Message -----
Sent: Sunday, February 15, 2009 11:17
AM
Subject: Re: [EquisMetaStock Group] Re:
If Then Else Neutral
Hi Kevin
After looking at MC's code it occurs to me that
a possible visual solution to your problem could be to have
two plots, one as per the original and one where the value from the
point of crossover is held for one bar longer? The delay for the second
plot would only be applied to specified bars, not to the entire plot. I
haven't attempted to code this thought but I'm confident that it wouldn't be
that difficult to do.
Regards
Roy
----- Original Message -----
Sent: Sunday, February 15, 2009 8:20
AM
Subject: Re: [EquisMetaStock Group]
Re: If Then Else Neutral
Hello Preston,
Many thanks for your reply.
Unfortunately,
this formula still doesn't do the trick as it just shifts the original
plot back a bar. The principle is correct when using the Gann HiLo
Activator for intraday trading but for trading daily bars, the plot must
be offset by one bar (according to Gann).
On the bar on which the
trend direction changes, i.e. where the close is above/below the 3MA
high/low, the plots should overlap, i.e. there should be BOTH a Mov(H,3,S)
AND a Mov(L,3,S) plotted, not one or the other, which is the result of
HiLo:=If(HLv=-1,Mov(H,Lb,S),Mov(L,Lb,S)).
The reason
being is that when trading the Gann System, and a long trade is taken on,
say, a close above Mov(H,3,S), the initial stop is a break below
Mov(L,3,S). That is why we need the plots overlapping on that bar. The If
statement as it stands gives us an either/or.
Once again, I really
appreciate your input.
Regards, Kevin
At 05:28 PM
2/14/2009 Saturday, you wrote:
Kevin,
The formula was
originally written back in 1999 and posted on the Guppy site back in
April of 2000. Strange that no one saw the problem until now. Maybe
a result of the bear market.
The formula as posted works
correctly. It plots either a 3MA high or a 3MA low overlaping on the
bar at which the close is greater/less than " YESTERDAY'S " MA.
Notice the use of the ref statement in the first
line...HLd:=If(CLOSE>Ref(Mov(H,3,S),-1) So we are indeed
looking for a close greater that yesterday's MA.
To make the
change you want simply change the formula to:
{Gann HiLo Kevin
Modified} Lb:=Input("Look-Back
Periods?",2,80,3); HLd:=If(CLOSE>Mov(H,Lb,S), {then}1, {else}If(CLOSE<Mov(L,Lb,S), {then}-1, {else}0)); HLv:=ValueWhen(1,HLd<>0,HLd); HiLo:=If(HLv=-1, {then}Mov(H,Lb,S), {else}Mov(L,Lb,S)); HiLo;{end}
Now
you should get a resulting plot of either a 3MA high or 3MA low on
the bar at which the close is greater/less than the "current"
MA.
Preston
--- In equismetastock@yahoogroups.com,
Kevin Barry <kevin_barry@...> wrote: > >
Hello, > > I am in the process of rewriting the Gann Hi-Lo
indicator using as my > starting point the following formula
by Adam Hefner: > >
HLd:=If(CLOSE>Ref(Mov(H,3,S),-1), > {then}1, >
{else}If(CLOSE<Ref(Mov(L,3,S),-1), > {then}-1, >
{else}0)); > HLv:=ValueWhen(1,HLd<>0,HLd); >
HiLo:=If(HLv=-1, > {then}Mov(H,3,S), >
{else}Mov(L,3,S)); > HiLo; > > The resulting
plot is not quite correct because the 3MA high and the 3MA >
low plots should overlap on the bar at which the close is
greater/less than > the current MA. > > The
obvious solution is to create two plots GannHi and GannLo to replace
> the HiLo plot. However, we would need to specify an If
statement without > the ELSE condition. > > We
can't write If(HLv=-1,Mov(H,3,S),0) because it doesn't plot
correctly. > > Any suggestions for creating an
equivalent of IF without the need to > provide an ELSE
parameter? > > Many thanks in advance. > >
Regards, > Kevin >
__________ NOD32 3852 (20090213) Information
__________
This message was checked by NOD32 antivirus
system. http://www.eset.com
__________ NOD32 3853 (20090214) Information
__________
This message was checked by NOD32 antivirus system. http://www.eset.com
__________
NOD32 3853 (20090214) Information __________
This message was checked
by NOD32 antivirus system. http://www.eset.com
__._,_.___
__,_._,___
|