PureBytes Links
Trading Reference Links
|
Mike
There are several methods to handle this issue. You may use VB or
Java scripting. There are several examples of the Ami
Library. You also have built-in AMA and AMA2 functions which allow
you to do this. Tomasz has addressed this issue multiple times in the
past. Go to the main web site of this message board and do a search
on PREV function to get the many questions/answers concerning this
issue. In some ways PREV is very wasteful in resources
and very slow. Actually it is just not a very smart approach
to the programming problem that PREV attempts to solve. But it is
the Metastock way.
Steve
At 12:15 AM 4/23/2002 +0000, you wrote:
Tomasz,
You mean that I cannot use REF() function to get a previous element
of an ARRAY mentioned later in the code?
So in AFL there is no way to use a previous value of a variable to
define its new value? What a disappointment. Is there any
workaround?
Thanks,
Mike
--- In amibroker@xxxx, "Tomasz Janeczko"
wrote:
> Mike,
>
> No, AFL operates on entire arrays and it uses only single-pass to
process all bars.
> So if you assign a value later in your code it will have no effect
on any lines that appeared
> before.
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "mik954"
> To:
> Sent: Monday, April 22, 2002 6:13 PM
> Subject: [amibroker] Declare variable for future use (was TJ:
Actual trade profit vs. Theoretical)
>
>
> > Hi, all!
> >
> > Well, so far no any response on my initial post (even on direct
e-
> > mail to support@xxxx). It's weird. Maybe my question wasn't
> > clear, or Tomasz was too busy.
> >
> > OK, let me ask in a different way. Is there any way in AFL to
declare
> > variable/array and use its previos value before setting current
one?
> >
> > I mean:
> >
> > // var tradeProfit; // declare variable for future use
> >
> > Buy = longEntry and ValueWhen(Sell, tradeProfit) < 0;
> > Sell = LongExit;
> >
> > tradeProfit = ValueWhen(Sell, SellPrice) - ValueWhen(Buy,
BuyPrice);
> >
> >
> > Any suggestions are welcome.
> >
> > Thanks,
> > Mike
> >
> >
|