<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Forex Software — Add TakeProfit in Percent in Portfolio?]]></title>
		<link>https://forexsb.com/forum/topic/7711/add-takeprofit-in-percent-in-portfolio/</link>
		<atom:link href="https://forexsb.com/forum/feed/rss/topic/7711/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Add TakeProfit in Percent in Portfolio?.]]></description>
		<lastBuildDate>Fri, 25 Jan 2019 22:21:54 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Add TakeProfit in Percent in Portfolio?]]></title>
			<link>https://forexsb.com/forum/post/54156/#p54156</link>
			<description><![CDATA[<p>Sure it will work, as long as you only reference the EAs that belong to it when closing positions.</p>]]></description>
			<author><![CDATA[null@example.com (geektrader)]]></author>
			<pubDate>Fri, 25 Jan 2019 22:21:54 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/54156/#p54156</guid>
		</item>
		<item>
			<title><![CDATA[Re: Add TakeProfit in Percent in Portfolio?]]></title>
			<link>https://forexsb.com/forum/post/54154/#p54154</link>
			<description><![CDATA[<p>now its based on accountbalance. but what is when i use 5 different eas on one account? than this formula not working ?</p>]]></description>
			<author><![CDATA[null@example.com (Roughey)]]></author>
			<pubDate>Fri, 25 Jan 2019 21:53:36 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/54154/#p54154</guid>
		</item>
		<item>
			<title><![CDATA[Re: Add TakeProfit in Percent in Portfolio?]]></title>
			<link>https://forexsb.com/forum/post/54130/#p54130</link>
			<description><![CDATA[<p>thanks i will try</p>]]></description>
			<author><![CDATA[null@example.com (Roughey)]]></author>
			<pubDate>Thu, 24 Jan 2019 20:24:29 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/54130/#p54130</guid>
		</item>
		<item>
			<title><![CDATA[Re: Add TakeProfit in Percent in Portfolio?]]></title>
			<link>https://forexsb.com/forum/post/54129/#p54129</link>
			<description><![CDATA[<p>The code looks good so far, also great that you are doing &quot;+OrderSwap()+OrderCommission()&quot;, most programmers do &quot;-OrderSwap()-OrderCommission()&quot;, as they do not realize that the values are expressed negative by MT4 already. Good job :-)</p><p>As for your % based take profit, you somehow (before opening the next batch of trades) need to have a look at the AccountBalance() (<a href="https://docs.mql4.com/account/accountbalance">https://docs.mql4.com/account/accountbalance</a>), as you need to relate your percentage to the account balance in order to figure out when to close the trades. So your TakeProfitBasket would become something like this to express it in percent:</p><div class="codebox"><pre><code>TakeProfitBasket = AccountBalance() * 0.06;</code></pre></div><p>^ which then would make it take profit if the profit equals 6% of your current account balance. Of course you can make the % an input variable like this:</p><div class="codebox"><pre><code>input double TakeProfitPercent = 6.0;</code></pre></div><p>and then do:</p><div class="codebox"><pre><code>TakeProfitBasket = AccountBalance() * TakeProfitPercent / 100;</code></pre></div><p>Good luck!</p>]]></description>
			<author><![CDATA[null@example.com (geektrader)]]></author>
			<pubDate>Thu, 24 Jan 2019 19:53:58 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/54129/#p54129</guid>
		</item>
		<item>
			<title><![CDATA[Add TakeProfit in Percent in Portfolio?]]></title>
			<link>https://forexsb.com/forum/post/54125/#p54125</link>
			<description><![CDATA[<p>Hi,</p><p>i like to mod my Portfolio Ea with a special function. I want to Close all trades if % profit reached.</p><p>I tried this out with a input amount and it is working. But how i have to change this when i want to say if 5% profit reached close all trades?</p><p>THE INPUT:<br /></p><div class="codebox"><pre><code>input bool                 useTakeProfitBasket        = true;                 // USE TAKEPROFIT BASKET
input double               TakeProfitBasket           = 100;  </code></pre></div><br /><p>ON ON TICK I ADD THIS:<br /></p><div class="codebox"><pre><code>void OnTick()
  {
    if(useTakeProfitBasket &amp;&amp; (Open_Orders_Profit()&gt;=TakeProfitBasket))
   {
      CloseAllPositions();
      Print(&quot;Take Profit Basket Reached. All Trades CLOSED!&quot;);
      printf(&quot;Take Profit Basket Reached. All Trades CLOSED!&quot;);
      Alert(&quot;Take Profit Basket Reached. All Trades CLOSED!&quot;);
      Comment(&quot;Take Profit Basket Reached. All Trades CLOSED!&quot;);
   }</code></pre></div><br /><p>and i have this function added to get Profit of open orders.</p><div class="codebox"><pre><code>double Open_Orders_Profit()
{
   double openordersprofit = 0;
   RefreshRates();
   int Total=OrdersTotal();
   if(Total&gt;0)
   {
      for(int i=Total-1; i&gt;=0; i--)
      {
         if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==TRUE)
         {
            const int magicNumber = OrderMagicNumber();
            if(OrderSymbol()==Symbol() &amp;&amp; (1000 * Base_Magic_Number &lt;= magicNumber &amp;&amp; magicNumber &lt; (1000 * Base_Magic_Number + 100)))
            {
               openordersprofit +=OrderProfit()+OrderSwap()+OrderCommission();
            }
         }
      }
   }
   return(openordersprofit);
}</code></pre></div><p>Can someone help me out to change this to have it in percent?</p>]]></description>
			<author><![CDATA[null@example.com (Roughey)]]></author>
			<pubDate>Thu, 24 Jan 2019 17:01:10 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/54125/#p54125</guid>
		</item>
	</channel>
</rss>
