Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 770
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
Use the ATR indicator
Thanks, but I still don't understand how it can be used in my case.
Someone threw a link to CopyRates (Thank you, unfortunately the comment has been deleted), so I'm trying to understand iVolume() is the difference between High and Low price or something else ?
I.e. in my case (as I understand it) I can create an array of monthly and weekly data and then average the values, etc.
trying to understand iVolume() is it the difference between High and Low price or something else ?
these are tick volumes, right click on the chart in MT and select show volumes - histograms will appear at the bottom of the chart - this is it
https://docs.mql4.com/ru/series/ivolume
these are tick volumes, right click on the chart in MT and select show volumes - histograms will appear at the bottom of the chart - these are them
https://docs.mql4.com/ru/series/ivolume
Thank you very much for the clarification.
So that leaves the following: Create 2 arraysHigh and Low to calculate data for the month and 2 arraysHigh and Low to calculate for the week.
Then everything is averaged, etc.
I'll try to implement it all in the code...
I have another question: what is better to calculate the last month and last week?
Judging by the example :
Reference by initial position and number of required elements
intCopyHigh(
stringsymbol_name,// symbol name
ENUM_TIMEFRAMEStimeframe,// period
intstart_pos,//where to start
intcount,// how many we copy
doublehigh_array[]// array for copying of maximum prices
);
timeframe = PERIOD_D1;
start_pos = 1; // previous bar
count = 30; // 30 days (month)
Another question: What is the best way to count the last month and the last week?
It's better to date it, as there are skips of bars and weekends when there are no bars, so this will help:
https://docs.mql4.com/ru/series/copyhigh
It would be better to date, as there are skips (quotes) of bars and weekends when there are no bars, that would help:
https://docs.mql4.com/ru/series/copyhigh
Thanks, just how to let the EA (Robot) know what date to start with and where to stop.
I find it easier to count 30 candles (30 days) from 1. Or 7 candlesticks (days).
I got this code:
But unfortunately it gives out a value = 0.
Can you tell me where the error is...
And also...
How to make calculation once a week at the beginning of session or when terminal was restarted ?
Thanks, but I haven't yet understood how it can be used in my case.
The essence of ATR is the average height of bars over a period. Might as well use MA(high)-MA(low). It's easier than unfolding the overshoot
The essence of ATR is the average height of bars over a period. You might as well use MA(high)-MA(low). It's easier than reversing the overshoot
i.e. according to the Example
intiATR(
stringsymbol,// symbol name
ENUM_TIMEFRAMESperiod,// period
intma_period// averaging period
);
double Awerage30= iATR(Symbol(),PERIOD_D1, 30); this will be the average numeric value for 30 days ?
i.e. according to the Example
intiATR(
stringsymbol,// symbol name
ENUM_TIMEFRAMESperiod,// period
intma_period// averaging period
);
double Awerage30= iATR(Symbol(),PERIOD_D1, 30); it will be the average value for 30 days ?
Not calendar days. 30 days backwards (Sundays, Saturdays)
Judging by the function without parameter shift you are doing in 5, and you asked a question in 4 :)
Just not the calendar ones. 30 day bars backwards (Sundays, Saturdays)
Judging by the function without the shift parameter you are doing in 5 and you asked the question in 4 :)
This branch is on both terminals. Especially with the same functions.
Should the title be corrected then?