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
Good afternoon!
I'm trying to write a function that determines the profit for the current day:
Can you tell me how in the function
Specify period starting from current day. It is clear that end of period to_date=TimeCurrent(), how to correctly specify start of period from_date, so that it starts from 00h:00m:00c of current day?Choose to taste:
Or the most, the most. Which has already been suggested.
Assuming that there was at least one tick today, the algorithm is as follows: the current time is sent to theMqlDateTime structure. Then set the hours, minutes and seconds to zero in this structure. It remains to convert the edited structure into a time:
Result:
Thank you! Another question, if I add a function
to the Expert Advisor, how will the period for which trades are analyzed be updated? For example, if my Expert Advisor works for a couple of days, then when the next day comes, the period will be updated?
Implementation of the above function in the Expert Advisor:
Thank you! Another question, if I add the function:
to the Expert Advisor, how will the period for which trades are analysed be updated? For example, if the Expert Advisor works for a couple of days, then with the next day the period will be updated?
The implementation of the above function in the Expert Advisor:
The time should be set from the beginning of a day to the current time + day or + three days.
You already know how to determine the beginning of day.
Good afternoon!
There is a need to determine the spread for a symbol before placing an order on it. The standard MQL5 library includes CSymbolInfo class. That's when I started wondering, which way is better to implement this check - via CSymbolInfo or using a function? Please, expert, advise me on what to do! If this question has already been raised, I will be very grateful if you direct me in the right direction.
Good afternoon!
I am in need of some advice. How bars are calculated when an EA contains signal modules from different timeframes?
For example, I have a simple Expert Advisor that has two signal modules based on stochastic (when the main line is above the signal line on 0 and 1 bars - BUY, below the signal line on 0 and 1 bars - SELL) - one on H1 and the other on M15. Weights of both modules are the same and in the Expert Advisor the threshold for opening of a deal is set in such a way that signals from both modules should be considered simultaneously. The Expert Advisor works on the chart at timeframe H1. If you look at the screenshot of H1, everything is clear - the main line is higher than the signal line on the last and penultimate bars and that is why we buy. But on the chart of M15 I cannot understand which bar should be considered as 0 and which as 1? The deal is open - it means that on M15 the condition for the deal should be fulfilled as well.
For example, there is a simple Expert Advisor that includes two signal modules based on stochastic (when the main line is above the signal line on 0 and 1 bars - BUY, below the signal line on 0 and 1 bars - SELL) - one for H1, the other for M15.
Good afternoon!
I am in need of some advice. How bars are calculated when an EA contains signal modules from different timeframes?
For example, I have a simple Expert Advisor that has two signal modules based on stochastic (when the main line is above the signal line on 0 and 1 bars - BUY, below the signal line on 0 and 1 bars - SELL) - one on H1 and the other on M15. Weights of both modules are the same and in the Expert Advisor the threshold for opening of a deal is set in such a way that signals from both modules should be considered simultaneously. The Expert Advisor works on the chart at timeframe H1. If you look at the screenshot of H1, everything is clear - the main line is higher than the signal line on the last and penultimate bars and that is why we buy. But on the chart of M15 I cannot understand which bar should be considered as 0 and which as 1? The deal is open, it means that on M15 the condition for the deal should be met as well.
On the history you see already closed bars and the zero bar is not an evil, but it is mobile and we have to take it into account, because it is formed depending on the current price and stochastic changes of direction are possible when prices jump, soit is more sensitive, it can close for example.
Try adding one more bar just to open 0 && 1 && 2. maybe the plums will be reduced.