How do you combine 2 Functions?

Questions about MultiCharts and user contributed studies.
shortski
Posts: 27
Joined: 21 May 2008

How do you combine 2 Functions?

Postby shortski » 07 Dec 2008

Hi all. I am trying to get an Indicator into my scanner that reflects a condition based on the results of 2 other Indicators. I think it is relatively simple but anything I try won't compile. I was trying to get a Text to show up on the chart that showed a B when both functions were >0 and an S when both Functions were <0. Didn't work. Suggestions? TIA.

This is where I started;


vars:

value1 (0),

value2(0);

value1 = $rtOscillatorDivergence(high,low,MACD(close,12,26),1.0);

value2 = ThreeLineBreak;

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

Postby TJ » 20 Jan 2009

there must be a mismatch of input/output.

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

Re: How do you combine 2 Functions?

Postby Marina Pashkova » 26 Jan 2009

Hi all. I am trying to get an Indicator into my scanner that reflects a condition based on the results of 2 other Indicators. I think it is relatively simple but anything I try won't compile. I was trying to get a Text to show up on the chart that showed a B when both functions were >0 and an S when both Functions were <0. Didn't work. Suggestions? TIA.

This is where I started;


vars:

value1 (0),

value2(0);

value1 = $rtOscillatorDivergence(high,low,MACD(close,12,26),1.0);

value2 = ThreeLineBreak;
Hi shortski,

1) You do not need to necessarily declare value1 and value2 as variables
2) If your functions are written correctly, there should be no problems. See the code below:

Code: Select all

value1 = $rtOscillatorDivergence(high,low,MACD(close,12,26),1.0);
value2 = ThreeLineBreak;

if ( value1 > 0 and value2 > 0 ) then
plot1("B");
if ( value1 < 0 and value2 < 0 ) then
plot1("S");

shortski
Posts: 27
Joined: 21 May 2008

Postby shortski » 26 Jan 2009

Marina, I think this will work in Ver 5.0 but I am using 4.0 still. I will check it out though. Any idea when Ver 5.0 will be released as a fully functional version?

Thanks

S

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

Postby Marina Pashkova » 27 Jan 2009

Hi Shortski,

I was not aware that you were using 4.0 release. What I suggested would, indeed, work only for MC 5.0 beta 2.

Gold Release (the next official release) is planned for the end of February - beginning of March.

Regards.


Return to “MultiCharts”