工作已完成
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
指定
i want to create an EA to avoid accidentally opening oversize positions. It means, for example, i just plan to open 0.1 size of position on XAUUSD trading, but by unknown reason (may be pressing a wrong button) I open 1 size of position, which let me to get much higher risk.
I am using Vantage, i trade NAS100.r, CL-OIL, GBPJPY, XAUUSD (i am using Vantage as my broker), i set the position of each item as follow:
extern double NAS_posit = 1
extern double CL-OIL_posit = 0.1
extern double GBP_posit = 0.2
extern double XAU_posit = 0.1
Obviously, this EA will help me to trade not over the above size of position.
For coding, it is a must to use extern , cos i often change the position, it is more convenient for me
I will put this EA to the Window version of MT4 in a VPS platform and keep it running, however, basically, i only make my trades in mobile MT4, so for the EA, i hope it can reject all over size trades, if not, it should:
1. cancel all over size trades (I always use pending order, so it is ok if the EA in checking Ontick)
2. If I accidentally open a market execution trade, the EA needs to help me to close it immediately.
Finally , since i am a rookie of programming, i hope you can give me simple description on important line of code.