[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EquisMetaStock Group] How do I stop an indicator repeating itself?



PureBytes Links

Trading Reference Links

Hi Notharold


The leading edge of a signal (rising from zero to one) can defined a number of ways. Here are just some examples.

Signal=TRUE and Ref(Signal,-1)=FALSE;

Signal=1 and Ref(Signal,-1)=0;

Signal and Ref(Signal,-1)=0;

Signal * (Ref(Signal,-1)=0);

Signal AND ValueWhen(2,1,Signal)=0;

Signal AND Alert(Signal=0,2);

Signal * Alert(Signal=0,2);

I suggest that you DO NOT use the Ref() function for this purpose, even though it may seem like the best choice. It isn't. Delaying a signal with Ref() generates one or more N/A (invalid) results for all subsequent variables using that delayed term. ValueWhen() is better choice for generating a delay if limiting N/A bars is an objective.

The Alert() function is the most appropriate function (see above) for defining a leading edge. It can also be used to define a trailing edge.

Signal=0 AND Alert(Signal,2);

Don't confuse the "trailing edge" with the "last TRUE bar" of a signal - it's actually one bar after the last true bar. The last bar of a logical signal can be defined with

Zig(Signal,1,$); or

Zig(Signal,1,%);

If you want to hold the leading edge signal true for a number of bars you might use the Alert() function again. Just be aware that the Alert() function retriggers each time its sees TRUE. This is where a PREV-based formula such as the one posted by Jose has an advantage - it can be constructed to ignore new signals until the timed TRUE has expired.


Regards

Roy
www.metastocktips.co.nz






 
----- Original Message ----- 
From: notharold 
To: equismetastock@xxxxxxxxxxxxxxx 
Sent: Wednesday, March 29, 2006 10:24 PM
Subject: [EquisMetaStock Group] How do I stop an indicator repeating itself?


I have a number of indicators which egual 1 when the condition is met 
and O when it is not. Is there an easy way of coding so that if the 
indicator has been positive in the last n periods it will not show as 
positive again?  I've got myself into a complete muddle with nested if 
statements....










SPONSORED LINKS Business finance course  Business to business finance  Small business finance  
      Business finance consultant  Business finance magazine  Business finance schools  


--------------------------------------------------------------------------------
YAHOO! GROUPS LINKS 

  a..  Visit your group "equismetastock" on the web.
    
  b..  To unsubscribe from this group, send an email to:
   equismetastock-unsubscribe@xxxxxxxxxxxxxxx
    
  c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


--------------------------------------------------------------------------------



[Non-text portions of this message have been removed]



 
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/