Plotting True & False variables in imported indicators

Questions about MultiCharts and user contributed studies.
newatmc
Posts: 7
Joined: 09 Sep 2021
Has thanked: 6 times

Plotting True & False variables in imported indicators

Postby newatmc » 19 Jan 2022

Hello,

Having trouble compiling easy language indicators that I programmed and exported from TS and imported in MC64.
Always getting errors at the plot lines for True False variables. Everything else in the indicator is fine and compiles OK if those lines are commented out.
Any idea/help on why this is the case in the MC editor?

Thanks in advance, Mac

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

Re: Plotting True & False variables in imported indicators

Postby TJ » 19 Jan 2022

If this is a coding question, you have to post your codes.

newatmc
Posts: 7
Joined: 09 Sep 2021
Has thanked: 6 times

Re: Plotting True & False variables in imported indicators

Postby newatmc » 24 Jan 2022

Thank you TJ for the reply.
No, it is not a coding question because this indicator code worked fine in TS.
It is an error in compiling in MC. like I said, if the "Plot" line is commented out , the code compiles fine.

Mac

newatmc
Posts: 7
Joined: 09 Sep 2021
Has thanked: 6 times

Re: Plotting True & False variables in imported indicators

Postby newatmc » 27 Jan 2022

After some trial and error and looking into the help content I solved my problem.
Apparently, The Plot function in MC works only with Numeric or String variables. Boolean variables are not supported, therefore copying the easy language code directly from TS will not work if you try to plot it as an indicator. But boolean variables work fine in strategies. Not sure why this is the case in MC.

Mac

Example:

The following code will not compile and cause error at the first plot line on the PLot Argument.

"Invalid function argument.
line 17, column 6"

Variable : TimeAm(False), TimePm(False);

If time > 1200
Then
Begin
TimeAm = False;
TimePm = True;
End;

If time > 2400
Then
Begin
TimeAm = True;
TimePm = False;
End;

PLot1(TimeAm , "TimeAm");

PLot2(TimePm , "TimePm");
*************************************************************
But the following code will compile fine with no problems


Variable : TimeAm(0), TimePm(0);

If time > 1200
Then
Begin
TimeAm = 0;
TimePm = 1;
End;

If time > 2400
Then
Begin
TimeAm = 1;
TimePm = 0;
End;

PLot1(TimeAm , "TimeAm");

PLot2(TimePm , "TimePm");

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

Re: Plotting True & False variables in imported indicators

Postby TJ » 27 Jan 2022

See post #1 & #2
viewtopic.php?t=11713


Return to “MultiCharts”