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

[amibroker] Re: Position Opened When No Funds Available



PureBytes Links

Trading Reference Links

Mike,

Thanks for your reply.  I checked the info and i believe scenario 1 fits my system, but the proscribed settings didn't seem to fix it.


The one thing  to note is that I have my own custom stop logic using a for loop, so i'm not using the applystop function.

My trade entries are working properly, executing on the open of the next day (after the signal).  My trade exits are working properly, exiting on the day the stops are triggered at the stop price.

The only problem I'm having is that the following statement:

PositionSize = -25;

Isnt calculating proplery under a specific scenario.  Here is how the scenario should work:

Day 1 -- (EOD) Open Trade Signal Generated, but available portfolio equity is zero
Day 2 -- (at Open)  Open Trade signal not executed at market open due to insufficient funds


Here is what is actually happening under a specific scenario:

Day 1 -- (EOD) Open Trade Signal Generated, but available portfolio equity is zero
Day 2 -- (at Open) Open Trade signal executed at market open, even though there are no funds available
Day 2 -- (mid-day)  Different portfolio position is exited due to violated stop (freeing up some portfolio equity)


In this scenario, it seems like the backtester is using funds that are not yet available to open the position at market open, even though the funds won't be available for several hours.

The timing of the entries and exits are working fine, its this single scenario that is a problem.

Thanks for your help!



Day 2 (Market Open) --  Trade should be taken

--- In amibroker@xxxxxxxxxxxxxxx, "sfclimbers" <sfclimbers@xxx> wrote:
>
> Read the notes provided for ActiveStops and see if you recognized your strategy.
> 
> http://www.amibroker.com/guide/afl/afl_view.php?id=20
> 
> You may find that changing the setting (from AA window) for 
> 
> ActivateStopsImmediately will fix your problem.
> 
> Mike
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Brandon_Ridenour" <brandon_ridenour@> wrote:
> >
> > 
> > By the way, i have trade delays for Buy and Short set to 1, meaning it buys on the morning after the signal is generated.  I just need it to use the available balance from either the day the signal was generated, or at the exact market open.  It seems to be calculating available funds/balance based on the close of the next day.
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Brandon_Ridenour" <brandon_ridenour@> wrote:
> > >
> > > Hi,
> > > 
> > > I have a system that opens positions only at the market open of a trading day.  At market open, it should calculate the position size based on the funds currently available at that time.
> > > 
> > > Today there was a signal at market open but no funds available.  Later during the day, a trailing stop was hit on one of my open positions, causing that position to be closed.
> > > 
> > > Tonight when I updated all quotes and ran the backtest, Amibroker shows the position from market open being opened, even there are no funds available.  I can only assume that it believes funds were available because of the position which was exited later in the day.
> > > 
> > > Obviously, the system should not be able to use funds which have not actually come available yet.  How can I ensure that it will only open positions if the funds are available at market open?
> > > 
> > > Thanks,
> > > Brandon
> > >
> >
>




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

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