i'm facing a very strange issue, why the following does not work:
Code: Select all
LOT = LOT +1;
buy ("buy adjustment") LOT contracts next bar at open;
There's a way to do that ?
Thank you !!
No Erocla
Code: Select all
LOT = LOT +1;
buy ("buy adjustment") LOT contracts next bar at open;
Your description is not very clear:Dearl all,
i'm facing a very strange issue, why the following does not work:
MC open the first contract but does not increase the position.Code: Select all
LOT = LOT +1; buy ("buy adjustment") LOT contracts next bar at open;
There's a way to do that ?
Thank you !!
No Erocla
In addition to what TJ said, it might also be that the strategy has scaling into positions disabled.MC open the first contract but does not increase the position.
Yes, this was the problem.In addition to what TJ said, it might also be that the strategy has scaling into positions disabled.MC open the first contract but does not increase the position.
In order for MultiCharts to scale into positions, you'll need to enable the 'Allow up to n entry orders in the same direction as the currently held position' option from the 'Strategy Properties' window.
If that option is disabled, then no matter what your code does, the strategy will not increase positions.
Code: Select all
var:SHARESS(0),balance(0),current_shares(0),current_Exposure(0),Desired_exposure(0),Desired_shares(0),weight(0);
weight = 20;
balance = InitialCapital+ i_ClosedEquity;
current_Exposure = ROUND(CURRENTSHARES*C*50,0);
Desired_shares = ROUND(((balance * weight)/100/50)/c,0);
if desired_shares > CURRENTSHARES then begin
SHARESS = desired_shares - CURRENTSHARES ;
PRINT(" BUY " , DESIRED_SHARES , CURRENTSHARES , SHARESS );
BUY SHARESS shares next bar at o;
end;
if desired_shares < CURRENTSHARES then begin
SHARESS = CURRENTSHARES - desired_shares ;
PRINT(" SELL " , DESIRED_SHARES ,CURRENTSHARES , SHARESS );
SELL SHARESS shares TOTAL next bar at o;
end;