Pivot Function  [SOLVED]

Questions about MultiCharts and user contributed studies.
kelnihat
Posts: 7
Joined: 11 Sep 2014
Has thanked: 1 time

Pivot Function

Postby kelnihat » 23 Oct 2014

Hi;

I am new to the forums, so greetings to all...

I did my homework and searched the forums for topics related to my problem--although I found a number of topics dealing with the Pivot functions, none were relevant to my problem. So here it goes:

When I compile the following simple code to test it, I get a compiler error that goes :
"is not recognized
line 21, column 75"

Code: Select all

vars: counter(0),
lookbacklength(50),
chartbn(0);

Arrays: HighsArray[4](0), LowsArray[4](0), HighBarsArray[4](0), LowBarsArray[4](0);

chartbn = MaxBarsBack + CurrentBar;

if chartbn > (lookbacklength + 2) then
For counter = 4 downto 1
begin
Value1 = Pivot(high,lookbacklength, 2, 2, (5 - counter), 1, oPivotPrice ,oPivotBar);
HighsArray[counter] = oPivotPrice;
HighBarsArray[counter] = oPivotBar;
plot1(HighsArray[counter]);
end;
Line 21 Col 75 marks the occurrence of "oPivotPrice" in the Pivot function call.

This is puzzling because the expression that is not recognized is exactly what is given as a parameter of the Pivot function in EL_FunctionsAndReservedWords_Ref.

I will be grateful if anyone has any suggestions as to what is going on here...

Thanks and regards

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Pivot Function

Postby Henry MultiСharts » 23 Oct 2014

Hello kelnihat,

You need to declare oPivotPrice and oPivotBar as variables in your code:

Code: Select all

vars: counter(0),
lookbacklength(50),
chartbn(0)
//
oPivotPrice(0),
oPivotBar(0);

Arrays: HighsArray[4](0), LowsArray[4](0), HighBarsArray[4](0), LowBarsArray[4](0);

chartbn = MaxBarsBack + CurrentBar;

if chartbn > (lookbacklength + 2) then
For counter = 4 downto 1
begin
Value1 = Pivot(high,lookbacklength, 2, 2, (5 - counter), 1, oPivotPrice ,oPivotBar);
HighsArray[counter] = oPivotPrice;
HighBarsArray[counter] = oPivotBar;
plot1(HighsArray[counter]);
end;

kelnihat
Posts: 7
Joined: 11 Sep 2014
Has thanked: 1 time

Re: Pivot Function  [SOLVED]

Postby kelnihat » 23 Oct 2014

Thank you Henry. I guess I missed that because the compiler's routine message for undeclared variables is "assignment is allowed only for variables or array elements". This helps a lot.

Regards


Return to “MultiCharts”