I wrote a simple trading system that buy the best stock and short the
wrost stock of my watchlist simultaneously at 9.15 am
but the positionscore function does not work properly !!!!!!!!
(I use AmiBroker version 5.20)

SetBacktestMode( backtestRegularRaw );
SetOption( "InitialEquity",20000);
SetOption( "SeparateLongShortRank",True);
SetOption( "MaxOpenPositions",2);
SetOption( "MaxOpenLong",1);
SetOption( "MaxOpenShort",1);
PositionSize=10000;
ApplyStop(0,0,0,0);
ApplyStop(1,0,0,0);
ApplyStop(2,0,0,0);
SetTradeDelays(0,0,0,0);
TimeFrameSet(in5Minute);
Timeopen=TimeNum()==090500 ;
Timeclose=TimeNum()==172000 ;
Cieri=ValueWhen(Timeclose,C,2);
Ooggi=ValueWhen(Timeopen,O,1);
yield=((Ooggi / Cieri)-1)*100;
score= PositionScore = Yield ;

Buy=Timeopen  AND score;
Sell=Timeclose;
Short=Timeopen  AND score;
Cover=Timeclose;
BuyPrice=O;
SellPrice=C;
ShortPrice=O;
CoverPrice=C;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
Plot(C,"",colorBlack,styleCandle);
_N(Title = StrFormat("{{NAME}} - ANG Spread Ita System - {{INTERVAL}}
{{DATE}} - Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V,
1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Filter=Buy AND Short;
AddColumn(yield,"yield",6.4);

you see in the image ... http://img44.imageshack.us/i/positionscore.png/
<http://img44.imageshack.us/i/positionscore.png/>

I've already this problem?

thanks for the reply

Angio


Reply via email to