Hello all
I have an issue to get ibarshift value.
Actually my current chart is m1 and i get open value from h1.
If i am working on future candle then i know i barshift is 0.but when i work on history bar
Let say m1 chart current time 27 oct 2021-11:55
And i try to the value of 60bar it mean then time is 27 oct 2021-10:55.. so i want to return 1 According to h1
Please help me to solve this
Thank you in advance
Megha
- Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6.
- Please help: iBarShift returns incorrect value for period = PERIOD_MN1
- Get value from iBarShift().
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button) or attach the file.
How To Ask Questions The Smart Way. (2004)
Be precise and informative about your problem
We can't see your broken code.
to get bar number from datetime :
datetime newDt= TimeCurrent()-PeriodSeconds(PERIOD_H1); int n= iBarShift(_Symbol,PERIOD_M1, newDt, true); Print(TimeToString(newDt), " - bar: ", IntegerToString(n));
but when you use "true" & this date is absent on this chart (e.g. week_end or the hole on the chart) - of course you will get -1 -- see iBarShift...
if you'd like to get vc.vs.datetime from bar_number - you do not need iBarshift
Print(iTime(_Symbol,PERIOD_H1,1)); Print(iTime(_Symbol,PERIOD_M1,60));
iBarShift - Timeseries and Indicators Access - MQL4 Reference
- docs.mql4.com
iBarShift - Timeseries and Indicators Access - MQL4 Reference
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