Good afternoon.
My expert Advisor selects new indicator parameters at regular intervals per day and overwrites them to the same handle. How can I make it forget the previous handle in the strategy tester? And then, the amount of RAM used grows to the limit.
Thank you already.
hoz
I will not say how it works in MT, but usually, in any other language, for example, Java, any handle is a link, i.e. a pointer. So this pointer can be reset. How it works here, you need to ask the support. The question is even how to check whether it is erased or not. After all, there is no way to run through the handles. Except to remember them and then after deleting check if there is one in the array. But it needs to be checked. And I have schyas head another question puzzled.
savinkins
Do you really think that the entire data array calculated by the indicator is stored in a primitive type variable? Obviously, int is the index that the EA uses to access the indicator’s handle. Reset the index will not lead to the nullification of the handle. This is what IndicatorRelease () is for. But it doesn’t work in indicators.
hoz
I don’t even believe it. Perhaps, somewhere overlooked.. After all, the handle is stored in a primitive type variable. It is elementary to reset the variable.. Tomorrow, if there is time, I will try to do it myself.
marketeer
Then there is only one way out: in the tester mode, make the real parameters of the indicator global variables, track their changes yourself and recalculate the indicator using the same handle / instance.
arkfatalist
The indicators are working fine. Everything you need is created. But that’s an unnecessary handles are not removed. Following the examples from the help-handles of the int type. And that’s how to reset I ask. Tried: IndicatorRelese (), Handle = 0, Handle = NULL, Handle = INVALID_HANDLE. Clogs your memory over time.
Alas, memory consumption is also growing to the limit. In addition, it seems that the performance has dropped.
hoz
If I saw the problem, I think I would have suggested something. In General, everything here is quite elementary. If the time changes, a Turkey handle is created. This can be done easily. I.e. every new day, a handle is created.
Input variables can be passed to the indicator as a structure. Accordingly, when you create a handle at the onset of a new day, you create it with the parameters that are needed.. The difficulty is what?
I was thinking of a similar task too. But I had an idea to write a class to work with a certain type of indicator. It’s quite complicated. Wrote the day z. Well. I needed to make it so that that class could work with some podozhimi types of turkeys with different parameters and names, respectively. The logic is about the same. There is nothing complicated.
Work then everything will be clear, but there is one BUT. Handles will be collected. And in a week there will already be 5 of them (5 working days). Although, this is also not a problem. In theory, the handle is a variable of type long. It can always be reset to zero. Again, it’s simple))
marketeer
Write to the service Desk.
savinkins
I ran into the same problem, but I didn’t find a solution. IndicatorRelease () does not work. I had to transfer the indicator code to the expert Advisor.
arkfatalist
I have parmeters of the indicator for the next day depend on the behavior of the market in the previous one. I.e. every day these parmeters are different.
hoz
Why is this even necessary? If the handle is received, then it is needed. If you don’t need it, don’t create it..