<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Forex Software — Use Trailing stop without settings of strategy]]></title>
		<link>https://forexsb.com/forum/topic/9898/use-trailing-stop-without-settings-of-strategy/</link>
		<atom:link href="https://forexsb.com/forum/feed/rss/topic/9898/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Use Trailing stop without settings of strategy.]]></description>
		<lastBuildDate>Fri, 24 Jan 2025 17:40:08 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Use Trailing stop without settings of strategy]]></title>
			<link>https://forexsb.com/forum/post/82446/#p82446</link>
			<description><![CDATA[<div class="quotebox"><cite>Popov wrote:</cite><blockquote><p>You can make a &quot;MQL script&quot; that loops over all the open positions and modify the SL as needed.<br />You can make a separate script for each case. </p><p>Here is how we loop over the positions:<br /></p><div class="codebox"><pre><code>   for(int i = PositionsTotal() - 1; i &gt;= 0; i -= 1)
     {
      const ulong ticket = PositionGetTicket(i);
      if(ticket == 0 || !PositionSelectByTicket(ticket))
         continue;

      const string posSymbol = PositionGetString (POSITION_SYMBOL);
      const long   posMagic  = PositionGetInteger(POSITION_MAGIC);

      // ...
     }</code></pre></div><p>Take a look at these two functions:<br /> - <strong>GetTrailingStopPrice</strong> - it calculates the new value of Traling SL according to the current price and a given Stop Loss</p><p> - <strong>ManageTrailingStop</strong> - it either closes a position or modifies it if the SL needs trailing</p><p>- <strong>ModifyPosition</strong> - does the actual SL modification (Trailing)</p><p>Look for these function in a Portfolio Expert or in a single Expert file</p></blockquote></div><p>ok thanks i will try</p>]]></description>
			<author><![CDATA[null@example.com (Roughey)]]></author>
			<pubDate>Fri, 24 Jan 2025 17:40:08 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/82446/#p82446</guid>
		</item>
		<item>
			<title><![CDATA[Re: Use Trailing stop without settings of strategy]]></title>
			<link>https://forexsb.com/forum/post/82404/#p82404</link>
			<description><![CDATA[<p>You can make a &quot;MQL script&quot; that loops over all the open positions and modify the SL as needed.<br />You can make a separate script for each case. </p><p>Here is how we loop over the positions:<br /></p><div class="codebox"><pre><code>   for(int i = PositionsTotal() - 1; i &gt;= 0; i -= 1)
     {
      const ulong ticket = PositionGetTicket(i);
      if(ticket == 0 || !PositionSelectByTicket(ticket))
         continue;

      const string posSymbol = PositionGetString (POSITION_SYMBOL);
      const long   posMagic  = PositionGetInteger(POSITION_MAGIC);

      // ...
     }</code></pre></div><p>Take a look at these two functions:<br /> - <strong>GetTrailingStopPrice</strong> - it calculates the new value of Traling SL according to the current price and a given Stop Loss</p><p> - <strong>ManageTrailingStop</strong> - it either closes a position or modifies it if the SL needs trailing</p><p>- <strong>ModifyPosition</strong> - does the actual SL modification (Trailing)</p><p>Look for these function in a Portfolio Expert or in a single Expert file</p>]]></description>
			<author><![CDATA[null@example.com (Popov)]]></author>
			<pubDate>Sat, 18 Jan 2025 20:45:47 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/82404/#p82404</guid>
		</item>
		<item>
			<title><![CDATA[Use Trailing stop without settings of strategy]]></title>
			<link>https://forexsb.com/forum/post/82401/#p82401</link>
			<description><![CDATA[<p>Hi,</p><p>we have now a trailing stop integrated in the code. But it uses the trailing from the strategy each. Now i think about how can we change the code so i use a trailing stop for all strategys with same global settings. So the trailing not depends on the strategy but for all on the magicnumber. Maybe @Popov can help.</p>]]></description>
			<author><![CDATA[null@example.com (Roughey)]]></author>
			<pubDate>Sat, 18 Jan 2025 08:55:55 +0000</pubDate>
			<guid>https://forexsb.com/forum/post/82401/#p82401</guid>
		</item>
	</channel>
</rss>
