Hi, I have an Indicator with an array M of stop levels. I want to plot them in the chart. One way would be:
If M=1 then Plot1(LongStop[M],"Long 1");
If M=2 then Plot2(LongStop[M],"Long 2");
If M=3 then Plot3(LongStop[M],"Long 3");
etc...
However, more easy & smooth would be something like......
For M=1 to MAXNUMBER begin
Plot[M](LongStop[M],"Long "NumtoStr(M,0));
end;
..but this is not working and i found no other way...
Any help appreciated.
Cheers
lantama
PlotXX - Plotting values from an array in a loop?
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
I use arrays and TL, maybe you can adapt it for your code.
Code: Select all
inputs: History (false);
vars: count (0);
arrays:TLLongStop_Array[6](0) ;{Single Dimension Dynamic Array}
FOR count = 5 DOWNTO 0
BEGIN
if TLLongStop_Array[count ] >= 0 then
BEGIN
condition1 = History;
if condition1 then
BEGIN
TL_SetEnd( TLLongStop_Array[count ] , Date, Time, TL_GetValue( TLLongStop_Array[count ] , Date, Time ) ) ;
TL_SetExtRight( TLLongStop_Array[count ] , False ) ;
END
else if History = False then TL_Delete( TLLongStop_Array[count ] ) ;
END ;
TLLongStop_Array[count ] = TL_New_s(MYDATE[count ],MYtime[count ],LongStop[count ],Date,Time_s,LongStop[count ]);
TL_SetColor (TLLongStop_Array[count ],HiColor);
TL_SetStyle (TLLongStop_Array[count ],HiLoLineStyle);
TL_SetExtLeft (TLLongStop_Array[count ],False);
TL_SetExtRight (TLLongStop_Array[count ],False );
TL_SetSize (TLLongStop_Array[count ],4);
END; //count
Re: PlotXX - Plotting values from an array in a loop?
I am also trying to do that.
I have a dynamic array with N lines to plot.
I cannot use the same "plotX" for all of them, so I wonder if there's a way to call another one for each iteration, and this inside the loop.
sort of :
I used to develop with a language that can do that. So maybe there's a similar way to do that? or any way at all?
Thanks a lot
I have a dynamic array with N lines to plot.
I cannot use the same "plotX" for all of them, so I wonder if there's a way to call another one for each iteration, and this inside the loop.
sort of :
Code: Select all
Variables : i(0),MaxIndex(0),strTemp("");
Array: MyArray[](0);
....
For i=0 to MaxIndex
begin
strTemp = "Plot" + NumToStr(i,0);
.... and then execute the function strTemp to plot MyArray(i)
end;
Thanks a lot