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)
I am facing a bit of difficulty in understanding how to manage arrays...hope you can help.
I would like to store in an array the data of the bar where a variable was true (the last 10 times).
I mean, suppose a var is true if I find a divergence... I would like to store in the array the (Date, time, Open, High, Low, Close) of that bar...and do that for the 10 most recent bars where "myvar" was true.
So I would set up an array with 10 rows and 6 colums...but I am not able to write the routing to fill the data in the array.
can you please help?
thanks a lot!
ciao
Can you help answer these questions from other members on NexusFi?
it might be simpler to start out with one dimensional arrays at fist and once you have the logic correct, you can always convert it to a multi dimensional array.
You will most likely have to use a FIFO approach i.e. keep track of how many values you have in your array already and start overwriting the oldest value in case a new one should be stored (once your array is fully populated).
thanks ABCTG for your advice. re-thinking to my question, I think that my problem actually is not with the arrays (...not yet ) but regarding how to get the values when my condition was true.
how do you get the high of the bar where myVar was true last time? and the time before?
as code in Multicharts is executed bar by bar starting with the first bar on the chart (as determined by the max bars setting for the study), you can simply store the values on each bar when your condition is true. This is much more effective (performance wise) than looking back for the last times your conditions have been true.