You are the man!  You've been incredibly helpful.  I got most of what you are 
saying to do, added/changed the code and started getting 1, 2 & 3 positions at 
a time!  Awesome!

Due to the fact that I can see the buy signals are being triggered on different 
days (perfect) and I see all the Sell signals being triggered on the same exact 
days (not right), I'm assuming the same changes need to be made on the sell 
side as well.  I'm going to do that right now.  Hope it works.  If it all does, 
you are to be congratulated!

Thanks again!

Steve.

--- In [email protected], "Mike" <sfclimb...@...> wrote:
>
> Hi,
> You're problem is that you are doing exactly what I said not to do. You
> must alter your code to produce an intermediate result for each case,
> then OR the results togeather.
> if ( n == "S&PEmrgMkts" ) {  ...  Strategy1_Buy = ...}
> if ( n == "S&PEmrgMkts" ) {  ...  Strategy2_Buy = ...}
> if ( n == "S&PEmrgMkts" ) {  ...  Strategy3_Buy = ...}
> if ( n == "S&PEmrgMkts" ) {  ...  Buy = Strategy1_Buy OR Strategy2_Buy
> OR Strategy3_Buy;}
> Alternatively, you could use the "|=" operator to OR the Buy with itself
> and remove the final "if" case. But, if you are not familiar with the
> operator, it might just confuse you.
> 
> Buy = 0;
> if ( n == "S&PEmrgMkts" ) {  ...  Buy |= Cross(StochFinal,Trigger) AND
> (EMA( Close,EMAShort ) > EMA( Close,EMALong ));}
> if ( n == "S&PEmrgMkts" ) {  ...  Buy |=  Cross(MA( Close,MAShortBuy
> ),MA( Close,MALongBuy ));}
> if ( n == "S&PEmrgMkts" ) {  ...  Buy |=  Cross(fast,slow);}
> Mike
> --- In [email protected], "graphman27" <steve@> wrote:
> >
> > Here's is most of the code in question...
> >
> > SetBacktestMode( backtestRegularRawMulti );
> >
> > SetOption("MaxOpenPositions", 3 ); // This sets maximum number of open
> positions
> >
> > //PosQty = 3; // You can define here how many open positions you want
> > //SetOption("MaxOpenPositions", PosQty );
> > //PositionSize = -100/PosQty; // invest 100% of portfolio equity
> divided by max. position count
> >
> > //definition of variables for the symbols not included below
> > Buy = Sell = 0;
> > //symbol-specific rules
> > n = Name();
> > if( n == "S&PEmrgMkts" )
> > {
> >     //strategy 1 for Emrg Mkts here
> > EMAShort = Optimize("EMAShort", 2,2,8,2);
> > EMALong = Optimize("EMALong", 10,10,60,5);
> > Period = Optimize ("Period", 45,10,50,5);
> > Trigger = 50;
> >
> > StochTop = (Close-(LLV(Close,Period)));
> > StochBottom = (HHV(Close,Period)-LLV(Close,Period));
> > StochFinal = (StochTop / StochBottom)*100;
> >
> > Buy = Cross(StochFinal,Trigger) AND (EMA( Close,EMAShort ) > EMA(
> Close,EMALong ));
> >
> > Sell = Cross(Trigger,StochFinal) AND (EMA( Close,EMAShort ) < EMA(
> Close,EMALong ));
> > ..................
> >
> >  PositionSize = -33;
> > }
> >
> > if( n == "S&PEmrgMkts" )
> > {
> >     //strategy 2 for Emrg Mkts here
> > MAShortBuy=Optimize("MAShortBuy",8,7,12,1);
> > MALongBuy=Optimize("MALongBuy",60,20,100,10);
> > MAShortSell=Optimize("MAShortSell",8,2,8,1);
> > MALongSell=Optimize("MALongSell",40,10,80,10);
> >
> >
> > Buy =  Cross(MA( Close,MAShortBuy ),MA( Close,MALongBuy ));
> >
> > Sell = Cross(MA( Close,MALongSell ),MA( Close,MAshortSell ));
> >
> >
> > Short = 0;
> >
> > Cover = 0;
> >
> > Plot( MA ( Close,8 ),"MAShortBuy", colorGreen, styleThick );
> > Plot( MA ( Close,60 ),"MALongBuy", colorRed, styleThick );
> > Plot( MA ( Close,8 ),"MAShortSell", colorBlue, styleThick );
> > Plot( MA ( Close,40 ),"MALongSell", colorLightBlue, styleThick );
> > ............................
> >
> >     PositionSize = -33;
> > }
> >
> > if( n == "S&PEmrgMkts" )
> > {
> >     //strategy 3 for Emrg Mkts here
> > smooth = Optimize("smooth",40,10,65,5);
> > Lag = Optimize("lag",10,2,10,1);
> > fast = DEMA(C,smooth);
> > slow = Ref(EMA(C,smooth),-Lag);
> > Buy = Cross(fast,slow);
> > Sell = Cross(slow,fast) OR slow == fast;
> > ......................
> >  PositionSize = -33;
> >
> > Maybe you can tell what I'm doing wrong.  I can't get more than one
> buy at a time.  Separately, each section of code works fine in
> individual backtests.
> >
> > Thanks in advance!
> >
> > Steve.
> >
> >
> > --- In [email protected], "Mike" sfclimbers@ wrote:
> > >
> > > Without a code sample, it's hard to understand what you are saying.
> But, bottom line is that you must have a single Buy statement which
> includes all the logic of all the formulas.
> > >
> > > e.g.
> > > Strategy1_Buy = ...
> > > Strategy2_Buy = ...
> > >
> > > Buy = Strategy1_Buy OR Strategy2_Buy; // Correct
> > >
> > > You cannot have multiple Buy statements, if that is what you are
> doing.
> > >
> > > e.g.
> > > Buy = ...
> > > Buy = ... // Wrong
> > >
> > > When using multiple Buy assignments, you are clobbering whatever Buy
> used to hold and the last assignment will be the *only* logic that is
> applied.
> > >
> > > Mike
> > >
> > > --- In [email protected], "graphman27" <steve@> wrote:
> > > >
> > > > I downloaded 5.30 and still can't get it to work.  What I do see
> is mutiple positions for one symbol IF there is only one signal formula
> for a symbol.  I have three separate formulas for one symbol, which
> doesn't seem to work with BacktestRegularRawMulti.  I scanned through
> the detailed log and saw multiple positions for the single formula and
> never more than one for the multiple formulas.  Also, it was always
> using the second formula.  I have position shrinking turned on too.
> > > >
> > > > Here is what I'm saying about formulas:
> > > >
> > > > Symbol #1 has three separate formulas for buy and sells.
> > > > Symbol #2 has one formula.
> > > > Symbol #3 has one formula.
> > > > Symbol #4 has one formula.
> > > >
> > > > Thanks.
> > > >
> > > > --- In [email protected], "Mike" <sfclimbers@> wrote:
> > > > >
> > > > > Hi,
> > > > > It's working fine for me (version 5.30 trial). Note that you may
> need to
> > > > > allow position size shrinking for all trades to fire. Use the
> detailed
> > > > > log option from AA Settings Report tab to see what's going on.
> > > > > SetBacktestMode(backtestRegularRawMulti);
> > > > >
> > > > > PositionSize = -33;
> > > > > Dates = DateTime();
> > > > > Buy = Dates == StrToDateTime("2010-Jan-05") || Dates ==
> > > > > StrToDateTime("2010-Jan-11") || Dates ==
> StrToDateTime("2010-Jan-07");
> > > > > Sell =  DateTime() == StrToDateTime("2010-Jan-15");
> > > > > Mike
> > > > > --- In [email protected], "graphman27" <steve@> wrote:
> > > > > >
> > > > > > I developed different signals for the same symbol and want all
> signals
> > > > > to work individually within the portfolio backtester.  It ain't
> workin'!
> > > > > I tried adding "SetBacktestMode (backtestRegularRawMulti);" to
> the
> > > > > beginning of my code, to no avail.  I have the position size set
> up for
> > > > > -33 and three separate signals.  It only seems to be pulling one
> signal,
> > > > > because the number of trades and the CAR should be 3Xs higher
> than it
> > > > > is.
> > > > > >
> > > > > > Help!
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > Steve.
> > > > > >
> > > > >
> > > >
> > >
> >
>


Reply via email to