<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Forex Software — Programming problems with OrdersTotal]]></title>
		<link>https://forexsb.com/forum/topic/8508/programming-problems-with-orderstotal/</link>
		<atom:link href="https://forexsb.com/forum/feed/rss/topic/8508/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Programming problems with OrdersTotal.]]></description>
		<lastBuildDate>Tue, 04 Aug 2020 17:40:11 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Programming problems with OrdersTotal]]></title>
			<link>https://forexsb.com/forum/post/61821/#p61821</link>
			<description><![CDATA[<div class="quotebox"><cite>burrup.lambert wrote:</cite><blockquote><div class="codebox"><pre><code>#include &lt;arrays/arraystring.mqh&gt;
#define SymbolOrderLimit 2

void OpenPosition(int command)
  {
   int total = OrdersTotal();
   
   CArrayString SymbolList;
   int SymbolListOrderCount[];
   int ExistingIndex = 0;
   for(int pos=total - 1; pos&gt;=0; pos--)
   {
      if(OrderSelect(pos,SELECT_BY_POS))
      {
         ExistingIndex = SymbolList.SearchLinear(OrderSymbol());
         if (ExistingIndex == -1)
         {        
            SymbolList.Add(OrderSymbol());
            if (ArrayRange(SymbolListOrderCount, 0) &lt; SymbolList.Total()) ArrayResize(SymbolListOrderCount, SymbolList.Total());
            ExistingIndex = SymbolList.Total() - 1;
            SymbolListOrderCount[ExistingIndex] = 1;
         }
         else 
         {
            SymbolListOrderCount[ExistingIndex]++;
         }
      }
   }
   if (!(SymbolListOrderCount[ExistingIndex] &lt; SymbolOrderLimit &amp;&amp; 
      OrderSymbol()==_Symbol &amp;&amp;
      OrderMagicNumber()==Magic_Number)) return;
  
   for(int attempt=0; attempt&lt;TRADE_RETRY_COUNT; attempt++)
     {
      int    ticket     = 0;
      int    lastError  = 0;
      bool   modified   = false;
      double stopLoss   = GetStopLoss(command);
      double takeProfit = GetTakeProfit(command);
      string comment    = IntegerToString(Magic_Number);
      color  arrowColor = command==OP_BUY ? clrGreen : clrRed;

      if(IsTradeContextFree())
        {
         double price=MarketInfo(_Symbol,command==OP_BUY ? MODE_ASK : MODE_BID);
         if(setProtectionSeparately)
           {
            ticket=OrderSend(_Symbol,command,Entry_Amount,price,10,0,0,comment,Magic_Number,0,arrowColor);
            if(ticket&gt;0 &amp;&amp; (Stop_Loss&gt;0 || Take_Profit&gt;0))
              {
               modified=OrderModify(ticket,0,stopLoss,takeProfit,0,clrBlue);
              }
           }
         else
           {
            ticket=OrderSend(_Symbol,command,Entry_Amount,price,10,stopLoss,takeProfit,comment,Magic_Number,0,arrowColor);
            lastError=GetLastError();
            if(ticket&lt;=0 &amp;&amp; lastError==130)
              {
               ticket=OrderSend(_Symbol,command,Entry_Amount,price,10,0,0,comment,Magic_Number,0,arrowColor);
               if(ticket&gt;0 &amp;&amp; (Stop_Loss&gt;0 || Take_Profit&gt;0))
                 {
                  modified=OrderModify(ticket,0,stopLoss,takeProfit,0,clrBlue);
                 }
               if(ticket&gt;0 &amp;&amp; modified)
                 {
                  setProtectionSeparately=true;
                  Print(&quot;Detected ECN type position protection.&quot;);
                 }
              }
           }
        }

      if(ticket&gt;0)
         break;

      lastError=GetLastError();
      if(lastError!=135 &amp;&amp; lastError!=136 &amp;&amp; lastError!=137 &amp;&amp; lastError!=138)
         break;

      Sleep(TRADE_RETRY_WAIT);
      Print(&quot;Open Position retry no: &quot;+IntegerToString(attempt+2));
     }
  }</code></pre></div></blockquote></div><br /><p>the same error... i think is impossible <img src="https://forexsb.com/forum/img/smilies/sad.png" width="15" height="15" alt="sad" /><br />but do I have to cancel the for in update position loop?</p><div class="codebox"><pre><code>   for(int pos=total-1; pos&gt;=0; pos--)
     {
      if(OrderSelect(pos,SELECT_BY_POS) &amp;&amp;
         OrderSymbol()==_Symbol &amp;&amp;
         OrderMagicNumber()==Magic_Number)</code></pre></div><p>this</p>]]></description>
			<author><![CDATA[null@example.com (Tignola)]]></author>
			<pubDate>Tue, 04 Aug 2020 17:40:11 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/61821/#p61821</guid>
		</item>
		<item>
			<title><![CDATA[Re: Programming problems with OrdersTotal]]></title>
			<link>https://forexsb.com/forum/post/61818/#p61818</link>
			<description><![CDATA[<div class="codebox"><pre><code>#include &lt;arrays/arraystring.mqh&gt;
#define SymbolOrderLimit 2

void OpenPosition(int command)
  {
   int total = OrdersTotal();
   
   CArrayString SymbolList;
   int SymbolListOrderCount[];
   int ExistingIndex = 0;
   for(int pos=total - 1; pos&gt;=0; pos--)
   {
      if(OrderSelect(pos,SELECT_BY_POS))
      {
         ExistingIndex = SymbolList.SearchLinear(OrderSymbol());
         if (ExistingIndex == -1)
         {        
            SymbolList.Add(OrderSymbol());
            if (ArrayRange(SymbolListOrderCount, 0) &lt; SymbolList.Total()) ArrayResize(SymbolListOrderCount, SymbolList.Total());
            ExistingIndex = SymbolList.Total() - 1;
            SymbolListOrderCount[ExistingIndex] = 1;
         }
         else 
         {
            SymbolListOrderCount[ExistingIndex]++;
         }
      }
   }
   if (!(SymbolListOrderCount[ExistingIndex] &lt; SymbolOrderLimit &amp;&amp; 
      OrderSymbol()==_Symbol &amp;&amp;
      OrderMagicNumber()==Magic_Number)) return;
  
   for(int attempt=0; attempt&lt;TRADE_RETRY_COUNT; attempt++)
     {
      int    ticket     = 0;
      int    lastError  = 0;
      bool   modified   = false;
      double stopLoss   = GetStopLoss(command);
      double takeProfit = GetTakeProfit(command);
      string comment    = IntegerToString(Magic_Number);
      color  arrowColor = command==OP_BUY ? clrGreen : clrRed;

      if(IsTradeContextFree())
        {
         double price=MarketInfo(_Symbol,command==OP_BUY ? MODE_ASK : MODE_BID);
         if(setProtectionSeparately)
           {
            ticket=OrderSend(_Symbol,command,Entry_Amount,price,10,0,0,comment,Magic_Number,0,arrowColor);
            if(ticket&gt;0 &amp;&amp; (Stop_Loss&gt;0 || Take_Profit&gt;0))
              {
               modified=OrderModify(ticket,0,stopLoss,takeProfit,0,clrBlue);
              }
           }
         else
           {
            ticket=OrderSend(_Symbol,command,Entry_Amount,price,10,stopLoss,takeProfit,comment,Magic_Number,0,arrowColor);
            lastError=GetLastError();
            if(ticket&lt;=0 &amp;&amp; lastError==130)
              {
               ticket=OrderSend(_Symbol,command,Entry_Amount,price,10,0,0,comment,Magic_Number,0,arrowColor);
               if(ticket&gt;0 &amp;&amp; (Stop_Loss&gt;0 || Take_Profit&gt;0))
                 {
                  modified=OrderModify(ticket,0,stopLoss,takeProfit,0,clrBlue);
                 }
               if(ticket&gt;0 &amp;&amp; modified)
                 {
                  setProtectionSeparately=true;
                  Print(&quot;Detected ECN type position protection.&quot;);
                 }
              }
           }
        }

      if(ticket&gt;0)
         break;

      lastError=GetLastError();
      if(lastError!=135 &amp;&amp; lastError!=136 &amp;&amp; lastError!=137 &amp;&amp; lastError!=138)
         break;

      Sleep(TRADE_RETRY_WAIT);
      Print(&quot;Open Position retry no: &quot;+IntegerToString(attempt+2));
     }
  }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (burrup.lambert)]]></author>
			<pubDate>Tue, 04 Aug 2020 14:36:10 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/61818/#p61818</guid>
		</item>
		<item>
			<title><![CDATA[Re: Programming problems with OrdersTotal]]></title>
			<link>https://forexsb.com/forum/post/61817/#p61817</link>
			<description><![CDATA[<div class="quotebox"><cite>burrup.lambert wrote:</cite><blockquote><p>Ignore above. Sorry had the logic in the wrong function. Try replace the OpenPosition function with the one below. The CArrayString SymbolList is slightly redundant as I assume you are only running this on a single pair. You may want to remove the Magic and Symbol check depending on your use-case.</p><p>Compiled, untested.</p><div class="codebox"><pre><code>#include &lt;arrays/arraystring.mqh&gt;
#define SymbolOrderLimit 2

void OpenPosition(int command)
  {
   int total = OrdersTotal();
   
   CArrayString SymbolList;
   int SymbolListOrderCount[];
   int ExistingIndex = 0;
   for(int pos=total; pos&gt;=0; pos--)
   {
      if(OrderSelect(pos,SELECT_BY_POS))
      {
         ExistingIndex = SymbolList.SearchLinear(OrderSymbol());
         if (ExistingIndex == -1)
         {        
            SymbolList.Add(OrderSymbol());
            if (ArrayRange(SymbolListOrderCount, 0) &lt; SymbolList.Total()) ArrayResize(SymbolListOrderCount, SymbolList.Total());
            ExistingIndex = SymbolList.Total() - 1;
            SymbolListOrderCount[ExistingIndex] = 1;
         }
         else 
         {
            SymbolListOrderCount[ExistingIndex]++;
         }
      }
   }
   if (!(SymbolListOrderCount[ExistingIndex] &lt; SymbolOrderLimit &amp;&amp; 
      OrderSymbol()==_Symbol &amp;&amp;
      OrderMagicNumber()==Magic_Number)) return;
  
   for(int attempt=0; attempt&lt;TRADE_RETRY_COUNT; attempt++)
     {
      int    ticket     = 0;
      int    lastError  = 0;
      bool   modified   = false;
      double stopLoss   = GetStopLoss(command);
      double takeProfit = GetTakeProfit(command);
      string comment    = IntegerToString(Magic_Number);
      color  arrowColor = command==OP_BUY ? clrGreen : clrRed;

      if(IsTradeContextFree())
        {
         double price=MarketInfo(_Symbol,command==OP_BUY ? MODE_ASK : MODE_BID);
         if(setProtectionSeparately)
           {
            ticket=OrderSend(_Symbol,command,Entry_Amount,price,10,0,0,comment,Magic_Number,0,arrowColor);
            if(ticket&gt;0 &amp;&amp; (Stop_Loss&gt;0 || Take_Profit&gt;0))
              {
               modified=OrderModify(ticket,0,stopLoss,takeProfit,0,clrBlue);
              }
           }
         else
           {
            ticket=OrderSend(_Symbol,command,Entry_Amount,price,10,stopLoss,takeProfit,comment,Magic_Number,0,arrowColor);
            lastError=GetLastError();
            if(ticket&lt;=0 &amp;&amp; lastError==130)
              {
               ticket=OrderSend(_Symbol,command,Entry_Amount,price,10,0,0,comment,Magic_Number,0,arrowColor);
               if(ticket&gt;0 &amp;&amp; (Stop_Loss&gt;0 || Take_Profit&gt;0))
                 {
                  modified=OrderModify(ticket,0,stopLoss,takeProfit,0,clrBlue);
                 }
               if(ticket&gt;0 &amp;&amp; modified)
                 {
                  setProtectionSeparately=true;
                  Print(&quot;Detected ECN type position protection.&quot;);
                 }
              }
           }
        }

      if(ticket&gt;0)
         break;

      lastError=GetLastError();
      if(lastError!=135 &amp;&amp; lastError!=136 &amp;&amp; lastError!=137 &amp;&amp; lastError!=138)
         break;

      Sleep(TRADE_RETRY_WAIT);
      Print(&quot;Open Position retry no: &quot;+IntegerToString(attempt+2));
     }
  }</code></pre></div></blockquote></div><br /><br /><p>This is the result fromBacktest <br />2020.08.04 15:02:03.461&nbsp; &nbsp; 2019.05.31 00:01:17&nbsp; Testing pass stopped due to a critical error in the EA</p><p>Result from real time <br />2020.08.04 15:05:00.589&nbsp; &nbsp; TEST MULTI OPERAZIONE EURGBP,M1: array out of range in &#039;TEST MULTI OPERAZIONE.mq4&#039; (208,30)</p><p>however I thank you very much for the help you are giving me .<br />I&#039;m trying everything too, but I can&#039;t find anything that is fine</p>]]></description>
			<author><![CDATA[null@example.com (Tignola)]]></author>
			<pubDate>Tue, 04 Aug 2020 13:10:43 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/61817/#p61817</guid>
		</item>
		<item>
			<title><![CDATA[Re: Programming problems with OrdersTotal]]></title>
			<link>https://forexsb.com/forum/post/61805/#p61805</link>
			<description><![CDATA[<p>Ignore above. Sorry had the logic in the wrong function. Try replace the OpenPosition function with the one below. The CArrayString SymbolList is slightly redundant as I assume you are only running this on a single pair. You may want to remove the Magic and Symbol check depending on your use-case.</p><p>Compiled, untested.</p><div class="codebox"><pre><code>#include &lt;arrays/arraystring.mqh&gt;
#define SymbolOrderLimit 2

void OpenPosition(int command)
  {
   int total = OrdersTotal();
   
   CArrayString SymbolList;
   int SymbolListOrderCount[];
   int ExistingIndex = 0;
   for(int pos=total; pos&gt;=0; pos--)
   {
      if(OrderSelect(pos,SELECT_BY_POS))
      {
         ExistingIndex = SymbolList.SearchLinear(OrderSymbol());
         if (ExistingIndex == -1)
         {        
            SymbolList.Add(OrderSymbol());
            if (ArrayRange(SymbolListOrderCount, 0) &lt; SymbolList.Total()) ArrayResize(SymbolListOrderCount, SymbolList.Total());
            ExistingIndex = SymbolList.Total() - 1;
            SymbolListOrderCount[ExistingIndex] = 1;
         }
         else 
         {
            SymbolListOrderCount[ExistingIndex]++;
         }
      }
   }
   if (!(SymbolListOrderCount[ExistingIndex] &lt; SymbolOrderLimit &amp;&amp; 
      OrderSymbol()==_Symbol &amp;&amp;
      OrderMagicNumber()==Magic_Number)) return;
  
   for(int attempt=0; attempt&lt;TRADE_RETRY_COUNT; attempt++)
     {
      int    ticket     = 0;
      int    lastError  = 0;
      bool   modified   = false;
      double stopLoss   = GetStopLoss(command);
      double takeProfit = GetTakeProfit(command);
      string comment    = IntegerToString(Magic_Number);
      color  arrowColor = command==OP_BUY ? clrGreen : clrRed;

      if(IsTradeContextFree())
        {
         double price=MarketInfo(_Symbol,command==OP_BUY ? MODE_ASK : MODE_BID);
         if(setProtectionSeparately)
           {
            ticket=OrderSend(_Symbol,command,Entry_Amount,price,10,0,0,comment,Magic_Number,0,arrowColor);
            if(ticket&gt;0 &amp;&amp; (Stop_Loss&gt;0 || Take_Profit&gt;0))
              {
               modified=OrderModify(ticket,0,stopLoss,takeProfit,0,clrBlue);
              }
           }
         else
           {
            ticket=OrderSend(_Symbol,command,Entry_Amount,price,10,stopLoss,takeProfit,comment,Magic_Number,0,arrowColor);
            lastError=GetLastError();
            if(ticket&lt;=0 &amp;&amp; lastError==130)
              {
               ticket=OrderSend(_Symbol,command,Entry_Amount,price,10,0,0,comment,Magic_Number,0,arrowColor);
               if(ticket&gt;0 &amp;&amp; (Stop_Loss&gt;0 || Take_Profit&gt;0))
                 {
                  modified=OrderModify(ticket,0,stopLoss,takeProfit,0,clrBlue);
                 }
               if(ticket&gt;0 &amp;&amp; modified)
                 {
                  setProtectionSeparately=true;
                  Print(&quot;Detected ECN type position protection.&quot;);
                 }
              }
           }
        }

      if(ticket&gt;0)
         break;

      lastError=GetLastError();
      if(lastError!=135 &amp;&amp; lastError!=136 &amp;&amp; lastError!=137 &amp;&amp; lastError!=138)
         break;

      Sleep(TRADE_RETRY_WAIT);
      Print(&quot;Open Position retry no: &quot;+IntegerToString(attempt+2));
     }
  }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (burrup.lambert)]]></author>
			<pubDate>Tue, 04 Aug 2020 00:22:25 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/61805/#p61805</guid>
		</item>
		<item>
			<title><![CDATA[Re: Programming problems with OrdersTotal]]></title>
			<link>https://forexsb.com/forum/post/61768/#p61768</link>
			<description><![CDATA[<p>The problem is always the same, it cannot make a count of the operations per single chart, I did both in backtest and in live but nothing, indeed if I do not change anything to your code only one operation opens per chart<br />Cannot count the trades by single chart, always counts the total trades, with your code opens a single operation although it should open more based on how I set the EA</p><br /><br /><div class="codebox"><pre><code>   double ind1val1 = iCCI(NULL,0,Ind1Param0,PRICE_TYPICAL,1);
   bool ind1longcci  = ind1val1 &gt; Ind1Param1 + sigma;        
   bool ind1shortcci = ind1val1 &lt; Ind1Param1 - sigma;
 
  // Example for buy or sell in the market specially designed for testing</code></pre></div><p>I try very simply with this entry to TF1 minut so I have fast results in the backtest<br />Sorry but this thing is driving me crazy, thank you for your patience</p><div class="quotebox"><cite>burrup.lambert wrote:</cite><blockquote><p>If you want some help I&#039;m going to need more than &#039;doesn&#039;t work&#039;! I can gaurantee that code is 90% of the way there.</p></blockquote></div>]]></description>
			<author><![CDATA[null@example.com (Tignola)]]></author>
			<pubDate>Thu, 30 Jul 2020 22:25:23 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/61768/#p61768</guid>
		</item>
		<item>
			<title><![CDATA[Re: Programming problems with OrdersTotal]]></title>
			<link>https://forexsb.com/forum/post/61767/#p61767</link>
			<description><![CDATA[<p>If you want some help I&#039;m going to need more than &#039;doesn&#039;t work&#039;! I can gaurantee that code is 90% of the way there.</p>]]></description>
			<author><![CDATA[null@example.com (burrup.lambert)]]></author>
			<pubDate>Thu, 30 Jul 2020 21:02:16 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/61767/#p61767</guid>
		</item>
		<item>
			<title><![CDATA[Re: Programming problems with OrdersTotal]]></title>
			<link>https://forexsb.com/forum/post/61766/#p61766</link>
			<description><![CDATA[<div class="quotebox"><cite>burrup.lambert wrote:</cite><blockquote><p>Compiled. Untested.</p><div class="codebox"><pre><code>#include &lt;arrays/arraystring.mqh&gt;
#define SymbolOrderLimit 2
void UpdatePosition()
{
   posType   = OP_FLAT;
   posTicket = 0;
   posLots   = 0;
   int total = OrdersTotal();
   
   CArrayString SymbolList;
   int SymbolListOrderCount[];

   for(int pos=total-1; pos&gt;=0; pos--)
   {
      if(OrderSelect(pos,SELECT_BY_POS))
      {
         int ExistingIndex = SymbolList.SearchLinear(OrderSymbol());
         if (ExistingIndex == -1)
         {        
            SymbolList.Add(OrderSymbol());
            if (ArrayRange(SymbolListOrderCount, 0) &lt; SymbolList.Total()) ArrayResize(SymbolListOrderCount, SymbolList.Total());
            ExistingIndex = SymbolList.Total() - 1;
            SymbolListOrderCount[ExistingIndex] = 1;
         }
         else 
         {
            SymbolListOrderCount[ExistingIndex]++;
         }
         
         if (SymbolListOrderCount[ExistingIndex] &lt; SymbolOrderLimit &amp;&amp; 
         OrderSymbol()==_Symbol &amp;&amp;
         OrderMagicNumber()==Magic_Number)
         {
            posType       = OrderType();
            posLots       = OrderLots();
            posTicket     = OrderTicket();
            posStopLoss   = OrderStopLoss();
            posTakeProfit = OrderTakeProfit();
            break;
         }
      }
   }
}</code></pre></div></blockquote></div><p>thank you very much for the answer, but unfortunately it doesn&#039;t work,I really can&#039;t find anything on the net, I&#039;ve been trying for days,I also tried to replace some parameters but it doesn&#039;t work</p>]]></description>
			<author><![CDATA[null@example.com (Tignola)]]></author>
			<pubDate>Thu, 30 Jul 2020 20:26:31 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/61766/#p61766</guid>
		</item>
		<item>
			<title><![CDATA[Re: Programming problems with OrdersTotal]]></title>
			<link>https://forexsb.com/forum/post/61764/#p61764</link>
			<description><![CDATA[<p>Compiled. Untested.</p><div class="codebox"><pre><code>#include &lt;arrays/arraystring.mqh&gt;
#define SymbolOrderLimit 2
void UpdatePosition()
{
   posType   = OP_FLAT;
   posTicket = 0;
   posLots   = 0;
   int total = OrdersTotal();
   
   CArrayString SymbolList;
   int SymbolListOrderCount[];

   for(int pos=total-1; pos&gt;=0; pos--)
   {
      if(OrderSelect(pos,SELECT_BY_POS))
      {
         int ExistingIndex = SymbolList.SearchLinear(OrderSymbol());
         if (ExistingIndex == -1)
         {        
            SymbolList.Add(OrderSymbol());
            if (ArrayRange(SymbolListOrderCount, 0) &lt; SymbolList.Total()) ArrayResize(SymbolListOrderCount, SymbolList.Total());
            ExistingIndex = SymbolList.Total() - 1;
            SymbolListOrderCount[ExistingIndex] = 1;
         }
         else 
         {
            SymbolListOrderCount[ExistingIndex]++;
         }
         
         if (SymbolListOrderCount[ExistingIndex] &lt; SymbolOrderLimit &amp;&amp; 
         OrderSymbol()==_Symbol &amp;&amp;
         OrderMagicNumber()==Magic_Number)
         {
            posType       = OrderType();
            posLots       = OrderLots();
            posTicket     = OrderTicket();
            posStopLoss   = OrderStopLoss();
            posTakeProfit = OrderTakeProfit();
            break;
         }
      }
   }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (burrup.lambert)]]></author>
			<pubDate>Thu, 30 Jul 2020 18:56:12 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/61764/#p61764</guid>
		</item>
		<item>
			<title><![CDATA[Re: Programming problems with OrdersTotal]]></title>
			<link>https://forexsb.com/forum/post/61746/#p61746</link>
			<description><![CDATA[<p>hello, yes exactly what I would like to do<br /></p><div class="quotebox"><cite>burrup.lambert wrote:</cite><blockquote><p>Hi Tignola,</p><p>What exactly are you trying to achieve? Are you trying to restrict an EA so that it can only have X amount of trades open per symbol? For example 2? So 2 trades for AUDUSD, another 2 for EURUSD etc, and if the EA attempted to open another trade on either of those pairs it wouldn&#039;t allow it?</p></blockquote></div>]]></description>
			<author><![CDATA[null@example.com (Tignola)]]></author>
			<pubDate>Wed, 29 Jul 2020 23:06:38 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/61746/#p61746</guid>
		</item>
		<item>
			<title><![CDATA[Re: Programming problems with OrdersTotal]]></title>
			<link>https://forexsb.com/forum/post/61744/#p61744</link>
			<description><![CDATA[<p>Hi Tignola,</p><p>What exactly are you trying to achieve? Are you trying to restrict an EA so that it can only have X amount of trades open per symbol? For example 2? So 2 trades for AUDUSD, another 2 for EURUSD etc, and if the EA attempted to open another trade on either of those pairs it wouldn&#039;t allow it?</p>]]></description>
			<author><![CDATA[null@example.com (burrup.lambert)]]></author>
			<pubDate>Wed, 29 Jul 2020 17:36:34 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/61744/#p61744</guid>
		</item>
		<item>
			<title><![CDATA[Programming problems with OrdersTotal]]></title>
			<link>https://forexsb.com/forum/post/61710/#p61710</link>
			<description><![CDATA[<p>hi everyone, I&#039;m going to create an input variable for the OrdersTotal for each Symbol, but it is really difficult for me, in part it was successful but only the total market orders and not those of each single Symbol count, do you have any suggestions?<br />I&#039;ve tried everything but I can&#039;t understand how the functions work<br />I tried to change the magic number, to remove the magic number but nothing, can you help me please?</p><p>HERE IS THE CODE</p><br /><div class="codebox"><pre><code>void UpdatePosition()

  //extern int tradecount =0;
  { string symbol= Symbol();
  
   posType   = OP_FLAT;
   posTicket = 0;
   posLots   = 0;
   int total = OrdersTotal();
   
// for(int pos=total-1; pos&gt;=5; pos--) // Not Work

   for(int pos=total-1; pos&gt;=tradecont-1; pos--)
    
     {
      if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES) &amp;&amp;
         OrderSymbol()==symbol &amp;&amp; 
         OrderMagicNumber()==Magic_Number)
        {
         posType       = OrderType();
         posLots       = OrderLots();
         posTicket     = OrderTicket();
         posStopLoss   = OrderStopLoss();
         posTakeProfit = OrderTakeProfit();
         break;
         }}}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Tignola)]]></author>
			<pubDate>Mon, 27 Jul 2020 19:45:59 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/61710/#p61710</guid>
		</item>
	</channel>
</rss>
