Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 238
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
What's not to understand here. Above the bar is in a general sense. For the bottom line, it's under the bar. The leftmost point is actually where the line starts from.
Details are important.
Well it is shown in the data window. Walk up the line. It's at the penultimate minimum. That's the value I was able to take
So the indicator has two buffers. It outputs values for bar1. For bar0 you need to calculate it as I said before.
Write it completely properly.
That's how I did it!
Write it completely correctly.
You need to calculate the value at bar0. Equation of a straight line:
By the names of the formal variables it's all clear what to pass to the function.
Returns the value on the bar you are looking for.
You need to calculate the value at bar0. Equation of a straight line:
By the names of the formal variables it's all clear what to pass to the function.
Returns the value at the sought bar.
Oh my goodness, it's complicated. I managed to get the value, all I have to do is write ObjectGetValueByShift, ewww. Please send me some video tutorials, I've looked at how to do indicators but didn't find that there. Everything works. Taken from the same questionhttp://www.mql5.com/ru/forum/121347
I have no idea if it's possible to make buffers like this... but it works. I don't really understand what ncurbar is.
//---- Move Object in Chart
ObjectMove("Trend DN-0",1,Time[st1],s1);
ObjectMove("Trend DN-0",0,Time[st2],s2);
Dn[nCurBar] = ObjectGetValueByShift("Trend DN-0",0);
//----
ObjectMove("Trend UP-0",1,Time[rt1],r1);
ObjectMove("Trend UP-0",0,Time[rt2],r2);
Up[nCurBar] = ObjectGetValueByShift("Trend UP-0",0);
Oh my goodness, it's complicated. I managed to get the value, all I have to do is write ObjectGetValueByShift, ewww. Please send me some video tutorials, I've looked at how to make indicators but didn't find any such thing there. Everything works.
//---- Move Object in Chart
ObjectMove("Trend DN-0",1,Time[st1],s1);
ObjectMove("Trend DN-0",0,Time[st2],s2);
Dn[nCurBar] = ObjectGetValueByShift("Trend DN-0",0);
//----
ObjectMove("Trend UP-0",1,Time[rt1],r1);
ObjectMove("Trend UP-0",0,Time[rt2],r2);
Up[nCurBar] = ObjectGetValueByShift("Trend UP-0",0);
Now, make the EA unwind the value you get from the line into the log and run it NOT in visual mode. Stop the test and look at the log.
I told you that you can't get values from graphical objects in the tester not in visual mode - they just don't build.
And it is difficult for you to add to the indicator a normal calculation of just one line for each value of two lines.
Well, I won't persuade you.
Now make an EA printout of the value you get from the line into the log and run NOT in visual mode. Stop the test and look at the log.
I told you that you can't get values from graphical objects in the tester not in visual mode - they just don't build.
And it is difficult for you to add to the indicator a normal calculation of just one line for each value of two lines.
Well, I won't talk you into it.
I just don't know how to add it.
I don't understand, I'm getting errors, where to add itI just don't know how to... where to add it...
I don't get it, I have errors, where to add itDo you know what a function is? I gave you a function. You can write it outside of the body of any indicator function and call it from the code by entering the necessary data. In the output it will give you the price of the bar you are looking for.
I wrote an article about 300 years ago on mql4.com - there is a description of how to work with the straight line equation - the function is now modified, but it hasn't changed its function that returns the price of the bar.
Here's an indicator based on that article.
Do you know what a function is? I gave you a function. Write it outside of the body of any indicator function and call it from the code by entering the required data. In the output it will give you the price of the bar you are looking for.
I wrote an article about 300 years ago at mql4.com - there is a description of how to work with the straight line equation - the function is now modified, but it hasn't changed its function that returns the price of the bar.
Here's an indicator based on that article.
I think it makes no difference how to take the price in real trading, because the indicator and the Expert Advisor have to be attached to the chart?