Bar Number Setting  [SOLVED]

Questions about MultiCharts and user contributed studies.
avme
Posts: 21
Joined: 30 Oct 2013
Has thanked: 1 time
Been thanked: 2 times

Bar Number Setting

Postby avme » 31 Oct 2013

Hi,

I wrote a script to find today's volume is how many days largest and showed the number as indicator in the chart. The purpose is to show the importance of today's volume. For example, if today's volume is the largest of the last 200 trading days, it is obviously more important than the volume just larger than the past few days.

The script works fine. The big question is it only shows the result of the past few years at most, no matter how many bars I load. I cannot figure out why the script does not start at the 7th bar, given the first 6 bars are ignored by default. I sense that it must be something to do with the bar numbers. I maximized the bars loaded through "format instrument"->"setting"->"data range". It is no use. I am desperate for a direction. Any hints would be highly appreciated.

The script:

Variables: KeepGoing(True),
BarCount(1);

BarCount = 1;
KeepGoing = True;

While KeepGoing = True begin

If Volume > Volume[BarCount] then begin
BarCount = BarCount + 1;
End
Else begin
KeepGoing = False;
End;

End;

Value20 = Text_New_Self(Date, Time, 1, NumtoStr(BarCount-1,0));
Value21 = Text_setsize(Value20,6);
Value24 = text_setcolor(Value20,yellow);

Print(CurrentBar:2:0, " ",ELDatetoString(Date), " BarCount=", BarCount:2:0);
Attachments
Volume X Days.jpg
(292.79 KiB) Downloaded 458 times

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

Re: Bar Number Setting

Postby TJ » 31 Oct 2013

Hi,
I wrote a script to find today's volume is how many days largest and showed the number as indicator in the chart. The purpose is to show the importance of today's volume. For example, if today's volume is the largest of the last 200 trading days, it is obviously more important than the volume just larger than the past few days.
The script works fine. The big question is it only shows the result of the past few years at most, no matter how many bars I load. I cannot figure out why the script does not start at the 7th bar, given the first 6 bars are ignored by default. I sense that it must be something to do with the bar numbers. I maximized the bars loaded through "format instrument"->"setting"->"data range". It is no use. I am desperate for a direction. Any hints would be highly appreciated.
The script:
::
Please look up these articles in wiki:

Maximum Bars Back
How Scripts Work
Symbol_currentbar




ps.
[FAQ] How to Post Codes (that people can read)
viewtopic.php?f=16&t=11713

avme
Posts: 21
Joined: 30 Oct 2013
Has thanked: 1 time
Been thanked: 2 times

Re: Bar Number Setting

Postby avme » 01 Nov 2013

Thanks TJ and sorry for the mess.

I checked out the wiki. It seems that Multicharts does not support "bars-since". I can easily find the 52-week high but no easy way to find the corresponding bar number.

Am I right?

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

Re: Bar Number Setting  [SOLVED]

Postby TJ » 01 Nov 2013

Thanks TJ and sorry for the mess.
I checked out the wiki. It seems that Multicharts does not support "bars-since". I can easily find the 52-week high but no easy way to find the corresponding bar number.
Am I right?
1. set up a variable,
2. when the chart reaches the 52-week high, capture the bar number and save it to the variable.
3. if the market makes another high, then replace the capture with the new one.


Return to “MultiCharts”