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?
Problems with the MRO function [SOLVED]
-
- Posts: 38
- Joined: 31 Oct 2015
- Has thanked: 1 time
- Been thanked: 2 times
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
Re: Problems with the MRO function
You can always use MRO + 1.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?
-
- Posts: 38
- Joined: 31 Oct 2015
- Has thanked: 1 time
- Been thanked: 2 times
Re: Problems with the MRO function [SOLVED]
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!
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!