<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forex Software — MT4 Portfolio not detecting previous trades]]></title>
	<link rel="self" href="https://forexsb.com/forum/feed/atom/topic/10033/" />
	<updated>2025-12-08T14:41:33Z</updated>
	<generator>PunBB</generator>
	<id>https://forexsb.com/forum/topic/10033/mt4-portfolio-not-detecting-previous-trades/</id>
		<entry>
			<title type="html"><![CDATA[Re: MT4 Portfolio not detecting previous trades]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/83041/#p83041" />
			<content type="html"><![CDATA[<p>&gt; If that&#039;s the case, wouldn&#039;t it make sense to have SetPosStats inside OnInit?</p><p>It makes sense.</p><p>I&#039;ll check it and will update the code.</p><p>Thank you!</p>]]></content>
			<author>
				<name><![CDATA[Popov]]></name>
				<uri>https://forexsb.com/forum/user/2/</uri>
			</author>
			<updated>2025-12-08T14:41:33Z</updated>
			<id>https://forexsb.com/forum/post/83041/#p83041</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: MT4 Portfolio not detecting previous trades]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/83035/#p83035" />
			<content type="html"><![CDATA[<p>Obviously the market needs to be open to check things proper, so you and your fix is making sense. Mql is not my forte unfortunately, but I&#039;ll try to confirm few things.</p>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2025-12-06T19:48:19Z</updated>
			<id>https://forexsb.com/forum/post/83035/#p83035</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: MT4 Portfolio not detecting previous trades]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/83034/#p83034" />
			<content type="html"><![CDATA[<p>Read a bit trough the code and added: SetPosStats(); on the initialization:<br /></p><div class="codebox"><pre><code>int OnInit(void)
  {
   Comment(&quot;&quot;);
   DeleteObjects();

   barTime   = Time[0];
   stopLevel = MarketInfo(_Symbol, MODE_STOPLEVEL);
   pip       = GetPipValue();

   accountProtectionMessage = &quot;&quot;;
   entryProtectionMessage   = &quot;&quot;;

   ParseNewsCurrenciesText();
   lastNewsUpdate = TimeCurrent();
   if(!MQLInfoInteger(MQL_TESTER))
      LoadNews();
   
   SetPosStats();
   OnTick();
   ChartRedraw(0);

   return INIT_SUCCEEDED;
  }</code></pre></div><p>Now my trades are recognized and I see them in the text written by the EA in the chart. Possible that I was not seeing any positions because the market is closed, hence OnTick does not get triggered and by consequence SetPosStats() also does not get called?</p><p>If that&#039;s the case, wouldn&#039;t it make sense to have SetPosStats inside OnInit?</p>]]></content>
			<author>
				<name><![CDATA[ironhak]]></name>
				<uri>https://forexsb.com/forum/user/19108/</uri>
			</author>
			<updated>2025-12-06T18:41:26Z</updated>
			<id>https://forexsb.com/forum/post/83034/#p83034</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: MT4 Portfolio not detecting previous trades]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/83033/#p83033" />
			<content type="html"><![CDATA[<p>Just to be extra-clear:</p><p><span class="postimg"><img src="https://i.imgur.com/1e3yB3r.png" alt="https://i.imgur.com/1e3yB3r.png" /></span></p>]]></content>
			<author>
				<name><![CDATA[ironhak]]></name>
				<uri>https://forexsb.com/forum/user/19108/</uri>
			</author>
			<updated>2025-12-06T18:02:01Z</updated>
			<id>https://forexsb.com/forum/post/83033/#p83033</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: MT4 Portfolio not detecting previous trades]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/83032/#p83032" />
			<content type="html"><![CDATA[<p>Right now I just restarted my machine and the EA does not recognize anymore all my open trades. Please how can I get this fixed by monday?</p><p>What should I do? There are no errors reported on Journal.</p>]]></content>
			<author>
				<name><![CDATA[ironhak]]></name>
				<uri>https://forexsb.com/forum/user/19108/</uri>
			</author>
			<updated>2025-12-06T18:00:16Z</updated>
			<id>https://forexsb.com/forum/post/83032/#p83032</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: MT4 Portfolio not detecting previous trades]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/83031/#p83031" />
			<content type="html"><![CDATA[<p>Hello</p><p>When it happened it was because I accidentely closed the chart. When I opened a new chart and loaded the expert, then past active trades were not picked up. Yes the magic number prefix was the same. <br />There were no errors by the expert reported.</p>]]></content>
			<author>
				<name><![CDATA[ironhak]]></name>
				<uri>https://forexsb.com/forum/user/19108/</uri>
			</author>
			<updated>2025-12-06T17:21:14Z</updated>
			<id>https://forexsb.com/forum/post/83031/#p83031</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: MT4 Portfolio not detecting previous trades]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/83030/#p83030" />
			<content type="html"><![CDATA[<p>The lead developer will have a better say on this. He&#039;ll be here.</p><p>But usually it doesn&#039;t happen, portfolio recognizes its past trades. The problem might be that you closed the chart, if my memory serves me correct it is better to have it on the exact same chart, but on the other hand if the magics are the same (did you double check?) it should work ok.</p><p>Have you tried removing the portfolio and re-attaching it few seconds later? Sort of a restart without changing the chart.</p><p>And the most trivial - are there any error messages?</p><p>Can you replicate the error? First put it on chart, let it open a couple of trades, remove the portfolio, then re-attach it. <br />And try the same but now by closing the chart and opening a new one and then re-attaching the EA.</p>]]></content>
			<author>
				<name><![CDATA[footon]]></name>
				<uri>https://forexsb.com/forum/user/1242/</uri>
			</author>
			<updated>2025-12-05T18:23:15Z</updated>
			<id>https://forexsb.com/forum/post/83030/#p83030</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: MT4 Portfolio not detecting previous trades]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/83029/#p83029" />
			<content type="html"><![CDATA[<p>Anyone?</p>]]></content>
			<author>
				<name><![CDATA[ironhak]]></name>
				<uri>https://forexsb.com/forum/user/19108/</uri>
			</author>
			<updated>2025-12-05T13:36:43Z</updated>
			<id>https://forexsb.com/forum/post/83029/#p83029</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[MT4 Portfolio not detecting previous trades]]></title>
			<link rel="alternate" href="https://forexsb.com/forum/post/83028/#p83028" />
			<content type="html"><![CDATA[<p>Hello</p><p>I imported into MT4 a generated portfolio of strategies. I let it run for one day and everything worked. When market closed I closed the chart where the EA was running, but did not closed the trades.</p><p>Now the market is open again, the expert is running and the settings are the same. I have 3 trades open with the same magic number prefix of EA settings, but the EA is not detecting those positions... Hence it will not manage them.</p><p>How can I fix this? Thanks</p>]]></content>
			<author>
				<name><![CDATA[ironhak]]></name>
				<uri>https://forexsb.com/forum/user/19108/</uri>
			</author>
			<updated>2025-12-02T08:23:37Z</updated>
			<id>https://forexsb.com/forum/post/83028/#p83028</id>
		</entry>
</feed>
