<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — How to calculate number of buy and sells order from history]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/7477/" />
	<updated>2018-08-26T14:30:18Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/7477/how-to-calculate-number-of-buy-and-sells-order-from-history/</id>
		<entry>
			<title type="html"><![CDATA[How to calculate number of buy and sells order from history]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/52027/#p52027" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[deadlef]]></name>
				<uri>https://forexsb.com/forum/user/9894/</uri>
			</author>
			<updated>2018-08-26T14:30:18Z</updated>
			<id>https://forexsb.com/forum/post/52027/#p52027</id>
		</entry>
</feed>
