
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
In my function there is the line
I though that was the same thing.
And for the DEAL_IN is it correct, I don't know how this can affect DEAL when are closed (DEAL_OUT).
You need to stop tormenting with request, and go completely to work with trading classes.
When you create an object of the trade class CTrade, you must inform the object
SetExpertMagicNumber
Sets the expert ID
Yes I'll move in that direction!
I also read the code of Trade.mqh and look at the SetExpertMagicNumber and I didn't found a difference in what I wrote before with my function, but as you said it's time to stop tormenting about this.
I found also some issue with CloseBy function that generate crazy balance spikes on backtest, but before opening a new topic on forum I'll check again and again the code, including classes objects.
Thanks again for your help, Vladimir!
Yes I'll move in that direction!
I also read the code of Trade.mqh and look at the SetExpertMagicNumber and I didn't found a difference in what I wrote before with my function, but as you said it's time to stop tormenting about this.
I found also some issue with CloseBy function that generate crazy balance spikes on backtest, but before opening a new topic on forum I'll check again and again the code, including classes objects.
Thanks again for your help, Vladimir!
It's an EA with more than 2000 rows of code, I've tried to post only relevant part about the issue...
For sure It's better to post all information at the beginning but I never though that my order send function (that include the magic number and it works well) causes magic number to be "removed" when positions get closed. It was a very strange issue...
It's an EA with more than 2000 rows of code, I've tried to post only relevant part about the issue...
For sure It's better to post all information at the beginning but I never though that my order send function (that include the magic number and it works well) causes magic number to be "removed" when positions get closed. It was a very strange issue...
It's still a strange issue because there is no way to understand the problem with some snippets of code. I would like to know if it is an issue in your code or something else.
I have no idea why you are thinking using MqlTradeRequest to open would remove the magic when closing, that doesn't make sense of course.
The logic would say that if you are using CTrade to close your positions, and there is no magic number on the deal (=0), that's because you didn't set the magic number or did it incorrectly.
Magic number is set correctly in both cases (my custom function and using CTrade). When I use my function to open positions, looking at HistoryDeals, DEAL_IN has magic number, and DEAL_OUT has not.
My function:
Function using CTrade:
Magic number is set correctly in both cases (my custom function and using CTrade). When I use my function to open positions, looking at HistoryDeals, DEAL_IN has magic number, and DEAL_OUT has not.
My function:
Function using CTrade:
I give up. ***
And I will observe. One day :)
I give up. Again you are posting useless snippets of code (which you already posted). We have no idea what the parameters value are, how and when these functions are called, we can't run it and try it. Nobody can help you.
You are wrong, Vladimir helped me and pushed me in the right direction to troubleshoot the problem and I thanks him. Again, I posted the only important part, no matter of when function of open and close are called, if I do it using MqlTradeRequest and order send I will have this results and magic number will be inexplicably removed from the DEAL_ENTRY_OUT.
If I use the CTrade class object to make trade I will have this results.
I don't know how to explain it again but I attached two EA (1_CTrade is the one made by Vladimir, the other is the same using a custom MqlTradeRequest function). Anyway, also if there are no specific reasons, the problem is solved using CTrade class.