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

RE: [EquisMetaStock Group] Re: How many IF() functions can I nest in a custom indicator??



PureBytes Links

Trading Reference Links

Title: Message
Thanks for the tip.
 
Some good ideas there that certainly save the IF statements.
 
Regards,
Mike
 
-----Original Message-----
From: MG Ferreira [mailto:quant@xxxxxxxxxxxxxxxx]
Sent: Wednesday, 2 March 2005 8:20 AM
To: equismetastock@xxxxxxxxxxxxxxx
Subject: [EquisMetaStock Group] Re: How many IF() functions can I nest in a custom indicator??



I have no idea!  But, if you are working with a complex lot of IF
statements (also true for spreadsheets) it is often better to use
boolean algebra in the following way:

( CLOSE > 10 ) * 1 - ( CLOSE <= 10 ) * 1

This will plot a 1 if the close is above and a -1 if the close is
equal to or below 10.  It sure is a lot easier to handle than many
IF statements.  If you want to plot say a 10 or a 5, change it to

( CLOSE > 10 ) * 10 + ( CLOSE <= 10 ) * 5

If you have a lot of requirements, just keep on multiplying.  Say
the close must be above 10 and below 20, then do

( CLOSE > 10 ) * ( CLOSE < 20 ) * 1

and so on.  You can add, I guess, more of these than of the if stuff.

Regards
MG Ferreira
TsaTsa EOD Programmer and trading model builder
http://tsatsaeod.ferra4models.com
http://www.ferra4models.com




--- In equismetastock@xxxxxxxxxxxxxxx, "Mike Sloane" <mfsloane@xxxx>
wrote:
> I am sure someone out there knows the answer off the top of their head.

> How many IF() functions can I nest in a custom indicator??

> Thanks in advance,
> Mike Sloane








Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links