Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1041
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
Try asking the question differently, your question may not be clear
I'll try to explain. But bear in mind that I am not a programmer, practically.
We have a tick indicator that builds a curve on bid values.
Now what I want to do.
Attach the indicator to the chart. Get the first value of bid1 on the first tick. Remember it (I did so - I enter the second buffer y[0] and record its value in init()).
On the second tick we obtain the second value of bid2.
Then we need to get the difference in points. delta=bid1-bid2 (I did it this way: delta=x[0]-x[1]).
Now add delta to y[0] and obtain the value of y[1], which actually corresponds to the value of bid2.
The indicator curve should be identical to the one we are looking for but it is plotted using the calculated values of bid differences.
This indicator is needed as a template for further calculations.
Do not throw stones. I explained it as best I could.
Thank you.
I'll try to explain. But bear in mind that I am a novice programmer, practically.
We have a tick indicator, which builds a curve by bid values.
Now what I want to do.
Attach the indicator to the chart. Get the first value of bid1 on the first tick. Remember it (I did so - I enter the second buffer y[0] and record its value in init()).
On the second tick we obtain the second value of bid2.
Then we need to get the difference in points. delta=bid1-bid2 (I did it this way: delta=x[0]-x[1]).
Now add delta to y[0] and obtain the value of y[1], which actually corresponds to the value of bid2.
The indicator curve should be identical to the sought after indicator but it is plotted using the calculated values of bid differences.
This indicator is needed as a template for further calculations.
Do not throw stones. I tried to explain it as best I could.
Thank you.
It is not clear what you want to do
Here is the general problem - you use indicator buffers as an array for storing ticks (Bid), the size of the indicator buffer changes the terminal itself, and in addition - the terminal shifts the indicator buffers itself at appearance of a new bar
you should use an array for storing ticks, and use an indicator buffer for drawing
i have created a code similar to yours, where i save ticks in an array
Now, you should add your calculation to this code and draw it using the indicator buffer Label1Buffer as per your idea
it is not clear what you want to do
here is the exact problem - you use indicator buffers as an array for storing ticks (Bid), the size of indicator buffer changes the terminal itself, and in addition - the terminal shifts the indicator buffers itself when a new bar appears
you should use an array for storing ticks, and use an indicator buffer for drawing
i have created a code similar to yours, where i save ticks in an array
Now, you have to add your calculation to this code and draw it using the indicator buffer Label1Buffer, as per your idea
Thank you for replying. I will torture you a bit more.
Do I add the calculation here?
Here is my calculation.
Added it and nothing.
It would be nice if they added the possibility to change properties of another indicator programmatically. Roughly speaking, after adding (programmatically) another indicator to the chart, you can set the colour, style and thickness of lines
Use Canvas and draw cartoons.
I'll attach a picture more.
Added and nothing.
that's not how it works ))))
To draw using indicator buffers in MQL, it means to put a value in the indicator buffer - in my example, it is Label1Buffer (assign a value)
in your example you assign values only when a condition is met and if the condition is not met? - So nothing will be printed.
And again, I created a "template" where the array TickArr contains the values of ticks Bid, but in your conditions you use the previous values of the indicator buffer - and who put what values in these buffers?
Try to draw a line by the indicator buffer, then you'll compare the ticks.
I'll attach a picture more.
What if the angle is reversed? How would the calculation be done?
I'll attach a picture more.
that's not going to work ))))
To draw using indicator buffers in MQL, it means to put a value (assign a value) to the indicator buffer - in my example, the Label1Buffer
in your example you assign values only when a condition is met and if the condition is not met? - So nothing will be printed.
And again, I created a "template" where the array TickArr contains the values of ticks Bid, but in your conditions you use the previous values of the indicator buffer - and who put what values in these buffers?
Try to draw a line by the indicator buffer, and then you will compare the ticks.
I warned that I'm a hacker.)
I did it that way.
Now it draws the tick chart but there are some line breaks.
I'm doing a 4.