Some HSI future data received from IB cannot be identified by Multicharts

Questions about MultiCharts and user contributed studies.
MKKL
Posts: 8
Joined: 31 Dec 2018
Has thanked: 2 times

Some HSI future data received from IB cannot be identified by Multicharts

Postby MKKL » 11 Oct 2020

Hi,

I encounter a problem that when downloaded HSI future data from IB, on the chart, I can see the correct total number of bars, for example, I selected 30-min as time interval and the total number of bar shown on the chart is 33. However, when I use power editor to print out each bar to check, I found only 27 bar can be printed out and some bars (first 6 bars) cannot be identified. But each month, it only happens to the first day of data, the second day and subsequent days, it has no problem for recognizing the number of bars. It happens to no matter historical data or current month data. I am not sure its the problem of data or the multicharts program.

I am using MultiCharts64 Version 12.0 Release (Build 20694) running on Windows 10 pro version 1909 (OS build 18363.1082) with IB API version 978. The session template has been set as 09:00 - 12:00 (session 1), 13:00 - 16:30 (session 2), 17:15 - 03:00 (session 3).

HSI future - 29-Jun to 01-Jul.jpg
(132.57 KiB) Not downloaded yet
print out data 1.jpg
(1.17 MiB) Not downloaded yet
print out data 2.jpg
(686.05 KiB) Not downloaded yet
HSIN0-2.qmd
(340.25 KiB) Downloaded 100 times

ML

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Some HSI future data received from IB cannot be identified by Multicharts

Postby TJ » 11 Oct 2020

Please post your print code

MKKL
Posts: 8
Joined: 31 Dec 2018
Has thanked: 2 times

Re: Some HSI future data received from IB cannot be identified by Multicharts

Postby MKKL » 11 Oct 2020

Here you are.

=========================================================================================

If (datetime >= StringToDateTime("29/06/2020 03:00")) and (datetime <= StringToDateTime("01/07/2020 03:00")) then begin

if Sessionlastbar = true then begin

print("XXX Last Bar number: ", BarNumber, " / bar interval: ", barinterval, " / date: ", date+19000000, " / time_s :" , time_s);

end
else begin

print("Bar number: ", BarNumber, "/ bar interval: ", barinterval, " / date: ", date+19000000, " / time :" , time);

end;

end;

========================================================================================

User avatar
Kate MultiCharts
Posts: 575
Joined: 21 Oct 2020
Has thanked: 7 times
Been thanked: 144 times

Re: Some HSI future data received from IB cannot be identified by Multicharts

Postby Kate MultiCharts » 08 Dec 2020

Hello MKKL,

Maxbarsback prevents the calculation from starting from the first bar of the chart. This is a designed behaviour, not a bug.

You can replace the BarNumber function with the currentbar keyword (the function will not allow reducing Maxbarsback to 0, since there is a reference to the previous value).

Set Maximum number of bars study will reference = 0.

To set it for a signal go to Strategy Properties -> Properties.

To set it for an indicator go to Format Study -> Properties.

You can also use the Symbol_CurrentBar keyword to get the same bar number as in the hint on the chart.


Return to “MultiCharts”