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

Re: [amibroker] PositionSize Question



PureBytes Links

Trading Reference Links

Herman,

You are using non-zero trade delays (as you wrote in a separate e-mail).
Using 1 bar trade delays effectively shifts buy/sell/short/cover
signals one bar. But it does not shift buyprice/sellprice/shortprice/coverprice and positonsize
arrays. 
So your delayed buy happens when positionsize variable is zero
(it was -100 one bar before).

That's the reason.

Probable question from your side:
why the other arrays are not shifted?

Answer:
buyprice/sellprice/shortprice/coverprice arrays
must contain price within current bar H-L range.
This is required because tommorrows buy (delayed one bar from today)
must be executed at tommorrows price (withing H-L).

As for positonsize variable we can discuss if it is better to shift it or not.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Herman van den Bergen" <psytek@xxxxxxxx>
To: "Amibroker@xxxxxxxxxxxx Com" <amibroker@xxxxxxxxxxxxxxx>
Sent: Thursday, February 13, 2003 2:50 AM
Subject: [amibroker] PositionSize Question


> Hello,
> 
> If I test the code segments one and two below separately, why do i get
> different results?
> 
> Ind=scCMO(C,6);
> Buy=Cross(-20,Ind);
> Sell=Cross(Ind,20);
> Short = Sell;
> Cover = Buy;
> Q = MA(C,5) > MA(C,20); // Just a test signal
> 
> // Code segment one
> //Buy = Buy AND Q;       // Trades are executed when Q==1
> //Short = Short AND Q;   // Trades are not executed when Q==0
> 
> // Code segment two
> PositionSize = Q * -100; // When Q==0 my PS is 0%, when Q==1 my PS is 100%.
> 
> Thanks for any explanation you can give,
> Herman.
> 
> 
> 
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> 
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
> 

Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/