Max Bars Back value 0

Questions about MultiCharts and user contributed studies.
chi jeongki
Posts: 27
Joined: 29 Nov 2007
Has thanked: 4 times
Been thanked: 1 time

Max Bars Back value 0

Postby chi jeongki » 19 Jun 2012

I am printing with the following one line study.

Print(File("c:\data\_test_firstline.txt"), ELDateToString(Date), " ", Time:6:0, " ", BarNumber:14:0, " ", close:8:2, ticks:7:0);

Even if I set Max Bars Back to 0, it does not print first few lines.

If it is set to 1, then only the first bar data does not print.
If it is set to 0, it works like, as if the value is set to "Auto detect"

How can I print the first bar data?
What is the defined behaviour for setting Max Bars to 0? Isn't it to calculate from the first bar?

MultiCharts Version 7.4 (Build 4953)

========== data imported
20120605 090000 238.80 1466
20120605 090000 238.80 4
20120605 090000 238.80 2
20120605 090000 238.85 8
20120605 090000 238.75 3
20120605 090000 238.85 5
20120605 090001 238.85 1
20120605 090001 238.85 0
20120605 090001 238.85 0
20120605 090001 238.85 0
20120605 090001 238.85 0
20120605 090001 238.85 0
20120605 090001 238.85 0
20120605 090001 238.85 0
20120605 090001 238.85 0
20120605 090001 238.80 6
20120605 090001 238.80 5
20120605 090001 238.80 0
20120605 090001 238.80 3
20120605 090001 238.80 2

========= data printed (first 6 line is missing)
06/05/2012 900 1 238.85 1
06/05/2012 900 2 238.85 0
06/05/2012 900 3 238.85 0
06/05/2012 900 4 238.85 0
06/05/2012 900 5 238.85 0
06/05/2012 900 6 238.85 0
06/05/2012 900 7 238.85 0
06/05/2012 900 8 238.85 0
06/05/2012 900 9 238.85 0
06/05/2012 900 10 238.80 6
06/05/2012 900 11 238.80 5
06/05/2012 900 12 238.80 0
06/05/2012 900 13 238.80 3
06/05/2012 900 14 238.80 2

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 485 times

Re: Max Bars Back value 0

Postby Dave Masalov » 26 Jun 2012

Hello chi jeongki,

The "symbol_" keywords give access to the data of whole series.

Here are the examples:

#1

Code: Select all

once cleardebug;

once for value1 = symbol_currentBar-1 downto currentBar begin
Print(ELDateToString(symbol_date[value1]), " ", symbol_time[value1]:6:0, " ", BarNumber - value1:14:0, " ", symbol_close[value1]:8:2, " ", symbol_ticks[value1]:7:0);
end;

Print(ELDateToString(Date), " ", Time:6:0, " ", BarNumber:14:0, " ", close:8:2, " ", ticks:7:0);

#2

Code: Select all

if currentbar = 1 then
for value1 = symbol_currentBar-1 downto currentBar begin
Print(ELDateToString(symbol_date[value1]), " ", symbol_time[value1]:6:0, " ", BarNumber - value1:14:0, " ", symbol_close[value1]:8:2, " ", symbol_ticks[value1]:7:0);
end;

Print(ELDateToString(Date), " ", Time:6:0, " ", BarNumber:14:0, " ", close:8:2, " ", ticks:7:0);

chi jeongki
Posts: 27
Joined: 29 Nov 2007
Has thanked: 4 times
Been thanked: 1 time

Re: Max Bars Back value 0

Postby chi jeongki » 08 Sep 2012

I tried to compile the sample code.
But symbol_ keyword is causing compile error.
Does the prefix symbol_ work?

I could print chart with the following code.
One stranage thing is BarNumber has two different value in Data Window.
In-built BarNumber in Data Window begins 1 from first displayed candle.
But plot(BarNumber) begins 1 from MaxBarsBack displayed candle.
It is confusing that BarNumber has two different value in Data Window.
=====================================
Var: cnt(0);

if CurrentBar = 1 then begin
For cnt = MaxBarsBack downto 1 begin
Print(File("C:\chart.txt"), ELDateToString(Date[cnt]), " ", Time[cnt]:6:0, " ", MaxBarsBack-cnt+1:14:0, " ", open[cnt] data1:6:2, " ", high[cnt] data1:6:2, " ", low[cnt] data1:6:2, " ", close[cnt] data1:6:2, " ", Ticks[cnt] data1:10:0);
end;
end;

Print(File("C:\chart.txt"), ELDateToString(Date), " ", Time:6:0, " ", MaxBarsBack+BarNumber:14:0, " ", open data1:6:2, " ", high data1:6:2, " ", low data1:6:2, " ", close data1:6:2, " ", Ticks data1:10:0);

plot1(MaxBarsback);
plot2(BarNumber);
plot3(CurrentBar);
=================================

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 485 times

Re: Max Bars Back value 0

Postby Dave Masalov » 10 Sep 2012

Hello chi jeongki,

Symbol_ keywords have been added in MultiCharts 8.0

One stranage thing is BarNumber has two different value in Data Window.
In-built BarNumber in Data Window begins 1 from first displayed candle.
But plot(BarNumber) begins 1 from MaxBarsBack displayed candle.


It is normal behavior, since the indicator starts its culculation after skipping MaxBarsBack number of bars. You can find more information here.


Return to “MultiCharts”