Missing part of a plot

Questions about MultiCharts and user contributed studies.
janus
Posts: 755
Joined: 25 May 2009
Has thanked: 41 times
Been thanked: 84 times

Missing part of a plot

Postby janus » 16 Jun 2009

The following code fails to plot the first few thousands of points of the high of data2 simply because of the 2nd if statement. What am I missing here? I need to plot of the entire series from the beginning, which it does if I remove the 2nd if statement. I tried Auto-detect and various user specified values for "Max number of bars study will reference" to no avail. Please advise.

variables:
modhigh(0);

modhigh = high of data(2);

plot1(modhigh,"High",blue);

if currentbar > 3000 then begin
if low of data(2) < low[2000] of data(2) then print ("something");
end;

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 17 Jun 2009

Hi janus,

If a study references past values, to be calculated it will skip no fewer bars from the beginning of the chart than it references. In your particular case, this value should be no less than 2000 bars.

If you have 'Automatic' selected for the ‘Max number of bars study will reference’ the study will automatically estimate how many bars it needs to skip.

Regards.

janus
Posts: 755
Joined: 25 May 2009
Has thanked: 41 times
Been thanked: 84 times

Postby janus » 17 Jun 2009

Yes Marina, that's what I've come to understand how it works. What I don't understand is why? If I have logic in my code to check that I don't reference data before the start, I should be able to use plotn to plot an indicator of my choice from the beginning. I tried to set the "Max number of bars study will reference" to 1 or 0 and it made no difference. There should be an override option to stop the study from trying to determine how far back it's referencing a data series. If the code is badly written such that it tries to read a value before the start then it should abort with an error message, the same way if one does it to an array. I hope you understand my point of view as this is a serious limitation and prevents me from developing complex studies. As I mentioned in another post, I could resort to using arrays to store the data but then another problem arises - "out of memory" errors. I can't win! I repeat, this is a serious limitation, so much so I'm sure it will put off really serious traders from using MC.


Return to “MultiCharts”