Anyone willing to teach me and provide a solid example of
Arrays.
Specifically speaking - I want to keep track of the Hi and Lo of every 15 minute candle who’s tick volume is 800 or more ( sort of intraday support and resistance if you will) From there I want to be able to ‘identify’ which level was broken. and be able to know what the opposing level is.
I am sort of clueless how to know that I am picking the correct levels.
so here is my thought coding - do not critique the syntax I know it isn’t right
init Array1[ ] [ ] // two dimensional for the hi and low price value but I do not know how many candles during the day will reach 800 tick volume so I do not know the size of the array
I think then I need to make a determination on the number so lets say record a max of 20 candles that reach 800 level - so
init Array1[20] [20] // but this is a 20 by 20 grid right? so 400 entries into an array - – but I only need 40 entries – So does a single array work - -where I just need to know the
even values of the series is the high and the odd values of the series is a low.
so now
init Arra1 [39] // this will get me a 1 column array?
So how to fill that array?
For (cnt = 0; cnt < fctr; cnt ++) where fctr is a candle count defined by dividing the real time by 15 minutes to get how many candles there are (I am fine getting this code)
if (vlme of [cnt] > 800)
{
hi = ihigh(cnt candle)
FillArray Array[hi]
lo = ilow(cnt candle)
fillArray Array[lo]
}
// so after typing that - - I know it isn’t close - so how do yo fill an array so the highs of the candles of volume > 800 go in the ‘even’ and the lows go in the ‘odd’ OR what else do I need to look at.
So how about two arrays one for the high and one for the low - and fill each at the same time - therefore each element will be the corresponding
Ahigh []
Alow []
then if price breaks a level in say Ahigh - then I can find it’s element number and choose that same element number from the Alow array.
if vlme > 800
h=(ihigh cnt)
l=(ilow cnt)
Ahigh[cnt] = h
Alow[cnt] = l
Like I said - I am not very familiar with arrays - - -but this one looks/sounds a little more promising - -I’ll be working on it this weekend. BUT I still wouldn’t mind some advice on efficiency and or a better way to go about this etc. . . or even confirmation that this route is feasible.
To me this is very confusing. An array of volumes for every bar already exists - the predefined MQL4 Volume[]. Just loop through it and find what you need using the index. Storing redundant data into another structure is a lot of work and inevitably leads to inconsistencies between them.
I don’t really want an array of volumes - I want an array of prices - - determined only by candles – who’s volume for the time period of 1 15minute candle was 800 or more.
OK, I was a bit confused. But its the same thing, don’t store prices into another structure when it already exists in another. Extract the data you need, manipulate it, chart it and discard it.
I don’t think I have code that is close enough to be worthwhile.
But you don’t need a fancy structure and dynamic arrays. I think a fixed length arrray of 2000 should do. Loop through Volume[], storing the indices of the bars that > 800. Then loop through the array looking up prices using the index and chart the results. When a new bar is formed, repeat the same process. This can probably be optimised, but the main thing is to get something simple working. Two dimension arrays with dynamic resizing is not simple and not necessary.
That’s fine - -here is what I’ve got so far and is working for me (I think!) - I did change time frame and volume to get more data to ensure I was getting the right numbers. Is this what you’re saying?? or no?
edited::::Oh by the way - I am not asking anything of you in case you read the last comment in my code- that is directed at me I am only asking the above - bolded stuff.
you may presume wrong == in the sense that - - I thought I sorta was – but now that you state it - - I realize I am not = == but that is a piece of great advice and I will implement it.