<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — Critical Error in Portfolio Test]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/7792/" />
	<updated>2019-04-15T14:31:01Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/7792/critical-error-in-portfolio-test/</id>
		<entry>
			<title type="html"><![CDATA[Re: Critical Error in Portfolio Test]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55155/#p55155" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Popov wrote:</cite><blockquote><p>If it is that one:</p><div class="codebox"><pre><code> g_acWinsLosses[iCountTrades++] = 1;</code></pre></div><p>It is not our code.</p><br /><p>Check the array initialization if have enough space.</p></blockquote></div><p>Yes, this the Code from Sleytus, from MT4-Tracker. I have thinked, you ok with this?</p><p>I dont understand, how i can do. But i see i must under 30.000 Trades. </p><p>Thanks</p>]]></content>
			<author>
				<name><![CDATA[rantampla]]></name>
				<uri>https://forexsb.com/forum/user/9800/</uri>
			</author>
			<updated>2019-04-15T14:31:01Z</updated>
			<id>https://forexsb.com/forum/post/55155/#p55155</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Critical Error in Portfolio Test]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55148/#p55148" />
			<content type="html"><![CDATA[<p>If it is that one:</p><div class="codebox"><pre><code> g_acWinsLosses[iCountTrades++] = 1;</code></pre></div><p>It is not our code.</p><br /><p>Check the array initialization if have enough space.</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2019-04-15T09:03:51Z</updated>
			<id>https://forexsb.com/forum/post/55148/#p55148</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Critical Error in Portfolio Test]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55147/#p55147" />
			<content type="html"><![CDATA[<p>Ich have now 608 to 671 copy.</p><p>Thank you <img src="https://forexsb.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><div class="codebox"><pre><code>// $(__MT4TRACKER)
#define MAX_WINS_LOSSES  (2000)
char g_acWinsLosses[MAX_WINS_LOSSES];
int GetMagicStats(const int magicNumber, double&amp; dWinRatio, int&amp; iMaxConsecutiveLosses)
{
    dWinRatio = 0;
    iMaxConsecutiveLosses = 0;
    
    int iCountTrades = 0;
    for (int i = 0; i &lt; MAX_WINS_LOSSES; i++)
    {
        g_acWinsLosses[i] = 0;
    }

    int total = OrdersHistoryTotal();
    for(int pos=total-1; pos&gt;=0; pos--)
    {
        if((true == OrderSelect(pos, SELECT_BY_POS,MODE_HISTORY)) &amp;&amp; (OrderSymbol() == _Symbol) &amp;&amp; (OrderMagicNumber() == magicNumber))
        {
            // The net profit value (without swaps or commissions) for the selected order. 
            // For open orders, it is the current unrealized profit. For closed orders, it is the fixed profit.
            if (OrderProfit() &gt;= 0)
                g_acWinsLosses[iCountTrades++] = 1;
            else 
                g_acWinsLosses[iCountTrades++] = 0;
        }
    }
          
    int iCountWins         = 0;
    int iCountLosses       = 0;
    int iConsecutiveLosses = 0;
    int iNRecentTrades     = 99999;
    if (Most_Recent_Trades &gt; 0)
        iNRecentTrades = Most_Recent_Trades;
            
    if ((iCountTrades &gt; 0) &amp;&amp; (iCountTrades &lt; iNRecentTrades))
    {
        for (int i = 0; i &lt; iCountTrades; i++)
        {
            if (g_acWinsLosses[i] &gt; 0)
            {
                iCountWins++;
                iConsecutiveLosses = 0;
            }
            else
            {
                iCountLosses++;
                iConsecutiveLosses++;
                if (iConsecutiveLosses &gt; iMaxConsecutiveLosses)
                    iMaxConsecutiveLosses = iConsecutiveLosses;
            }
        }
        dWinRatio = (double)(iCountWins) / (double)(iCountTrades);
        // Print(&quot;INFO1: GetMagicStats: MagicNumber: &quot;, IntegerToString(magicNumber), &quot;, CountTrades: &quot;, IntegerToString(iCountTrades), &quot;, CountWins: &quot;, IntegerToString(iCountWins), &quot;, CountLosses: &quot;, IntegerToString(iCountLosses));
    }
    else if (iCountTrades &gt; 0)
    {
        for (int i = (iCountTrades-iNRecentTrades); i &lt; iCountTrades; i++)
        {
            if (g_acWinsLosses[i] &gt; 0)
            {
                iCountWins++;
                iConsecutiveLosses = 0;
            }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[rantampla]]></name>
				<uri>https://forexsb.com/forum/user/9800/</uri>
			</author>
			<updated>2019-04-15T08:03:40Z</updated>
			<id>https://forexsb.com/forum/post/55147/#p55147</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Critical Error in Portfolio Test]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55142/#p55142" />
			<content type="html"><![CDATA[<p>It says that the error is on line 632. Please copy the near lines to see what is there. It is probably some indicator.</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2019-04-15T05:56:19Z</updated>
			<id>https://forexsb.com/forum/post/55142/#p55142</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Critical Error in Portfolio Test]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/55139/#p55139" />
			<content type="html"><![CDATA[<p>Hi Miroslav,</p><p>have you a Idea for the attach Picture with error in Tester?</p><p>It comes after ~ 20.000 Trades.</p><p>Thanks, Marcus.</p>]]></content>
			<author>
				<name><![CDATA[rantampla]]></name>
				<uri>https://forexsb.com/forum/user/9800/</uri>
			</author>
			<updated>2019-04-14T23:11:59Z</updated>
			<id>https://forexsb.com/forum/post/55139/#p55139</id>
		</entry>
</feed>
