M --
Ok.  Your individual strategies will,
1. share the same equities. I believe sigScaleIn and sigScaleOut can be very useful here.
2.  share the same money pool.  And use setPositionSize().
3. one strategy might be long while another is short. This might require another trick (explained later in step e or even later)).

So, lets start off as simply as we can, one step at a time. I would suggest the following steps, perhaps in this order, and completely debug each step before going on to the next. a) Start with only plots and backtesting. The results are easiest to observe and therefore the easiest to debug.

b) Try some simple experiments with sigScaleIn and sigScaleOut (and long only). Note that you use them only with Buy and (I believe) Short. You don't use them with Sell (Sell sells All), or with Cover (I believe similar to Sell, Cover covers All). BTW, I have written only one strategy using sigScaleIn and sigScaleOut, and that was a long only strategy. I found it useful to keep track in my code of my number of shares held (and therefore my free cash and setPositionSize(number, spsShares) as well), and I would only use Sell when I knew that my trade would reduce the number of shares to zero. Once you get code that you know works, and maybe only after a few steps beyond this one, you might try commenting out that part that keeps track of shares held, to see if you can get along without it.

c) After you're satisfied with b) above, add a second strategy, still long only. Get that working.

d) Now for the short side. Do short only, following steps similar to b) and c) above.

e) Next, long and short together. I don't know if AB can properly handle long and short positions simultaneously in the same stock or contract. That will require a simple experiment on your part. If AB can't, then simply export your symbol of choice, import into a spread sheet or text editor, change the symbol to something unique like symbol_SO, and import back into your data base. Now you have two separate symbols, which we know AB can handle properly.

f)  Add a third strategy.  This should be the easiest step of all.

Maybe alternate trick for using long and short positions simultaneously in same equity: keep track of number of shares held and needed for next trade. For example: Shares held long = 100. Instead of Shorting 100, Sell 100. Or instead of Shorting 200, sell 100 and short 100 on same bar. You may or may not have to do something like this if/when you try to take the system RT.

Hope this helps.
-- Keith

On 7/1/2010 20:43, Matthias wrote:



Thanks Keith for joining this discussing. I don't quite know who you're trying to adress with your question/suggestion.

Assuming you refer to my previous post:

1. Put those three Systems in one afl as you would when autotrading: Each System has its BUY and SELL and SHORT and COVER: I want system1 to refer only and only to its predetermined buy1,sell1,short1,cover1 rules

2. Each System uses ATR positionsizing, obviously not the same "number of contracts traded" due to different timeframes and different system logic

3. FDAX is a futures contract: The systems are intended to share the same equity pool [to be precise: closed equity]

4. All Systems trade this ONE underlying only

5. Each System is allowed to open ONE position at a time, not matter what positions of the remaining systems are open or closed

6. As stated in the text below: Same time longs and shorts of different systems are allowed: E.g. system1(long), system2(short), system3(no-pos)

7. Each system has its own predetermined exits, no matter what the other systems do [edit: in order to NOT complicate things further, I skipped Applystop in the system logic of my example in the previous post]

8. Backtest each system individually is no prob, together with "FDAX1","FDAX2" (faking different underlyings to amibroker)... no prob either

So: The way I understand it currently is: For Ami to autotrade, I need to write the logic of the 3 systems into 1 AFL. Taking all the above mentioned points into consideration: How does one do that?

In that sense you are right: Possibly "Mixing Systems" as a topic is a bit weak in determining what each user wants. My idea was to breakdown this whole topic in 3 main areas:

*Realtime-Trading environment and relating issues
*Backtesting multiple Systems simultaneously in general
*Broken down further in various portfolio and moneymangement techniques: which MM and Portfoilio Management is best for my Trading system basket, individual system ranking (with equity curve, don't know a better metric for the system than equity curve), or also the other topics involved: Walk-Forward Efficiency Ratio (for each individual system), Modern Portfolio Design (here referring to: Multiple Systems logics on different underlying to produce smoothest, risk-adjusted PORTFOLIO equity)

Hope I made myself clearer, but you're right the topic is huge and some of it has been discussed some time ago. The thing that gives me a headache is that I couldn't find a practicle example that would gather together the conclusions out of the discussion. The idea to break this topic down into the 3 parts are a suggestion to make things easier, I'm not sure if it's the best solution due to overlapping. But come on, we shot a rocket to the moon, this little there needs to be possible.

Thanks,

M

--- In [email protected] <mailto:amibroker%40yahoogroups.com>, Keith McCombs <kmcco...@...> wrote:
>
> I've read a number of posts on the thread. And it seems to me that not
> everyone has the same meaning in mind when they are talking about a
> 'MIX' system.
>
> What do you mean by a mix system? I assume that two or more systems are
> supposed to share SOMETHING. Is that SOMETHING,
> 1. The same equities? If so, what do you want to happen if two or more
> systems want to go in different directions, perhaps one holds while
> another sells, or even another shorts? Once you have answered these
> questions, you might find that sigScaleIn and sigScaleOut will help you out.
>
> 2. Available cash? If so, to what extent? If you know, then maybe use
> setPositionSize() and/or PositionScale can help you.
>
> 3. Risk and rewards, but keeping money from profits and losses
> separate? If so, try backtesting separately. Then save ~~~Equity
> results with different names and add them in AB, with buy and hold for each.
>
> 4. Or, maybe something else?
>
> -- Keith
>
> On 7/1/2010 17:29, Matthias wrote:
> >
> > Sorry for the typo in the Backtesting-Paragraph:
> >
> > Should read:
> >
> > match buy1 and sell1 (NOT: buy1 and sell2)
> >
> > --- In [email protected] <mailto:amibroker%40yahoogroups.com> <mailto:amibroker%40yahoogroups.com>,
> > "Matthias" <meridian202@> wrote:
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Hello,
> > >
> > > I am having trouble understanding the same issue. If anyone here has
> > a solution I'd like to read up on it as well. Angelo, I have read
> > literally every discussion in this forum regarding this topic and I
> > understand why your reffering to TJ, and please: Yes, I did read the
> > user manual and yes, I did read custom backtester procedure. I believe
> > that I am not the only one who's facing this. Help appreciated. I'd
> > like to post 3 sample strategies for better understanding (which won't
> > work, btw).
> > >
> > > BASE-TIME: 5min; [ONLY 3 Strategies]
> > >
> > > Setpositionsize(number, spsshares) // number varies depending on
> > which strategy gets the signal
> > > Setoption("maxopenpositions",3) //i.e. every strategy can open 1
> > position at a time which is not reflected in this command
> > >
> > >
> > > ///////////////// MA-Crossover //////////////////
> > >
> > > Ema1=ema(c,10);
> > > Ema2=ema(c,20);
> > >
> > > Buy1=cross(ema1,ema2);
> > > Sell1=cross(ema2,ema1);
> > > Short1=sell1;
> > > Cover1=buy1;
> > >
> > > /////////////// Countertrend /////////////////////////
> > >
> > > BBupperiod1= 20;
> > > BBlowperiod1= 20;
> > > BBupSTD1= 2;
> > > BBlowSTD1= 2;
> > > BBtop1= BBandTop(C,BBupperiod1,BBupSTD1);
> > > BBbot1= BBandBot(C,BBlowperiod1,BBlowSTD1);
> > >
> > > MA1= ma(C,20);
> > >
> > > Buy2= C<bbandbot1;
> > > Sell2= c>ma1;
> > > Short2= C>bbandtop1;
> > > Cover2= C<ma1;
> > >
> > > Buy2= exrem(Buy2,sell2);
> > > Sell2= exrem(sell2, buy2);
> > > Short2= exrem(short2,cover2);
> > > Cover2= exrem(cover2,short2);
> > >
> > > /////////////////////// HH LL //////////////////
> > >
> > > TimeFrameSet(inhourly);
> > >
> > > period1high=20;
> > > period1low=20;
> > >
> > > nhigh=HHV(H,period1high);
> > > nlow=LLV(L,period1low);
> > >
> > > TimeFrameRestore();
> > >
> > > Buy3= timeframeexpand(ndayhigh,inhourly) >
> > timeframeexpand(ref(ndayhigh,-1), inhourly);
> > > Sell3= timeframeexpand(ndaylow,inhourly) <
> > timeframeexpand(ref(ndaylow,-1), inhourly);
> > > Short3=sell3;
> > > Cover3=buy3;
> > >
> > >
> > > REALIME TRADING:
> > >
> > > What do I need to do is to put these 3 into one AFL for real-time
> > trading - that's what people were saying. How do I arrange the code?
> > >
> > > I do not trade a lot of underlyings, but say, this one needs to be
> > run on the FDAX(German bluechip future) and on the FDAX only, allowing
> > shorts and longs at the same time.
> > > I have read up on the
> > >
> > > if ( name=="") idea.
> > >
> > > but I want to realtime trade this on ONE underlying only (Trying to
> > express: I cannot change the name of the underlying in realtime
> > trading, so that amibroker would think it's 3 differnt tickers, even
> > though it's only one)
> > >
> > > Another suggestion was something with static variables, but I didn't
> > grasp the concept.
> > >
> > > Another suggestion was from Keith Mccombs, suggestion one
> > "MASTER-AFL", to control the other afl's.
> > >
> > > #include <afl1>
> > > #include <afl2>
> > >
> > >
> > > ===> how do I match buy1 and sell2?
> > >
> > > BACKTESTING
> > >
> > > I believe that the issue above differs from the actual
> > backtest-logic and has been vastly mixed causing a lot of confusion.
> > The way I currently see it is, in order to get a proper backtest of
> > multiple systems, one would either need custom backtest proc or --- in > > this (my case above) case with only one underlying traded --- name the
> > same underlying differently e.g. FDAX1 for system #1 FDAX2 for system
> > #2. Not so elegant, but if it works I'm fine with it.
> > >
> > >
> > >
> > > MONEY MANAGEMENT AND PORTFOLIO COMPOSITION
> > >
> > > Obviously, if you have figured out what and how much to trade, this
> > one is already resolved. But maybe sometimes one would like to try
> > different things or at least check different inputs. Such as:
> > >
> > > One Equity Pool
> > > Several equity pools,
> > > manipulate position size if one system is performing poorly,
> > > have a system ranking funtion ("which system to trade now - based on
> > equity curve, e.g.)
> > > do some sort of modern portfolio theory.
> > >
> > >
> > > I don't want to go in the details on "MONEY MANAGEMENT AND PORTFOLIO > > COMPOSITION" and for now I'd be delighted if someone could show me how
> > to match my buy/sell signals for realtime trading. One software which
> > I know of and is capable of adressing all these problems "easier" is
> > rina portfolio maestro.
> > >
> > > http://www.portfoliomaestro.com/
> > >
> > > I haven't tried it and I'm also not planning on doing so (10k$ per
> > year), but I wanted to understand what's possible.
> > >
> > >
> > >
> > > Greetings,
> > >
> > > M
> > >
> > >
> > > --- In [email protected] <mailto:amibroker%40yahoogroups.com>
> > <mailto:amibroker%40yahoogroups.com>, "Jeff" <jeffro861@> wrote:
> > > >
> > > > In any case you'll have to decide on the logic to decide on
> > allocation. After you do that, You could make the meta system a linear
> > combination of the two. Create multiple randoms runs of each and
> > assign a static variable, to the random equity curves. That way you
> > could do a Monte Carlo analysis with both sets together and different
> > allocations. But then again I would I strongly suggest researxhing and
> > understanding the characters of the tendencies you are exploiting
> > instead of smashing them together blindly.
> > > >
> > > > --- In [email protected] <mailto:amibroker%40yahoogroups.com>
> > <mailto:amibroker%40yahoogroups.com>, "Gonzaga" <gonzagags@> wrote:
> > > > >
> > > > > Hi.
> > > > > I am lately trying to mix several systems in on meta-system, and
> > I am observing that is not difficult to obtain good CAR's with low
> > Draw Downs.
> > > > > For example, system 1 trade against 100 tickers of the
> > NAsdaq-100 and system 2, against the same 100 tickers. Both systems
> > 'compete' for the money.
> > > > > This is a 'Meta-system', multi-system and multi-stock.
> > > > >
> > > > > Well, I see it's not very difficult to obtain profitable systems..
> > > > > I see also that a good filter to improve results is to filter
> > every system with a volatility value of the index you are using, for
> > example ATR of NQ, or ATR of SPX. So you trade any system in the best
> > moment for the system.
> > > > > You have to filter all your systems, and then, mix them in one
> > meta-system.
> > > > > I thing it's not very hard to obtain annualized CARs 30% and DD
> > less than 20%.
> > > > > BUT, it's hard to programme and backtest.
> > > > > Amibroker backtests very easily many stocks, but to mix several
> > systems is a mess.. difficult and easy to fail..
> > > > > Does anybody know a trading platform that creates this kind of
> > meta-system easily? (perhaps trade station?)
> > > > > Or a way to mix and backtest 2 or 3 systems easily in Ami?
> > > > >
> > > > > Thanks
> > > > >
> > > >
> > >
> >
> >
>


Reply via email to