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
Hi Kronin,
Your modification is working. You have limited the max orders, bur is that possible to get them all closed, instead ?
I've try to do that with the following code, but seems to not work.
Best Regards
Luis
Hmmm, I am not sure I understand what you mean...
Do you mean, instead of open the last order (order 7 if MaxOrders is set to 7) close all orders?
I am quite sure you dont want to wait until MaxOrders is reached and then immediately close all. The last order would most of the time (or all the time) end with a loss.
Btw. Have you seen the PM about spread controller?
Hmmm, I am not sure I understand what you mean...
Do you mean, instead of open the last order (order 7 if MaxOrders is set to 7) close all orders?
I am quite sure you dont want to wait until MaxOrders is reached and then immediately close all. The last order would most of the time (or all the time) end with a loss.
Btw. Have you seen the PM about spread controller?
Hi Kronin,
Thank you for your prompt response.
Say that after a ping pong cycle of n orders (MaxOrders) all open orders should be closed, I know that could not make sense, but even so.
I'm trying to include code for Reentry the order in case it fails and have doubts if that make sense because there is already the code of IsContextBusy () Sleep (10). As far I understand, the meaning is " if server is busy or other ea in the platform is attempting to communicate, then wait 10 milliseconds and try again". So I suppose that the EA will maintain this behavior until a ticket have been received, am I right ?
Regarding PM issue, in that case better to not make use of Test at weekend or do that with the platform offline....
I've insert line 5, but think that is not necessary because line 1 you have already do that, am I right ?
Another issue,
In the following piece of code the lines in Bold where is sym and mn don't should one replace it with Symbol() and MagicNumber?
Here, in following code I've inserted filters as per your advise;
(//Phil:
//Check the total amount of orders. I would add a filter for market, magic and symbol...//<----------- Not sure what you mean by market filter..... (Phil: market orders, no pending orders)
//.... but i am lazy now.....it is something for you to do.
Is that correct ?
Best Regards
Luis
I dont comment on the using of functions. RaptorUK did it already a few posts before. Read again and understand why you dont need to change anything in the code given. Even better, understand why you can use it as it is in other EAs.
OrdersTotal() gives back an amount of orders. You probably want to know, the orders belong to your EA or to manual trading or the orders are pending- or already market oreders. I would create a function (int) what gives back the amount of orders the EA has created.
if(OTLastTick >= 2 //<------could you comment the meaning of this line ?
If you have only one order open (less than 2), it doesn't make any sense to call CloseAllOnSL function..... the only open order is obviously not stopped out.
I dont comment on the using of functions. RaptorUK did it already a few posts before. Read again and understand why you dont need to change anything in the code given. Even better, understand why you can use it as it is in other EAs.
OrdersTotal() gives back an amount of orders. You probably want to know, the orders belong to your EA or to manual trading or the orders are pending- or already market oreders. I would create a function (int) what gives back the amount of orders the EA has created.
if(OTLastTick >= 2 //<------could you comment the meaning of this line ?
If you have only one order open (less than 2), it doesn't make any sense to call CloseAllOnSL function..... the only open order is obviously not stopped out.
Hi Kronin,
Thank you for your response to my issues.
I will put my up most attention to your code as well RaptorUK advise given before.
Best Regards
Luis
Hi Kronin,
An issue came out and have to do with the use of two EA's. I f I put two EA's in different charts and with different magic number they do not work at same time. I receive an error as uninit reason 5 but having take a look in the forum can't find information that puts me in the right direction to deal with that issue.
Have you any complementary information ?
Best Regards
Luis
Hi Kronin,
An issue came out and have to do with the use of two EA's. I f I put two EA's in different charts and with different magic number they do not work at same time. I receive an error as uninit reason 5
Hi RaptorUK,
Thank you for your prompt response.
In the link provided I found,
But with that information can't do nothing( as far I know). Can't understand what inputs parameters have been changed. The ea is the same, only change the magic number to avoid conflicts between the other ea.
By the way once you are here could you tell me if in the following code one have to introduce code to get the orders been send again while ticket haven't been received the same for closing orders ?
Best regards
Luis
Hi RaptorUK,
Thank you for your prompt response.
In the link provided I found,
But with that information can't do nothing( as far I know). Can't understand what inputs parameters have been changed. The ea is the same, only change the magic number to avoid conflicts between the other ea.
If you changed the Magic Number . . .
. . . and it is an extern then you have changed a parameter, the EA restarts and gives reason 5
If you want to run your EA on multiple pairs I suggest you do 2 things, first get your EA working correctly on one pair, test it fully so you know it is working. Then, secondly, introduce a Mutex so your trades are handled when the other EA is not trying to do the same thing.
If you changed the Magic Number . . .
. . . and it is an extern then you have changed a parameter, the EA restarts and gives reason 5
If you want to run your EA on multiple pairs I suggest you do 2 things, first get your EA working correctly on one pair, test it fully so you know it is working. Then, secondly, introduce a Mutex so your trades are handled when the other EA is not trying to do the same thing.
Hi RaptorUk,
Thank you for your response about the error, I suppose that have change name and magic number and put the second ea into chart without close the platform.
Regarding the other issue about reentry orders that have to do with a fail in order closing that returned an error as timeout. that's why i don't know if the code as it is will reenter the order close or order send.
Best Regards
Luis
Hi RaptorUk,
Thank you for your response about the error, I suppose that have change name and magic number and put the second ea into chart without close the platform.
Regarding the other issue about reentry orders that have to do with a fail in order closing that returned an error as timeout. that's why i don't know if the code as it is will reenter the order close or order send.
Best Regards
Luis
Read through the execution error codes and make your code comply with the information given there, for example . . .