PureBytes Links
Trading Reference Links
|
Hi Alan
Sorry it's taken so long to look at your problem. My first reply to
this post seems to have gon missing so I'll try again from the
webpage
> While trawling the web looking for help with my BarsSince()
problem,
> I saw your ancient post at:
>
> http://www.purebytes.com/archives/metastock/2003/msg05324.html
>
> (How did it get there?)
I guess I posted it.
> I notice you use BarsSince() in your code below, but you have to
kick
> start it with "Init". Do I need to do the same thing?
Not in this case.
The main problem with your code is one of logic. You have two
conditions to meet and the first is
exclusive of the second. Take line {4}. If Buy is true then BarsSice
(Buy) must be zero.
BarsSince(Sell) is never going to be less than ZERO so when the
first condition is true the second
condition is never going to be true
{4}If((Buy AND (BarsSince(Buy)>BarsSince(Sell))),1,0);
You can change the code around to
If((Buy AND (BarsSince(Buy)<BarsSince(Sell))),1,0);
but then I think the first condition is redundant. Save yourself
some space and write the code like
this..
BarsSince(Buy)<BarsSince(Sell); {and}
(BarsSince(Sell)<BarsSince(Buy))*-1;
Generally you should stick with "<" rather than ">" when using this
as a latching function.Otherwise
the polarity of your result is inverted (result is FALSE when it
should be TRUE).
Since I'm not quite sure what you're aiming for as a final result
you should consider my comments
only in regard to coding practice and not as a recommendation to
create any specific result.
Regards
Roy
--- In equismetastock@xxxxxxxxxxxxxxx, "Alan Davidson"
<alan_davidson22@xxxx> wrote:
> Hi Roy,
>
> While trawling the web looking for help with my BarsSince()
problem,
> I saw your ancient post at:
>
> http://www.purebytes.com/archives/metastock/2003/msg05324.html
>
> (How did it get there?)
>
> I notice you use BarsSince() in your code below, but you have to
kick
> start it with "Init". Do I need to do the same thing?
>
> Regards,
> Alan
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/BefplB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|