Problems with the MRO function  [SOLVED]

Questions about MultiCharts and user contributed studies.
bluefightingcat
Posts: 38
Joined: 31 Oct 2015
Has thanked: 1 time
Been thanked: 2 times

Problems with the MRO function

Postby bluefightingcat » 19 Jan 2016

I am having trouble finding a nice solution to the following.

I want to count the number of bars since a certain condition happened. e.g. I want to count the number of bars back when close > close[1].

I try and achieve this using the function MRO. However according to the Easylanguage guide MRO will give a value of "0" if my condition is met on the current bar.

I want to have the value to be 1 if the condition is met this bar and 2 if the condition is met last bar and 3 if the condition is met 2 bars ago etc....

Any ideas how I could achieve this?

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

Re: Problems with the MRO function

Postby TJ » 19 Jan 2016

I am having trouble finding a nice solution to the following.

I want to count the number of bars since a certain condition happened. e.g. I want to count the number of bars back when close > close[1].

I try and achieve this using the function MRO. However according to the Easylanguage guide MRO will give a value of "0" if my condition is met on the current bar.

I want to have the value to be 1 if the condition is met this bar and 2 if the condition is met last bar and 3 if the condition is met 2 bars ago etc....

Any ideas how I could achieve this?
You can always use MRO + 1.

bluefightingcat
Posts: 38
Joined: 31 Oct 2015
Has thanked: 1 time
Been thanked: 2 times

Re: Problems with the MRO function  [SOLVED]

Postby bluefightingcat » 20 Jan 2016

Thanks TJ.

I came up with +1 idea myself but it doesn't work with the rest of my code. Your previous suggestion seemed to be better in my case!


Return to “MultiCharts”