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;
How do you combine 2 Functions?
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Re: How do you combine 2 Functions?
Hi shortski,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;
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");
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007