mac_bosh: Thank you very much, that did the trick for getting the correct
values.
I am now battling with preventing the stop widening - in TradeStation 2000i it
is coded as:
IF (averagePrice >= averagePrice[1 day ago] AND
averagePrice[1 day ago] >= averagePrice[2 days ago] AND
buystop < buystop [ 1day day ago]
THEN
buystop = buystop[1 day ago];
I translated it as:
notWideningBuyStop = IIf(averagePrice >= Ref(averagePrice, -1) &&
Ref(averagePrice,-1) >= Ref(averagePrice,-2), Ref(Buystop,-1), Buystop);
However I am still seeing the stop widening and wonder what I am doing wrong.
Further in TradeStation the sell and buy stops are plotted as seperate stops
(large dots) but I can only display small dots on a line. Is it perhaps best to
plot this as a staircase? (another part that I need to attack).
Many tahnks in advance, Marinus
--- In [email protected], "mac_bosh" <m...@...> wrote:
>
> Hi,
>
> Something like this ...
>
> initialBuyStop =
> iif(averagePrice > Ref(averagePrice, -1)
> && Ref(averagePrice,-1) < Ref(averagePrice,-2), LOW - fixValue,
> initialBuyStop);
>
>
> finalBuyStop = iif(fixValue < LOW - initialBuyStop, LOW - fixValue,
> initialBuyStop);
>
> Cheers
>
> --- In [email protected], "loewensteijn@" <zl2ml@> wrote:
> >
> > Hello, I am relative new to Amibroker and am trying to migrate some stuff
> > from TradeStation to AB.
> >
> > The IIF statement has me in tangles and I would appreciate if someone can
> > help me translate the following two statements:
> >
> > TradeStation code:
> > first one:
> >
> > IF ( averagePrice > averagePrice[1 day ago] AND
> > averagePrice[1 day ago] < averagePrice[2 days ago] )
> > THEN
> > initialBuyStop = LOW - fixValue;
> >
> > and the second one:
> >
> > IF fixValue < ( LOW - initialBuyStop )
> > THEN
> > finalBuyStop = ( LOW - fixValue )
> > ELSE
> > finalBuyStop = initialBuyStop;
> >
> >
> > Many thanks in advance,
> > Marinus
> >
>