BUG-Report (IntrabarOrder & Variables):
Hi,
i have been working with Intra-Bar Order Generation and found a bug.
Settings: “Allow unlimited entries and exits per bar”
Code:
Code: Select all
print("Line 1 rlong: ",(rlong)," Marketposition: ",marketposition," date: ",date," ",time);
...
vars:
rlong(false),
rshort(false),
iBBO(0),
iBBU(0),
tradingtime(false),
BentryO(false),
BentryU(false),
FentryO(false),
FentryU(false),
RATR(0),
Trail(0);
...
print("Line 65 rlong: ",(rlong)," Marketposition: ",marketposition," date: ",date," ",time);
//Enter
if (tradingtime and FentryO and BentryO and not rlong) then
begin
buy next bar at market;
Trail=Close-RATR;
rlong=true;
end;
print("Line 74 rlong: ",(rlong)," Marketposition: ",marketposition," date: ",date," ",time);
…
print("Line 111 rlong: ",(rlong)," Marketposition: ",marketposition," date: ",date," ",time);
Line 111 is the end of the Code.
On a Intra-Bar Order Generation (tradingtime=true, FentryO=true, BentryO=true and not rlong)
it executes an long order position just as it should.
The variables “Trail” and “rlong” are receiving new values but only temporary. WHY?
They keep there new values until the end of the code. Starting the code over again they have there old values back but not the new ones.
This happens over and over again until the end of the Bar. If the entry is still valid the variables Trail and rlong keep there new values permanently.
BUT now this is the big fail... when the entry is not valid at the end of the bar the variables Trail and rlong have there old values back and not the new assigned ones BUT the MarketOrder is out.
The variables values should not change from last Line 111 to first Line 1 but it does
Log from the print Lines
Line 1 rlong: FALSE Marketposition: 0.00 date: 1100330.00 906.00
Line 65 rlong: FALSE Marketposition: 0.00 date: 1100330.00 906.00
Line 74 rlong: FALSE Marketposition: 0.00 date: 1100330.00 906.00
Line 111 rlong: FALSE Marketposition: 0.00 date: 1100330.00 906.00
Line 1 rlong: FALSE Marketposition: 0.00 date: 1100330.00 907.00
Line 65 rlong: FALSE Marketposition: 0.00 date: 1100330.00 907.00
Line 74 rlong: TRUE Marketposition: 0.00 date: 1100330.00 907.00
Line 111 rlong: TRUE Marketposition: 0.00 date: 1100330.00 907.00
Line 1 rlong: FALSE Marketposition: 1.00 date: 1100330.00 908.00
Line 65 rlong: FALSE Marketposition: 1.00 date: 1100330.00 908.00
Line 74 rlong: TRUE Marketposition: 1.00 date: 1100330.00 908.00
Line 111 rlong: TRUE Marketposition: 1.00 date: 1100330.00 908.00
Line 1 rlong: FALSE Marketposition: 1.00 date: 1100330.00 909.00
Line 65 rlong: FALSE Marketposition: 1.00 date: 1100330.00 909.00
Line 74 rlong: TRUE Marketposition: 1.00 date: 1100330.00 909.00
Line 111 rlong: TRUE Marketposition: 1.00 date: 1100330.00 909.00
Line 1 rlong: FALSE Marketposition: 1.00 date: 1100330.00 909.00
Line 65 rlong: FALSE Marketposition: 1.00 date: 1100330.00 909.00
Line 74 rlong: TRUE Marketposition: 1.00 date: 1100330.00 909.00
Line 111 rlong: TRUE Marketposition: 1.00 date: 1100330.00 909.00
Line 1 rlong: FALSE Marketposition: 1.00 date: 1100330.00 910.00
Line 65 rlong: FALSE Marketposition: 1.00 date: 1100330.00 910.00
Line 74 rlong: TRUE Marketposition: 1.00 date: 1100330.00 910.00
Line 111 rlong: TRUE Marketposition: 1.00 date: 1100330.00 910.00
Line 1 rlong: FALSE Marketposition: 1.00 date: 1100330.00 911.00
Line 65 rlong: FALSE Marketposition: 1.00 date: 1100330.00 911.00
Line 74 rlong: TRUE Marketposition: 1.00 date: 1100330.00 911.00
Line 111 rlong: TRUE Marketposition: 1.00 date: 1100330.00 911.00
Line 1 rlong: FALSE Marketposition: 1.00 date: 1100330.00 912.00
Line 65 rlong: FALSE Marketposition: 1.00 date: 1100330.00 912.00
Line 74 rlong: TRUE Marketposition: 1.00 date: 1100330.00 912.00
Line 111 rlong: TRUE Marketposition: 1.00 date: 1100330.00 912.00
Line 1 rlong: FALSE Marketposition: 1.00 date: 1100330.00 913.00
Line 65 rlong: FALSE Marketposition: 1.00 date: 1100330.00 913.00
[...]