I had reached the same conclusion, that i would need to use the CBI to work around this, but I'm very happy to have avoided it.
This problem only happens if you are managing your stops manually -- here is how you can fake it so it thinks you are using applystop(), and it solves this problem. Its in the notes at the bottom of the link. Now, my bigger problem is a system I have been using and had backtested over 10 years no longer performs adequately after making this change. :-/ ------- http://www.amibroker.com/guide/afl/afl_view.php?id=20 Graham Kavanagh gkavanagh [at] e-wire.net.au 2004-09-30 21:55:42 from equity comments Depending on kind of the stop various values are written back to sell/cover array to enable you to distinguish if given signal was generated by regular rule or by stop. 1 - regular exit 2 - max. loss 3 - profit target 4 - trailing 5 - n-bar stop 6 - ruin stop --- In [email protected], "sdkingman" <markh...@...> wrote: > > Interesting. I could not find anything in the user guide saying that you can > set sell/cover signal to 4 or other value to affect the way stops behave. > (The only thing I found was in Equity() function, sell/cover arrays would be > filled with some number to indicate what kind of exit has taken place) > > To handle the complex situation you described, I think that low level CBT > would be the right way to go. > > --- In [email protected], "Brandon_Ridenour" <brandon_ridenour@> > wrote: > > > > I may have found a solution to this. When I manually set the sell/cover > > signal, I am now setting it to a value of '4', rather than '1'. When > > setting it this way, ActivateStopsImmediately seems to apply properly. > > > > Basically, this fakes out as if I were using the ApplyStops function (i > > think) > > > > > > --- In [email protected], "Brandon_Ridenour" <brandon_ridenour@> > > wrote: > > > > > > > > > I noticed this additional note: > > > > > > "a) (if you want to have stops executed AFTER regular signals, so cash > > > from stopped out positions is NOT available to enter trades the same day) > > > ActivateStopsImmediately turned ON " > > > > > > > > > It seems to suggest that ActivateStopsImmediately addresses this issue of > > > making sure the freed up equity is not made available the same day. > > > > > > > > > In my case, because I have custom stop logic and am not using the > > > ApplyStops function, I am using regular Sell/Cover signals to close > > > positions. I set tradedelays(1,0,1,0). > > > > > > If I understand the logic correctly, the backtester is improperly using > > > my capital in this scenario, and because my stop logic is custom, > > > activatestopsimmediately is not effective. > > > > > > Is there any way to prevent this issue from occurring? > > > > > > Thanks > > > > > > --- In [email protected], "sfclimbers" <sfclimbers@> 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 [email protected], "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 [email protected], "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 > > > > > > > > > > > > > > > > > > > > >
