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

On 2/6/2010 5:06 PM, [email protected] wrote:

Have you checked out the Select statement

Best Regards
Rick Osborn

--- On *Sat, 2/6/10, Thomas Z. /<[email protected]>/* wrote:


    From: Thomas Z. <[email protected]>
    Subject: Re: [amibroker] nested IIF statement, can this be refined?
    To: [email protected]
    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 <http://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






Reply via email to