Using a very simple strategy with this code:
Code: Select all
Variables:
ii (0);
once
begin
for ii = 0 to 4
begin
Print("ii: ", ii, "; PosTradeIsOpen(0, ii): ", PosTradeIsOpen(0, ii));
Print("ii: ", ii, "; PosTradeIsLong(0, ii): ", PosTradeIsLong(0, ii));
end;
end;
Why does PosTradeIsOpen return "true", if there are no open positions? Same goes for PosTradeIsLong. I can understand that it has to return something, but according to the help file it "Returns True value if the trade was opened by buy order, otherwise False value is returned.". So in my opinion either the help needs to be updated or it should return false.ii: 0.00; PosTradeIsOpen(0, ii): TRUE
ii: 0.00; PosTradeIsLong(0, ii): TRUE
ii: 1.00; PosTradeIsOpen(0, ii): TRUE
ii: 1.00; PosTradeIsLong(0, ii): TRUE
ii: 2.00; PosTradeIsOpen(0, ii): TRUE
ii: 2.00; PosTradeIsLong(0, ii): TRUE
ii: 3.00; PosTradeIsOpen(0, ii): TRUE
ii: 3.00; PosTradeIsLong(0, ii): TRUE
ii: 4.00; PosTradeIsOpen(0, ii): TRUE
ii: 4.00; PosTradeIsLong(0, ii): TRUE
For PosTradeIsOpen returning "true" for not existing positions is wrong and problematic in my opinion, as you will run into problems this way.
I noticed this in MultiCharts Version 8.0 Release (Build 5620) and didn't check the 64 bit version.
Regards,
ABC