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

[amibroker] Re: Actual trade bar



PureBytes Links

Trading Reference Links

Mike,
Thanks, I'll have a go at it. I have managed to avoid using the customer backtester up till now but I guess it is time well spent learning it.
Cheers,
/Fredrik

--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> You can get the bar index of the trade by using ValueWhen and the trade's entry date as follows (from within custom backtester code):
> 
>     bars = BarIndex(); 
>     dates = DateTime();
>     bo = GetBacktesterObject();
> 
>     ...
> 
>     for ( trade = bo.getFirstOpenPos(); trade; trade = bo.getNextOpenPos() ) 
>     { 
>         entryBar = LastValue( ValueWhen( trade.EntryDateTime == dates, bars ) ); 
> 
>      ...
> 
> There may be a better way of handling your stop loss, but the above should should at least answer your question.
> 
> Mike
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "broman1003" <fredrik_broman1003@> wrote:
> >
> > Hi,
> > I would like to get hold of the bar where a trade was entered when backtesting.
> > The reason I need it is that I would like to implement a trailing SL that is depending on the highest value the price has hit since the trade was initiated.
> > 
> > All hints are appreciated.
> > Thanks,
> > /Fredrik
> >
>




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

**** 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:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto: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/