One way of solving this would be to deduct an average ROC from some 
aggregate index from each of your individual scores, e.g. if your 
stocks belong to the S&P500, deduct its ROC from each of your 
individual ROCs (you can also create one yourself). You are correct 
in using the new functionality to seperate your shorts from your 
longs via the MaxOpenLong and MaxOpenShort functions.

Hope this helps.

PS

--- In [email protected], "claudecaruana" <[EMAIL PROTECTED]> 
wrote:
>
> Hi,
> 
> Actually the code I supplied on my original message already does
> this.. Works ok if the positionscores for each iteration contain 
both
> positive and negative values. If they are all positive or all 
negative
> the code below would fail.
> 
> BR
> C
> --- In [email protected], "Joe" <j0etr4der@> wrote:
> >
> > Hi,
> > 
> > This bit me, too.  From the AFL Reference Manual, section on Using
> > Position Score, "...AmiBroker will use the absolute value of
> > PositionScore variable to decide which trades are preferred."  
> > 
> > Try this (untested):
> > 
> > PS = ROC(C,NumBars)/ATR(250);
> > PositionScore = PS;
> > .
> > .
> > .
> > Buy=FirstHourUp AND PS > 0;
> > Short=FirstHourUp AND PS < 0;
> > 
> > 
> > Good luck,
> > 
> > Joe 
> > 
> > 
> > 
> > --- In [email protected], "claudecaruana" <claudecaruana@>
> > wrote:
> > >
> > > hi All,
> > > 
> > > I am trying to implement a very simple intraday system using
> > > PositionScore, which buys the strongest symbol at a particular 
time
> > > and shorts the weakest. Exit is at some particular time later. 
> > > 
> > > I am using ROC to determine strength. The code below works fine 
when
> > > the symbols backtested have mixed positive and negative ROC's, 
but if
> > > on a particular day all ROC's are positive, the short trade is 
missed
> > > and vice versa for all ROC's negative.
> > > 
> > > I think I understand why this is happening, however I cannot get
> > > around solving it! 
> > > 
> > > Here is the code: (I am using V5.17)
> > > 
> > > FirstHourUp = IIf (TimeNum() == 103000,True,False);  
> > > numbars=13;
> > > 
> > > SetOption("SeparateLongShortRank", True ); 
> > > SetOption("MaxOpenPositions", 2);
> > > SetOption("MaxOpenLong", 1 );
> > > SetOption("MaxOpenShort",1);
> > > 
> > > PositionScore = ROC(C,NumBars)/ATR(250);
> > > 
> > > Buy=FirstHourUp AND PositionScore > 0;
> > > Short=FirstHourUp AND PositionScore < 0;
> > > 
> > > Sell = TimeNum() == 113000;
> > > Cover = TimeNum() == 113000;
> > > 
> > > 
> > > Note: If I replace the buy/sell lines with the following:
> > > 
> > > Buy=FirstHourUp ;
> > > Short=FirstHourUp ;
> > > 
> > > then I get no short signals at all. I am not sure why.
> > > 
> > > Any ideas on what I can do to resolve the issue?
> > > 
> > > Thanks for any feedback,
> > > Claude
> > >
> >
>


Reply via email to