工作已完成
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
指定
Hello,
I need a function that outputs the following information. Starting from each and every individual candle within a designated period, check how many times the price continues to fill out an n1, n2 and n3 pip range in the following candles after the first candle, without retracing an x% pull-back.
To clarify…
Take the bullish case, starting from 1st candle, assuming the pull-back is to be less than or equal to 60% of the range;
"Check criteria is met for each candle"
If C1 Positive,
C2H-C1L = CURRENT RANGE
If C2L>=0.6*(CURRENT RANGE)+C1L,
"Then get new current range"
C3H-C1L=(CURRENT RANGE)
IF C3L>=0.6(CURRENT RANGE)+CL1,
Gent new current range,
C4H-C1L=(CURRENT RANGE) etc,
Else ("if current loop has failed to meet maximum allowed pull-back objective,i.e. C2L< 0.6*(CURRENT RANGE)+C1L, start looking for new sequence in next candle")
if C3 is positive
C4H-C3L = CURRENT RANGE.
If C4L>=0.6(CURRENT RANGE)+C3L,
"Get new current range"
C5H-C3L=(CURRENT RANGE)
If C5L>=0.6(CURRENT RANGE)+C3L,
And so on and so forth...
Then if total pip value of current range from any(C1-Cn) >= n1, n2 or n3, display output.
For example, if i choose to run it over a week, using 2-minute candles, it would perform the function on every individual 2m candle required in that particular week for both the negative and positive runs, and output the results. So if we had inputs such as,
Duration of test =19/8/2013 - 23/8/2013
Timeframe check =2m
Minimum pullback =60%
check n1 ranges =50 pips
check n2 ranges =70 pips
check n2 ranges =100 pips
In this case the routine would output how many times the n1-n3 ranges were filled without ever seeing a 60% pull-back. As I have said, this would be performed on 2m candles over the span of a week. With output similar to the following;
Long Short
n1 fill 34 45
n2 fill 18 24
n3 fill 12 15
Along with a green, amber, and red dot (or some marking) on the chart for each time the function was successfully performed.
I have an indicator that can do the process manually if it helps. I am also happy if the coder finds it quicker/easier to separate the long and short functions. If anyone understands what i need then get in touch.