molanis.com/forum - Tools for MetaTrader : The place to ask about the best expert advisor builder, expert advisor downloads, and expert advisor programming http://www.molanis.com/forum/ |
|
Calculate Open Positions by MQL icon http://www.molanis.com/forum/viewtopic.php?f=6&t=6054 |
Page 1 of 1 |
Author: | kitz328 [ Tue Jun 10, 2014 1:30 am ] |
Post subject: | Calculate Open Positions by MQL icon |
Hi there, Supposed I have EA for EurUsd, GbpUsd and NzdUsd. They are attached to their own chart respectively. Supposed due to co-relation issues I want the other two to NOT trade when a position by any one is entered. I was told to use 'CalculateOpenPosition' by the MQL icon. How is this done? Any diagrams to show? |
Author: | molanisfx [ Tue Jun 10, 2014 11:37 am ] |
Post subject: | Re: Calculate Open Positions by MQL icon |
If you want to use MQL you need to open a generated ea with MetaEditor and understand how it works From a generated EA I got this: if (CalculateOpenPositions(symbol_bn,ordertype_bn,magic_bn)>=MaxNumberofPositions) { Print("I-Warning : Can not execute new ",OrderTypetoString(ordertype_bn)," order for Symbol ",symbol_bn,". Maximum number of ",MaxNumberofPositions," open positions reached."); return(0); } In the MQL icon in version 3.2 or higher (won't work in old versions) you need to put something like: CalculateOpenPositions(symbol_bn,ordertype_bn,magic_bn)>=MaxNumberofPositions You need to replace symbol_bn,ordertype_bn,magic_bn and MaxNumberofPositions with your own info Like CalculateOpenPositions("EURUSD",OP_BUY,your ea magic number)>=1 unfortunately we do not do MQL support here or teach MQL - we only do product support so you have to do a lot of try and error on your end. We do not have any examples but I have seen some posts in the forum with some MQL code |
Author: | kitz328 [ Wed Jun 11, 2014 6:31 am ] |
Post subject: | Re: Calculate Open Positions by MQL icon |
I have this question. symbol_bn may refer to EURUSD if I have one EA only. But if I have many EAs for pairs ending with USD do I define them all or is there a shorter way like xxxUSD? |
Author: | molanisfx [ Thu Jun 12, 2014 10:29 am ] |
Post subject: | Re: Calculate Open Positions by MQL icon |
Unfortunately if you want to use the MQL icon you need to understand MQL a bit If you want to check 2 pairs, you need to use an AND CalculateOpenPositions("EURUSD",OP_BUY,your ea magic number)>=1 && CalculateOpenPositions("GBPUSD",OP_BUY,your ea magic number)>=1 |
Page 1 of 1 | All times are UTC - 5 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |