Louis,

How much AFL coding have you done?

As I stated I am still new at this.

Do you understand the error message that AFL gives you?

I realize that you too are learning, but when I put the code into the AFL editor and do the syntax checking, I see and "understand" the error message.

What I don't know is how to fix it in your situation. As this is the situation that you want to use, I think you need to learn what the error is and how to fix it for yourself.

In programming terms, the "arnotrade" is an array, and the "if" statement does not work on an Entire array. It will only work on an Element from the array. So you either need to access an element from the array, or use a different programming method to control the Buy and Sell Actions.

As I am still learning AFL as well, I am trying to do that for the code I am trying to develop. Sorry I can't be of more help.

Louis P. wrote:
Hi,

Thank you for your response. I will try to work a way with testing buying/selling conditions, but what about the error == and =?

Thanks,

Louis

2008/8/2 Snoopy <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>

    Louis,

As I said, I am new to AB as well.
    I do have some programming experience, and have worked with a
    different Technical Analysis software for several years.  I am
    still trying to wrap my head around some of the programming
    concepts in AB and how they differ from my previous TA software
    programming.

    I have NO idea how to ACT on Buy or Sell Signals.  I have not even
    made it to the point of plotting them for myself yet in AB.

    Most of my Analysis work is visual, but I am hoping to also
    develop some more mechanical trading programs.  I have switched to
    AB due to the more robust programming environment, current
    technology, and the developer's willingness to work with users and
    implement their ideas.

    I find it refreshing and encouraging that one of my questions to
    support has been included as an improvement to the code in the
    newest beta software release.

So, in answer to your question, I am not the guy that can help. You will need to KNOW what you would want to put into those
    sections of the IF statements.  The first one might be blank, as
    you have already calculated the Signal.  The second section would
    be to issue your buy or sell command.  What and How you want to do
    that are really up to you.  AFL gives you the flexibility to do
    just about anything you want.

    Good Luck.



    Louis P. wrote:
    Hi,

    I got an error message on this particular line, saying that the
    condition has to be numeric or boolean.  This is why I replaced
== by =.
    Here is what I have as a code:

    arsignal = IIf( C>MA (C,20), 1,0);
    arnotrade = IIf(HHV(arsignal,5)==1, 1, 0);
    if (arnotrade==1)
    {
    //don't ACT on Buy/Sell Signals
    // probably still want to calculate them
    }
    else
    {
    // code here for ACTING on your Buy/Sell signals
    }

    I'm still not sure what to write on the two particular line.
    Could you please give me an example?

    Thanks,

    Louis


    2008/8/1 Snoopy <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>

        Louis,

        It looks like you have:   if(arnotrade=1)

        It should be:    if(arnotrade==1)

        The first one does an Assignment.  The second one does a Test
        for equality;

        Also, it would be more helpful if you said what/how it didn't
        work.  Since I don't know what your error is, I am just
        guessing that it NEVER trades since you ASSIGN the no trade
        zone value, and it will then process the first section to
        "Don't Act on Buy/Sell signals".

        Blair




        Louis P. wrote:
        Hi Blair,

Thanks for your response!
        For Problem 1, Mike gave me a simplier solution and it works
        fine.

        For Problem 2, I used your code.  Here is what I wrote:

        achat=Buying condition (e.g.  C>Ma (c,20);
        arsignal = IIf(achat, 1,0);
        arnotrade = IIf(HHV(arsignal,5)==1, 1, 0);
        if (arnotrade=1)
        {

        //Sell =C< Ref (LLV (C,1),-1);
        Sell=0;
        //don't ACT on Buy/Sell Signals
        // probably still want to calculate them
        }
        else
        {

        Sell =C< Ref (LLV (C,1),-1);
        // code here for ACTING on your Buy/Sell signals
        }

        I used lowest value of 1 day only to test, but
        unfortuntately it does not work...  Should have an easiest way?!

        Thanks!

        Louis



        2008/7/30 Blair <[EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>>

            Louis,

            I am new to AB, but hopefully this can help out...

            First:
            Create an array for the period that you want to plotshapes.
            Have your code assign the value to the array.
            Have your code check for the value using ref(arrayname,-1).

            Sample code:
            arplot = iif(somecondition,1,0);
            plotcondition = ref(arplot,-1);
            if (plotcondition==1)
            plotshape(....).;

            Second:
            Similar to above, use an array and check if you have a
            signal within
            last x(5) periods.

            Sample code:
            arsignal = iif(yourbuyorsellsignalcondition, 1,0);
            arnotrade = iif(HHV(arsignal,5)==1, 1, 0);
            if (arnotrade==1)
            {
            //don't ACT on Buy/Sell Signals
            // probably still want to calculate them
            }
            else
            {
            // code here for ACTING on your Buy/Sell signals
            }

            I hope this is helpful for you.

            Blair



            --- In [email protected]
            <mailto:amibroker%40yahoogroups.com>, "Louis P."
            <[EMAIL PROTECTED]> wrote:
            >
            > Hi,
            >
            > I have* two* easy questions, if anyone can help me.
            >
            > *First*, I'd like to draw plotshapes not on the period
            the signal
            was issued
            > but on the period after the signal was issued. How can
            that be done?
            >
            > *Then*, (I asked this question already on the web site
            of the group,
            but for
            > some reason I didn't receive it in my mailbox so maybe
            there is a
            problem.
            > If you already received this question, please discard
            this one), I
            wonder
            > how to create a no-trade zone:
            >
            > I know how to do an automatic "sell after X period":
            >
            > Buy = c>ma (c,20);
            > Buy = Exremspan (Buy,5);
            > Sell = Ref (Buy,-5);
            >
            > I'd like to set a trade system that would begin to
            look for signals
            AFTER
            > that "no-trade" zone.
            >
            > E.g. In the example above, I'd like the system to do
            nothing for the
            first 5
            > bars after my entry and then, and only then, check for
            an exit
            signal. How
            > would you do that?
            >
            > Thanks a lot, and sorry if you received question 2 twice!
            > Louis
            >



-- *Snoopy *
        "Still trying to shoot down that Red Baron"



-- *Snoopy *
    "Still trying to shoot down that Red Baron"



--
*Snoopy *
"Still trying to shoot down that Red Baron"

Reply via email to