Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1091
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
1. Try in MetaEditor: File --> Open shared data folder. You will see the path to the folder. This issue has been discussed many times, here is a link for example
2. Try it without include at first. When you will debug it, you will start to include it.
3. Insert your sources here either by using SRC button above, or by using Attach file button below.
Please advise how to draw a horizontal line at the opening price of the bar at 07:00.
I have written this code, but the line is not drawn for some reason. Where is the error?
Please advise how to draw a horizontal line at the opening price of the bar at 07:00.
I have written this code, but the line is not drawn for some reason. Where is the error?
If you remove ObjectMove, the line is visible? Try Alert(StartPrice);
If you remove ObjectMove, you cannot see the line, but ifyou write a numeric value instead of "IndexOfBar", for example, "double StartPrice = Open[5];" it draws the line at the opening price of the fifth bar.
Thanks for the idea with Alert - it shows "0" value.
By the way, the line also exists in the list of objects with the value 0.
Please advise how to draw a horizontal line at the opening price of the bar at 07:00.
I have written this code, but the line is not drawn for some reason. Where is the error?
You cannot draw and calculate in the inite, it is a gross error. The inite must finish its work as fast as possible.
The error here isint IndexOfBar = iBarShift(ChartID()_Symbol,PERIOD_H1, StringToTime(StartTime), true); //read the index of the bar by the given time StartTime
The time can be set directly in datetime format, no need to waste machine time on conversion, works like this:
You can't draw and calculate in the init, it's a gross mistake. The init should complete its work as quickly as possible.
The error here -int IndexOfBar = iBarShift(ChartID()_Symbol,PERIOD_H1, StringToTime(StartTime), true); //read the index of the bar by the specified time StartTime
The time can be set directly in datetime format, no need to waste machine time on conversion, works like this:
Thanks for the valuable tips for me.
And special thanks for raising my morale by finding the error. I'm starting to believe again that I can make friends with MQL4
You can't draw and calculate in the init, it's a gross mistake. The init should be completed as quickly as possible.
And if you take the calculations from the inite into a separate function and then insert this function into the inite, it won't be a gross error?
It already works.
And if you take the calculations from the inite into a separate function, and then insert this function into the inite, it will not be a gross error?
If the code is executed too long, the inite will terminate forcibly and the code simply will not have time to be executed. The executed code, including calls of secondary functions, must be in the predefined functions of MQL - OnTick() for Expert Advisors, OnStart() for scripts, OnCalculate() for indicators.
The inite must contain the minimum of code, only those things that must be executed once, right before the start of the program. For example, initialization of global variables, arrays, indicator buffers.
Indicators, EAs, scripts; templates, profiles; accounts