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)
how to extract nearest support price from arraylist?
A very long time ago I wrote a strategy to trade Murrey Math lines, and I wrote some functions to get all the levels. I'm willing to share the strategy, but only for elite members (which this thread is not). Can be easily adapted to Pivots.
I wrote this strategy over a year ago for NT. I haven't looked at it in a year, but I've received dozens of requests from people who read about the strategy for me to sell it or give it to them, etc. I've always declined, but the fact is, …
Here's the code I ended up with. (including all the debugging Print statements & a Plot statement) price is typically going to be Close[0] srOffset is how far price need to be away from any S/R lines. IE. if there is an S/R at 90 & 100, the trend is up, and you want price to confirm above 110 before using S/R @ 100 then set srOffset = 10, when price gets to 100, 90 will be returned. Trend = true for up trend, false for down trend. srList hold the list of S/R line values.
1) srList is an "array" (specifically an ArrayList, Google it) that stores all the s/r (Support/Resistance) price values. It's up to you to determine these values and store them in an ArrayList. As a side note. Static values would be horizontal s/r lines. If you want to use dynamic s/r lines, such as a 200, 100, & 50 SMA for s/r, then you would have to update the srList array on every bar.
2} Trend could be determined by the slope of an MA, LinRegSlope ind., DM ind., or whatever your favorite sloping indicator is. If the slope is up then Trend would equal true.
Hello senior members,
can we code the above function into amibroker ?.
i.e=
my value=300;
h1=310,h2=320,h3=325,h4=312,h5=318......
out of h1,h2,h3 i want to find out which value is nearest to my value i.e 300
Thank you