Conditional Statement  [SOLVED]

Questions about MultiCharts and user contributed studies.
Guest

Conditional Statement

Postby Guest » 11 Dec 2006

I need a little easylanguage help.

I'm trying to build a conditional statement based on the following. If an RSI value goes below 30, I want the conditional statement to remain true until the RSI goes back above 70. => "Once RSI<30 then true UNTIL RSI>70"

I've attached a chart demonstrating what I'm looking for. Also, here is my attempt at building this. As you can see I'm counting the number of bars since this condition was true. It compiles, however, I know that it isn't correct.

Variables: RSIValue(0).
Counter(0);

if RSIValue<30 then begin
while RSIValue<70 begin
counter=counter+1;
end;
end;

Guest

Postby Guest » 11 Dec 2006

The attachment is too big so I can't include the chart. Let me know if you need more info.

Guest

Postby Guest » 11 Dec 2006

Well i think you need to make the rsi value a array
Rsivalue []

Then loop through array values.
while RsiValue[counter] > 70 begin
counter=counter+1;

end;
end;

User avatar
Stanley Miller
Posts: 556
Joined: 26 Jul 2005
Has thanked: 3 times

  [SOLVED]

Postby Stanley Miller » 11 Dec 2006

If I understand you correctly it should be something like this:

Code: Select all

inputs: Length(12);
Variables: Counter(0), MyRSICondition(false);

if RSI(close, Length) < 30 then
MyRSICondition = true;

if RSI(close, Length) > 70 then
MyRSICondition = false;

Guest

Postby Guest » 11 Dec 2006

Thanks guys,

I actually took the guest's advice and created an array. Then the array would act as my conditional statement. It works great!

Thanks again!


Return to “MultiCharts”