First candle with a lower low
Forums › ProRealTime English forum › ProOrder support › First candle with a lower low
- This topic has 8 replies, 4 voices, and was last updated 8 years ago by Johan.
-
-
11/22/2016 at 4:38 PM #16957
I need to get the recent lower candle. How is this made? Have tried summation but in that case, say if i put in [5], i can get an even lower candle and also, a candle thats not lower then the closing one. I need the first candle that has a lower low then the closing candle.
Any suggestions?
11/22/2016 at 5:09 PM #16959To get the lower low, you only need to use the Lowest instruction : get the recent lowest low
11/24/2016 at 1:02 AM #17055Thanks Nicolas! I’ve tried that. But if, lets say that there are five lower candles after each other, “lowest” is going to pick the last candle since that’s the absolut lowest one. I want the get the low of the first. But if the first and the second have a higher low and then the third have a lower, then i want to pick the third. I did a strict “if” solution:
1234567891011121314151617181920//Recent lowif (low > low[1]) thenrl = low[1]rlBar = 1elsif (low > low[2]) thenrl = low[2]rlBar = 2elsif (low > low[3]) thenrl = low[3]rlBar = 3elsif (low > low[4]) thenrl = low[4]rlBar = 4elsif (low > low[5]) thenrl = low[5]rlBar = 5elserl = low - (x * pipSize)rlBar = 6endif…but rather have a function that can stretch back in time until it finds the lower low and then stop.
11/24/2016 at 10:12 AM #1707011/24/2016 at 12:53 PM #1708011/24/2016 at 1:49 PM #17091Hi Johan
First low, Last Low?? Out of 5 bars / candles there is only one bar that will be the lowest low (out of 5) and Nicolas code above will give you that.
Or do you want the low (in price?) of the first of 5 previous candles?
I am intrigued so get back to us please?
Regards
GraHal
11/24/2016 at 3:30 PM #17112I must admit I didn’t understand your question the first time around, now I think I do but to be honest, I’m still not sure… Let’s assume I have understood the question correctly, then I’ve come up with this to solve it. However, we need to be aware a “while” loop could end up in some cases being considered as an infinite loop without solution returning an error message, that’s why I’ve included a maximum number of candles to look back, you can change this number in case the chosen 100 value is not enough for your needs.
The main return is “barnumber”, it gives you the barindex value of the candle in the past with the most recent lower low than your current candle’s low. For easier visual localisation of such bar number found, I’ve added “barindex” in the return line too.
And I’ve added another line parallel to barindex which shows the oldest candle search limit in the past (the safeguard against infinite loop). When “barnumber” touches it, it means there was no success finding a lower low within the maximum chosen number of candles to look back.
That would be a probuilder piece of code of course. How you include this and make use of it within a larger piece of pro-order code and without the return line is up to you. Just remember to separate cases when a lower low is found before the limit, from cases it isn’t.
12345678910111213141516// Finding candle with most recent lower low than current candle's low// to help a fellow PRC forum member// By Noobywan Nov.24 2016//i=1maxcandlelookback=100oldest=barindex-maxcandlelookback-1while low[i]>=low doi=i+1if i>maxcandlelookback thenbreakendifwendbarnumber=barindex-ireturn barnumber as "candle number of most recent lower low", barindex as "barindex", oldest as "oldest candle search limit"11/28/2016 at 10:57 PM #1742911/28/2016 at 11:38 PM #17433 -
AuthorPosts
Find exclusive trading pro-tools on