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

Re: [amibroker] nested IIF statement, can this be refined?


  • Date: Sun, 7 Feb 2010 07:46:37 -0800 (PST)
  • From: ricko@xxxxxxxxxx
  • Subject: Re: [amibroker] nested IIF statement, can this be refined?

PureBytes Links

Trading Reference Links




oops yes


Best Regards
Rick Osborn

--- On Sun, 2/7/10, Keith McCombs <kmccombs@xxxxxxxxxxxx> wrote:

From: Keith McCombs <kmccombs@xxxxxxxxxxxx>
Subject: Re: [amibroker] nested IIF statement, can this be refined?
To: amibroker@xxxxxxxxxxxxxxx
Cc: ricko@xxxxxxxxxx
Date: Sunday, February 7, 2010, 4:20 AM

 

I don't know what the Select statement is.  Do you mean Switch()?

On 2/6/2010 5:06 PM, ricko@xxxxxxx com wrote:

 

Have you checked out the Select statement

Best Regards
Rick Osborn

--- On Sat, 2/6/10, Thomas Z. <tzg@xxxxxxxxxxxxxxx .com> wrote:

From: Thomas Z. <tzg@xxxxxxxxxxxxxxx .com>
Subject: Re: [amibroker] nested IIF statement, can this be refined?
To: amibroker@xxxxxxxxx ps.com
Date: Saturday, February 6, 2010, 7:40 PM

 

Hello,

I don't know what you use for your variables: DnPenSum and DnPenCount, therefore i wrote the code below with dummy values.
Probably it does what you are trying to do. It searches at every bar for DnPenSum[j] / DnPenCount[j] > 0 and checks all the previous bars until it finds one or the first bar is reached. Thereafter it starts with the next bar.

DnPenSum = C;
DnPenCount = L;
result = Null;

for (i = 0; i < BarCount - 1; i++)
{
    for (j = i; j > 0; j--)
    {
        if (DnPenSum[j] / DnPenCount[j] > 0)
        {
            result[i] = DnPenSum[j] / DnPenCount[j] ;
            break;
        }
    }
}

// Plot(C, "C", colorGreen, 128);
Plot(result, "Result", colorRed, 1);

Best regards, Thomas
www.PatternExplorer .com

Am 06.02.2010 16:47, schrieb cawalton111:
Hi all,

I have the following nested IIF statement but I suspect it is a clumsy beginners effort and would like to know if this can be parred down and perhaps extended beyond the 11 periods it covers, Thanks, Cliff

AvgDnPen=IIf( (DnPenSum/ DnPenCount > 0),DnPenSum/ DnPenCount,
IIf(Ref(DnPenSum/ DnPenCount, -1)> 0,Ref(DnPenSum/ DnPenCount, -1),
IIf(Ref(DnPenSum/ DnPenCount, -2)> 0,Ref(DnPenSum/ DnPenCount, -2),
IIf(Ref(DnPenSum/ DnPenCount, -3)> 0,Ref(DnPenSum/ DnPenCount, -3),
IIf(Ref(DnPenSum/ DnPenCount, -4)> 0,Ref(DnPenSum/ DnPenCount, -4),
IIf(Ref(DnPenSum/ DnPenCount, -5)> 0,Ref(DnPenSum/ DnPenCount, -5),
IIf(Ref(DnPenSum/ DnPenCount, -6)> 0,Ref(DnPenSum/ DnPenCount, -6),
IIf(Ref(DnPenSum/ DnPenCount, -7)> 0,Ref(DnPenSum/ DnPenCount, -7),
IIf(Ref(DnPenSum/ DnPenCount, -8)> 0,Ref(DnPenSum/ DnPenCount, -8),
IIf(Ref(DnPenSum/ DnPenCount, -9)> 0,Ref(DnPenSum/ DnPenCount,
-9),
IIf(Ref(DnPenSum/ DnPenCount, -10)> 0,Ref(DnPenSum/ DnPenCount, -10),
Ref(DnPenSum/ DnPenCount, -11)))))) ))))));


PS its related to the Elder SafeZone stop calc's.



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

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroke r.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroke
r.com/devlog/


Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups. yahoo.com/ group/amibroker/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups. yahoo.com/ group/amibroker/ join
(Yahoo! ID required)

<*> To change settings via email:
amibroker-digest@ yahoogroups. com
amibroker-fullfeatu red@xxxxxxxxxxxx com

<*> To unsubscribe from this group, send an email to:
amibroker-unsubscri be@xxxxxxxxxxxx com

<*> Your use of Yahoo! Groups is subject to:
http://docs. yahoo.com/ info/terms/




__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___