you open another order but in opposite direction and with same lot size then it will cancel out/ close the first position.
or you double the lot size and it will open a new orders in opposite direction with same amount of lots.
Hello all,
I'm writing my first EA based on Standard Library. I was able to write my custom signal class inherited from CExpertSignal, it works fine in opening long and short position. Now I want to add the ability to close that position when the signals say so, just I fail to see to implement it.
I tried to customize the functions CheckCloseLong and CheckCloseShort without success. The examples provided with MT5 (folder include\expert\signal), as far i can understand them, show only how to open the position.
Could anyone give some info or just the link to example pages.
Thanks
You have to code your close conditions in the same way as your open condition, in your custome signal module LongCondition() and ShortCondition(). See an example in this code.
See also
- www.mql5.com
You have to code your close conditions in the same way as your open condition, in your custome signal module LongCondition() and ShortCondition(). See an example in this code.
See also
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello all,
I'm writing my first EA based on Standard Library. I was able to write my custom signal class inherited from CExpertSignal, it works fine in opening long and short position. Now I want to add the ability to close that position when the signals say so, just I fail to see to implement it.
I tried to customize the functions CheckCloseLong and CheckCloseShort without success. The examples provided with MT5 (folder include\expert\signal), as far i can understand them, show only how to open the position.
Could anyone give some info or just the link to example pages.
Thanks