<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Forex Software — How to calculate number of buy and sells order from history]]></title>
		<link>https://forexsb.com/forum/topic/7477/how-to-calculate-number-of-buy-and-sells-order-from-history/</link>
		<atom:link href="https://forexsb.com/forum/feed/rss/topic/7477/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in How to calculate number of buy and sells order from history.]]></description>
		<lastBuildDate>Sun, 26 Aug 2018 14:30:18 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[How to calculate number of buy and sells order from history]]></title>
			<link>https://forexsb.com/forum/post/52027/#p52027</link>
			<description><![CDATA[<p>Hey,</p><p>can someone help out how i can calculate the amount of closed buy and sell positions from an ea and put in in a comment to show on chart?</p><p>So it must be a calculation for exactly the magicnumber and symbol.<br />i tried it with this</p><div class="codebox"><pre><code>//+------------------------------------------------------------------+
//| Calculate history closed buy positions                                        |
//+------------------------------------------------------------------+
int CalculateCurrentOrdersbuys(int buy)
  {
   int buys=0;
//----
   for(int i=0;i&lt;OrdersTotal();i++)
     {
      if(OrderSymbol()==Symbol() &amp;&amp; OrderMagicNumber()==Magic_Number &amp;&amp; OrderType()==OP_BUY)
        {
         buys++;
         
        }
     }
return(buys);
  }
//+------------------------------------------------------------------+
//| Calculate history closed sell positions                                            |
//+------------------------------------------------------------------+
int CalculateCurrentOrderssells(int sell)
  {
   int sells=0;
//----
   for(int i=0;i&lt;OrdersTotal();i++)
     {
      if(OrderSymbol()==Symbol() &amp;&amp; OrderMagicNumber()==Magic_Number)
        {
         if(OrderType()==OP_BUY)  sells++;
        }
     }
return(sells);
  }  </code></pre></div><p>and this in ontick</p><div class="codebox"><pre><code> Comment(          &quot;---------------| Buys: &quot;,CalculateCurrentOrdersbuys(0),&quot;\n&quot;, 
           &quot;---------------| Sells: &quot;,CalculateCurrentOrderssells(0));   </code></pre></div>]]></description>
			<author><![CDATA[null@example.com (deadlef)]]></author>
			<pubDate>Sun, 26 Aug 2018 14:30:18 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/52027/#p52027</guid>
		</item>
	</channel>
</rss>
