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

[amibroker] Re: backtester: how to close all positions at end of day



PureBytes Links

Trading Reference Links

Hi,
you can detect the timeframe you are currently using and then close the position accordingly.

E.g. if you are using a 1 minute timeframe, you can close at 15:59, with a 5 minute, 15:55, 10 minute, 15:50 etc...

The code should look something like:
if (interval() == 60) {sell=timenum()==155900;}
if (interval() == 300) {sell=timenum()==155500;}

...and so on....

refer to the helpfile for the interval values.

hope it helps!


 
--- In amibroker@xxxxxxxxxxxxxxx, "shakerlr" <ljr500@xxx> wrote:
>
> I'm using the backtester (and getting used it it), and would like to close all my positions at the end of the day (between 3:50-3:55).  Currently I do it like this in the backtester: 
> 
> Sell = (Cross(Graph0,C) AND Cross(graph1,c))
> 	OR TimeNum() >= 155000;
> 
> But if I use a timeframe higher than than 1,5,10 minutes, it does not get triggered because the bar is not created yet...and I end up closing the position on the next day.  Is there anyway to say I want all positioins closed at 1500-1600 hours?
>




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

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