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

[amibroker] Re: Is it possible to backtest this in Amibroker?



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> Hi,
> 
> If you are only allowed to have 3 open positions, then set max number 
> of positions to 3 in the AA window settings and simply write your 
> code to set PositionScore to the % change. AmiBroker will do the rest.
> 
> If, however, you are allowed to hold many positions, but only want to 
> take on a max of 3 *new* postions each day, then Message #114739 may 
> be helpful.
> http://finance.groups.yahoo.com/group/amibroker/message/114739?
> threaded=1&l=1
> 
> - Store the % change as the PositionScore then follow the rest of the 
> code provided. 
> 
> - If you do not have a fixed number of open positions that you are 
> allowed to carry, then replace in the custom backtester logic the 
> line:
> 
>   posScores = IIF(minPos, Foreign("~Position" + minPos, "X", 0), 
> 9999); // Highest possible score!
> 
> with:
> 
>   posScores = Foreign(~Position3, "X", 0); // Top 3 scores
> 
> You can read the rest of the thread to see how Tomasz solved the same 
> issue by changing the strategy logic and avoiding having to save the 
> sorted position scores in composites.
> 
> The code I first posted is generic and does not require changing any 
> strategy logic, but it is much less efficient than Tomasz's. Note, 
> the code will take on more than 3 positions if there are ties. To 
> restrict it to only 3 (even if multiple signals are tied for 1st, 
> 2nd, or 3rd place), then add a counter in the signal loop, 
> incrementing whenever you accept a signal, and stop taking positions 
> (i.e. set sig.PosSize = 0) once your counter gets to 3.
> 
> Mike
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "tradinghumble" <sharp2be@> 
> wrote:
> >
> > I have simple system that generate some signals and I believe I can
> > code it in AB, but then I'd like to choose only the top 3 stocks 
> with
> > the largest % increase in a certain group of stocks (which had the
> > signal).... something like
> > 
> > 1st Step:
> > Select stocks from a list (example: SP500) that have have for 
> example
> > MACD+
> > 
> > 2nd Step:
> > From the list of stocks that have the signal on step #1, I'd like to
> > select the top 3 stocks with the biggest % change in the day...
> > 
> > Again, I can code step two but not sure how to go about step # 2? 
> > 
> > Can anyone help by pointing to an example or giving some ideas? 
> Thank
> > you so much.
> >
>

Wow, that's a lot to digest for a simple coder like me :-) -- thanks
Mike .. one other thing, I'd like my system to take only two positions
per day (as it's an EOD system), any way to limit it as well?

Thanks again.


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

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
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/