Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Highest high for specific bars - easylanguage code suggestion
Hello, everyone,
I am not very experienced with easylanguage, I have difficulty in coding the command to find highest (high, 5) only among the previous bars that have a minimum lower than the level x.
I hope I have explained well, I also enclose an image for more clarity. The result should return the maximum of bar A.
Anyone have any suggestions?
Thank you in advance
Gioak
Can you help answer these questions from other members on NexusFi?
I would suggest looking into the "for loop" as you will have to cycle through the previous bars and only include those that are lower than X in your tracking of the highest high.
you can access the value for some reserved words like High by using a number within square brackets. Where the number specifies how many bars back from the currently processed bar you want to look at (while 0 is the most recent bar). Then you can compare this High and check it it matches your condition and only store it within a variable if it matches your condition and is higher than the currently stored value within the variable.
HI ABCTG,
thanks for the suggestions, my difficulty is in finding the correct criterion to distinguish first only the bars that have a minimum of less than x and then be able to find among them (only among them) the bar with the highest max.
I would suggest to start simple. Create a loop that simply finds the highest high over the last X bars, without using the highest high function. You would use a variable to store the highest high within the loop in, by checking if the High for the bar you are currently looking at is higher than the value stored in the variable. If it is, you update the variable, if if's not, you do nothing. The only thing to add would be to reset the variable each time before you start with the loop (for example by setting the variable value to -999999 to ensure that it can be updated to a new high and that you don't store old information in the variable).
HI ABCTG,
I think that highest high of x bars back is not useful, you don't need to know highest high unless it has a minimum lower than x.
Infact what you need to know with a loop from 0 to 5 is which lows are lower than X and then among them which one has the highest maximum, it will be A like pic. Between the 5 bars back there could be a higher high than A but if it doesn't have a minimum lower than x I don't care.