Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1474
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
I tried to make an analogue of the comment, but the letters were bigger.
Some time after running the Expert Advisor with a comment on several charts, something bad happens, up to the screen going out and rebooting the server)))))
It is clear that I am doing something wrong with the CCanvas class, but what exactly is wrong, I do not understand.
I think I got it. Correct me if I understood it wrong.
In my code, on each tick I create a resource with different names.
code from Canvas
And at the next refresh of the image this resource is not deleted, apparently.
The object is the same, but the resources are attached to it differently.
So I've redone the code.
I think it should be correct.
It doesn't write anything when compiling. It uninstalls and rebuilds. That's it.
It's still working on the server. I'll wait, maybe it will write something in the logs.
"Experts" magazine
Experts Magazine
In Experts Magazine, sterile cleanliness.
//---
We have generally solved the cause of the problem.
The question remains, how to delete a resource created by kanvas from memory when closing the programme.
I delete the object, it has a name, but the name of the resource is "protected" and you can't recognise it in any way.
Yes, OOP is a funny thing.
In the end I had to declare canvas in the global instead of in the function body and add canvas.Destroy() to the deinit;
Flight is fine)
Good day and good mood!
For a long time I have been using a ready-made function for calculating the lot depending on the risk, but it did not have a binding to the stop-loss size. Today I decided to write my own function from scratch in the form of a script (for ease of checking), but with the stop loss taken into account. Please see the formula for calculating the lot size (highlighted in yellow). Perhaps I missed something.
All kinds of checks for minimum, maximum lot, step, etc., etc., were not included, because I will do it later!
Regards, Vladimir.
Good day and good cheer everyone!
For a long time I have been using a ready-made function for calculating the lot depending on the risk, but it did not have a binding to the stop-loss size. Today I decided to write my own function from scratch in the form of a script (for ease of checking), but with the stop loss taken into account. Please see the formula for calculating the lot size (highlighted in yellow). Perhaps I missed something.
All kinds of checks for minimum, maximum lot, step, etc., etc., have not been included, because I will do it later!
Regards, Vladimir.
It is necessary to take into account the cost of one tick.
Be sure to consider the cost per tick.
Hi Alexey, thank you for responding. For the purpose of self-education, I would like to understand the purpose of taking into account the cost of one tick and also briefly explain in which part of the formula it should be applied, if you don't mind. Perhaps I have not quite understood what you are talking about.
Regards, Vladimir.
Hi Alexey, thank you for responding. For self-education purposes, I want to understand the purpose of taking into account the cost per tick and also briefly explain in which part of the formula to apply it, if you don't mind. I may have misunderstood what you are talking about.
Regards, Vladimir.
To determine the amount a trader is willing to lose in case of failure. Loss = Loss*pip value*lot. Hence - lot = acceptable loss/( Loss*pip value) The formula is approximate.
To determine the amount a trader is willing to lose in case of failure. Loss = Loss*pip value*lot. Hence - lot = acceptable loss/( Loss*pip value) The formula is approximate.
I see. I will think at my leisure how to implement it. Thanks for your advice!
Regards, Vladimir.
How can I find out the time of closing a position in the tester?
I open positions 1, 2, 3
I close positions 3, 2, 1
Neither in the tester report nor in the tester itself I have not figured out how to find out the closing time of a particular position.
The same in the report that the tester records, there is no way to find out the time of closing a position.
I need to find out the time of opening and closing a position. How?
In one of its librariesfxsaber writes: "Thank you to the developers for creating the Tester's caches and helping to open its formats".
I can't understand the library itself.
I could only find the format of opt files.
If anyone knows where on the forum disclose tst-files - single pass format, please give me a link, maybe I can find position_ID in them.
fxsaber if you read, please reply.
How do I know the time of closing a position in the tester?
I open positions 1, 2, 3
Closing positions 3, 2, 1
Neither in the tester report nor in the tester itself I have not figured out how to find out the closing time of a particular position.
The same is true for the report written by the tester, there is no way to find out the time of closing a position.
I need to find out the time of opening and closing of a position. How?
fxsaber in one of its libraries writes: "Thanks to the developers for creating Tester caches and helping to open its formats.
I could only find the format of opt files.
If anyone knows where on the forum they disclose tst-files - single pass format, please give me a link, maybe I can find position_ID in them.
fxsaber if you read, please reply.
Look for a market exit trade
DEAL_ENTRY_IN
Market Entry
DEAL_ENTRY_OUT
Exit the market
DEAL_ENTRY_INOUT
reversal
DEAL_ENTRY_OUT_BY
Closing with a counter position
and look for position ID on the ticket of this trade
DEAL_TICKET
Ticket of the trade. A unique number that is assigned to each trade
long
DEAL_ORDER
Order, on the basis of which the deal was executed.
long
DEAL_TIME
Time of transaction execution
datetime
DEAL_TIME_MSC
Time of transaction in milliseconds since 01.01.1970
long
DEAL_TYPE
Deal type
ENUM_DEAL_TYPE
DEAL_ENTRY
Direction of the trade - market entry, market exit or reversal
ENUM_DEAL_ENTRY
DEAL_MAGIC
Magic number for the trade (seeORDER_MAGIC)
long
DEAL_REASON
Reason or source of the transaction
ENUM_DEAL_REASON
DEAL_POSITION_ID
Identifier of the position, in the opening, modification or closing of which this deal participated. Each position has a unique identifier, which is assigned to all deals executed on the instrument during the life of the position.
long
Generally speaking, the time of a deal exiting the market is the time of position closing.