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

[amibroker] Please, more help sought... Re: Newby question - coding help sought.



PureBytes Links

Trading Reference Links

You are missing a clause in your translation for the Trade Station part: AND buystop < buystop [ 1day day ago]

Also, rather than recalculating the offset array each time, it is better to store the value in an intermediate variable and only do the calculation once.

e.g.

avgPrice1DayAgo = Ref(averagePrice, -1);
notWideningBuyStop = IIf(averagePrice >= avgPrice1DayAgo && ...)

For plotting, you can use a number of pre-defined shapes in conjunction with the PlotShapes function. There are a number of posts in the User's Knowledge Base on this:

http://www.amibroker.org/userkb/?s=plotshapes

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "loewensteijn@xxx" <zl2ml@xxx> wrote:
>
> 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 amibroker@xxxxxxxxxxxxxxx, "mac_bosh" <mac@> 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 amibroker@xxxxxxxxxxxxxxx, "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
> > >
> >
>




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

**** 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/

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@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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