Put a variable instead of the zero in shift[0]
cryptex, you want something like this. You simply change the "shift" parameter in the iClose() function to change the price you are looking up.
Using minutes, to get the close of the current bar, you would do iClose(Symbol(),PERIOD_M1,0), to get the close of one bar ago, you would do
iClose(Symbol(),PERIOD_M1,1), notice the "1" instead of a "0". This code will loop through the closes(minute-by-minute) of the past 24*60 bars.
int toCount = 24 * 60; for( int i = 0; i < toCount; i++ ){ double close = iClose(Symbol(),PERIOD_M1,i); //Do what you want with price here. }
ah got it. forgot to write double before close :D my bad

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi everyone,
So i am working on this code. I am looking to get the prices over a period of 24*60 minutes on a minute by minute basis. Now the iclose function takes symbol, time frame and shift as inputs. i was wondering if there is any way to make this shift a variable. something like run shift[0] to shift[24*60] in a loop 24*60 time. is it possible to incorporate this into the iclose function?