Hi, I am building an expert advisor based on such a strategy that if i don't control the no of open positions,it opens a new trade on every single bar.What code should i add in my expert advisor so that i can control the no of trades and whenever i attach my ea on a chart,it asks for the maximum no of open positions along with lots,tp and sp....Thanx alot in advance !!!
- How to have only one open trade at a time?
- Need help building an EA -- What function is used to modify an open position
- Getting the symbol of an open position and comparing it to the symbol of the chart the expert advisor is attached to
You have to assign a miagc numbr to your trades.
And use some code you get how many trades have been opened. Something like that:
for(int cnt=0;cnt<OrdersTotal();cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderMagicNumber() == MagicNumber) { TradesCount = TradesCount+1; } }Then before you open any order you can check the TradesCount < {MAX NUMBER OF TRADES YOU WANT)
Apologies for my insufficient knowledge,but can you tell me where in my ea i should paste this code in order to control maximum no of open trades just like its shown in the attachment.....If any other code is used for the purpose shown in the attachment,then Please do let me know about that code !!!
i would be greatful to see an example myself. i'm not very good at making codes, so i don't really have and idea what to do with code pieces like the one codersguru gave, but if i had an example EA, i would probably be able to figure out how it really works :)
@ crashestdummy....well i hope you do.I downloaded this ea (the one in the picture) from http://www.platinumforexbot.com/free.htm ..If its not avalible anymore,then please do let me know.I'll attach my copy of ea in my next post if you wish.By the way,Best of luck :)
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