Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 627
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
Can you tell me how to calculate the collateral for a transaction?
Tried two approaches
(0.1 * Ask*MarketInfo(Symbol(),MODE_LOTSIZE))/AccountInfoInteger(ACCOUNT_LEVERAGE)
And this one
FreeMarginCheck=AccountFreeMarginCheck(Symbol(),OP_BUY,0.1);
double val=AccountFreeMargin()-FreeMarginCheck;
The first one gives strange results on EURJPY if my deposit currency is USD. Do I need to add something to the formula?
The second also works only once, sometimes it gives the right value, sometimes it gives some nonsense (it depends on the deposit)
The second variant is the correct way to calculate the deposit. To be more exact, the variable val shows the value of free funds after the order has been placed and the variableFreeMarginCheck shows the value of the deposit itself
The second option is the correct way to calculate the margin, or rather you get the value of free funds in the val variable after placing an order, and the variableFreeMarginCheck is the value of the margin itself
Are you sure?
AccountFreeMarginCheck
Returns the amount of free funds that will remain after the specified order is opened at the current price in the current account.
There is also a subtlety there:
If counter trades are open, i.e. there is a full or incomplete lock on the account, the function may give incorrect values.
Are you sure?
Yes, you're right, that's exactly right:
Returns the amount of free fundsremaining after opening the specified order at the current price in the current account.
about open trades, you need to check, I don't remember, but most likely what the terminal writes, should agree with calculated data: the total number of lots in each direction of trades (BAY/SELL) for all symbols then call for each symbol
AccountFreeMarginCheck() passing lots in each direction and summing up these results
The market is working today, it's easy to check it, like this
Greetings, could you tell me what's wrong with the function? The function performs a trade pause by time, the parameters are pause start and pause end.
The function reads the time not from the broker's server, but from the computer, despite the fact that TimeCurrent is prescribed. In general, trades are closed during the pause, i.e. the function does not work.
Greetings, could you tell me what's wrong with the function? The function performs a trade pause by time, the parameters include the start of the pause and the end of the pause.
The function reads the time not from the broker's server, but from the computer, despite the fact that TimeCurrent is prescribed. In general, trades are closed during a pause, it means that the function doesn't work.
UnprintTimeStart andStrToTime(TimeStart);
then unprintTimeCurrent()
yourTimeStart is not in full datetime format, i.e. the time will always be the current day, month and year when you run the EA, and then it will change?
And globally ... to determine the hours and minutes of trading hours and minutes should be compared to the hour and minute server time, you only compare the fact that the server time is longer than the specified one
SZZ: to save confusion, you maythink of datetime as an int, which it is and comparing 2datetime, you are comparing 2 int
PSPS:
your code will probably work, you should try it that way:
I usually count time this way:
int h = TimeHour(TimeCurrent());
int m = TimeMinute(TimeCurrent());
and then compare it with the EA settings
Thanks, I'll try to figure it out, I'm just a beginner), with && option instead of || I haven't tried online yet, by the way in tester this code works, it reads time from terminal, no closing of orders during pause, but online it's different.
Hello! The terminal does not start in the strategy tester. I set the date, for example (2017,04,01 to 2018,05,29), press start, it immediately gives a stop. In the log it says the following,
TestGenerator: no history data 'EURUSD30' from 2017.04.01 to 2018.05.29. And so on any segment. My computer is working, I thought it might not have enough RAM. Same thing on home computer, restarting doesn't help, but it runs for a while. I have downloaded the Expert Advisor from the Market, trial. If anybody knows the reason, please advise?
Hello! The terminal does not start in the strategy tester. I set the date, for example (2017,04,01 to 2018,05,29), press start, it immediately gives a stop. In the log it says the following,
TestGenerator: no history data 'EURUSD30' from 2017.04.01 to 2018.05.29. And so on any segment. My computer is working, I thought it might not have enough RAM. Same thing on home computer, restarting doesn't help, but it runs for a while. I have downloaded the Expert Advisor from the Market, trial. If I have any idea of the reason, can you please give me a hint?
I think the tester says there is no history data, press F2 and download the history, then reboot the terminal
Hello! The terminal does not start in the strategy tester. I set the date, for example (2017,04,01 to 2018,05,29), press start, it immediately gives a stop. In the log it says the following,
TestGenerator: no history data 'EURUSD30' from 2017.04.01 to 2018.05.29. And so on any segment. My computer is working, I thought it might not have enough RAM. Same thing on home computer, restarting doesn't help, but it runs for a while. I have downloaded the Expert Advisor from the Market, trial. If i know the reason, please advise?
Doesno history data mean anything?
It looks like the tester is telling you there is no history data, press F2 and download the history, then reload the terminal
Thank you! I will give it a try. Does updating the terminal affect it in any way? Whether it's updated or not, although it will tell you so itself......