PureBytes Links
Trading Reference Links
|
i have an array of my net position size, ie it is not the raw trading signals any more. It is e.g {6,6,6,-3,-3,-3,10,10,10.....} So at some point you will need to sell 6 contracts to clear the long, short 3, then later cover 3 and buy 10.
Can this be done without the custom backtester and can anybody point me in the right direction. I am new to afl and this was how i started but then just stopped when i couldnt get it. I know its full of errors but just for background :
//Set Backtestmode
SetBacktestMode(backtestregularrawmulti);
// delays
SetTradeDelays( 0, 0, 0, 0 );
BuyPrice = SellPrice = Open;
SetPositionSize(abs(xxxtotal-Ref(xxxtotal,-1)),spsShares);
for( i = 1; i < BarCount; i++ ){
Buy[i]=0;
Sell[i]=0;
Short[i]=0;
Cover[i]=0;
aaa[i]=xxxtotal[i];
bbb[i] = PositionSize[i];
if (xxxtotal[i-1]>0){
if (xxxtotal[i]<0){
//how do i get positionsizes right here?
Sell[i] = 1;
Short[i] = 1;
}
else if (xxxtotal[i]>xxxtotal[i-1]){
Buy[i] = sigScaleIn;
}
else if (xxxtotal[i]<0){
Sell[i] = sigScaleOut;
}
else if (xxxtotal[i]<xxxtotal[i-1]){
Sell[i] = sigScaleOut;
}
}
else if (xxxtotal[i-1]<0){
if (xxxtotal[i-1]>0){
Cover[i] = 1;
//and again the positionsizes?
Buy[i] = sigScaleIn;
}
else if (xxxtotal[i]<xxxtotal[i-1]){
//PositionSize[i] = (xxxtotal[i-1]-xxxtotal[i]);
Short[i] = sigScaleIn;
}
else if (xxxtotal[i]>xxxtotal[i-1]){
Cover[i] = sigScaleOut;
}
}
}
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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:
amibroker-digest@xxxxxxxxxxxxxxx
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/
|