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

[amibroker] Re: positionscore problem



PureBytes Links

Trading Reference Links

Hi Mike, 

thanks for your message.

However I don't see how the backtester mode can help in this case.
I do not wish to long/short the same signal. Just long the signal with
the strongest positionscore and short the one with the weakest.

The new "SeparateLongShortRank" seems to imply it can be done, but I
cannot see any difference with these in.

The <0 and >0 option is ultimately a workaround which assumes that the
maximum positionscore value is positive and the minimum is negative,
but of course this fails when this is not the case.

Is there any way one can refer to the Strongest and Weakest scores
directly for each iteration of the backtester? 
Buy = PositionScore==X; Sell = PositionScore==Y where X and Y are
strongest and weakest respectively?

Many thanks,
C 


--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> Sounds like everything is working exactly as you want it (i.e. if all 
> ROC are positive, then your logic ...AND ROC < 0 will fail, thus no 
> Short). Your code is saying that you don't want a Short when ROC is 
> positive, so you're not getting one!
> 
> Your second attempt (i.e. removing the ROC < 0 part) is saying that 
> you want both a Buy *and* a Short when FirstHourUp. By default, 
> AmiBroker will not let you have two positions open for the same 
> symbol.
> 
> You would have to set the backtester mode to backtestRegularRawMulti 
> in your code to enable that. You would then probably want to write 
> custom backtester code to strip out the redundent signals that you 
> didn't actually want.
> 
> http://www.amibroker.com/guide/afl/afl_view.php?id=350
> 
> Mike
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "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
> >
>



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

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/