<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to plot a trailing stop in the Price chart</title>
	<atom:link href="http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/</link>
	<description>Providing you with tips &#038; tricks for everyday AmiBroker use</description>
	<lastBuildDate>Tue, 29 Mar 2011 08:43:54 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tomasz Janeczko</title>
		<link>http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/comment-page-1/#comment-4643</link>
		<dc:creator>Tomasz Janeczko</dc:creator>
		<pubDate>Wed, 30 Jul 2008 11:30:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/#comment-4643</guid>
		<description>For &quot;point&quot; mode replace
StopLevel = 1 - Param(&quot;trailing stop %&quot;, 3, 0.1, 10, 0.1)/100;
with
StopLevel = Param(&quot;trailing stop pt&quot;, 3, 0.1, 10, 0.1);

and every occurrence of:
High[ i ] * stoplevel

with
High[ i ] - stoplevel</description>
		<content:encoded><![CDATA[<p>For &#8220;point&#8221; mode replace<br />
StopLevel = 1 &#8211; Param(&#8221;trailing stop %&#8221;, 3, 0.1, 10, 0.1)/100;<br />
with<br />
StopLevel = Param(&#8221;trailing stop pt&#8221;, 3, 0.1, 10, 0.1);</p>
<p>and every occurrence of:<br />
High[ i ] * stoplevel</p>
<p>with<br />
High[ i ] &#8211; stoplevel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flávio</title>
		<link>http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/comment-page-1/#comment-4642</link>
		<dc:creator>Flávio</dc:creator>
		<pubDate>Wed, 30 Jul 2008 04:20:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/#comment-4642</guid>
		<description>Can you please put an example using ApplyStop(stopTypeTrailing, stopModePoint...)? I.e. show how to calculate &quot;stopline&quot; so that the plot match the array used by ApplyStop() internally when in stopModePoint mode? Thanks.</description>
		<content:encoded><![CDATA[<p>Can you please put an example using ApplyStop(stopTypeTrailing, stopModePoint&#8230;)? I.e. show how to calculate &#8220;stopline&#8221; so that the plot match the array used by ApplyStop() internally when in stopModePoint mode? Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tomasz Janeczko</title>
		<link>http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/comment-page-1/#comment-4093</link>
		<dc:creator>Tomasz Janeczko</dc:creator>
		<pubDate>Sun, 23 Mar 2008 13:43:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/#comment-4093</guid>
		<description>Yes it works with short trades as well. Remember to enable SHORT trades in the settings!</description>
		<content:encoded><![CDATA[<p>Yes it works with short trades as well. Remember to enable SHORT trades in the settings!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikey</title>
		<link>http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/comment-page-1/#comment-4092</link>
		<dc:creator>Mikey</dc:creator>
		<pubDate>Sun, 23 Mar 2008 12:48:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/#comment-4092</guid>
		<description>Does applystop also work to cover a short trade?

I can get the both methods to work as a buy/sell combo, but a simple replacement of &quot;Buy&quot; with &quot;Short&quot; and &quot;Sell&quot; with &quot;Cover&quot; doesn&#039;t seem to work. (also swapped the stop line around to be LowestSince, rather than HighestSince). 

Code I&#039;m trying is as follows

StopLevel = Param(&quot;trailing stop %&quot;, 3, 0.1, 10, 0.1 );

SetTradeDelays(0,0,0,0);

Short = Cross( MACD(), Signal() );
Cover= 0;
ApplyStop( stopTypeTrailing, stopModePercent, StopLevel, True );
 
Equity( 1); // evaluate stops, all quotes

InTrade = Flip( Short, Cover );

SetOption(&quot;EveryBarNullCheck&quot;, True );
stopline = IIf( InTrade, LowestSince( Short, Low ) * ( 1 - 0.01 * StopLevel ), Null );

PlotShapes(Short*shapeUpArrow,colorGreen,0,Low);
PlotShapes(Cover*shapeDownArrow,colorRed,0,High);

Plot( Cover,&quot;Price&quot;,colorBlack,styleBar);
Plot( stopline, &quot;trailing stop line&quot;, colorRed );</description>
		<content:encoded><![CDATA[<p>Does applystop also work to cover a short trade?</p>
<p>I can get the both methods to work as a buy/sell combo, but a simple replacement of &#8220;Buy&#8221; with &#8220;Short&#8221; and &#8220;Sell&#8221; with &#8220;Cover&#8221; doesn&#8217;t seem to work. (also swapped the stop line around to be LowestSince, rather than HighestSince). </p>
<p>Code I&#8217;m trying is as follows</p>
<p>StopLevel = Param(&#8221;trailing stop %&#8221;, 3, 0.1, 10, 0.1 );</p>
<p>SetTradeDelays(0,0,0,0);</p>
<p>Short = Cross( MACD(), Signal() );<br />
Cover= 0;<br />
ApplyStop( stopTypeTrailing, stopModePercent, StopLevel, True );</p>
<p>Equity( 1); // evaluate stops, all quotes</p>
<p>InTrade = Flip( Short, Cover );</p>
<p>SetOption(&#8221;EveryBarNullCheck&#8221;, True );<br />
stopline = IIf( InTrade, LowestSince( Short, Low ) * ( 1 &#8211; 0.01 * StopLevel ), Null );</p>
<p>PlotShapes(Short*shapeUpArrow,colorGreen,0,Low);<br />
PlotShapes(Cover*shapeDownArrow,colorRed,0,High);</p>
<p>Plot( Cover,&#8221;Price&#8221;,colorBlack,styleBar);<br />
Plot( stopline, &#8220;trailing stop line&#8221;, colorRed );</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tomasz Janeczko</title>
		<link>http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/comment-page-1/#comment-2794</link>
		<dc:creator>Tomasz Janeczko</dc:creator>
		<pubDate>Thu, 10 Jan 2008 10:38:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/#comment-2794</guid>
		<description>Copy-paste artists usually forget about using SAME settings. Most probably you are using non-zero trading delays while the example assumes using zero delay.</description>
		<content:encoded><![CDATA[<p>Copy-paste artists usually forget about using SAME settings. Most probably you are using non-zero trading delays while the example assumes using zero delay.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Janhaus</title>
		<link>http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/comment-page-1/#comment-2791</link>
		<dc:creator>Janhaus</dc:creator>
		<pubDate>Thu, 10 Jan 2008 01:21:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/#comment-2791</guid>
		<description>I pasted these two types of AFL code into 2 different formulas, and quickly find that these two approaches generate different trade results in Backtest. Any ideas?</description>
		<content:encoded><![CDATA[<p>I pasted these two types of AFL code into 2 different formulas, and quickly find that these two approaches generate different trade results in Backtest. Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grant Noble</title>
		<link>http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/comment-page-1/#comment-2772</link>
		<dc:creator>Grant Noble</dc:creator>
		<pubDate>Wed, 09 Jan 2008 07:14:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/#comment-2772</guid>
		<description>I must agree. I once spent months getting frustrated w/ ApplyStop before moving on to learn loop code. Seeing identical functionality presented both ways is fascinating and instructive. Nicely done Tomasz.</description>
		<content:encoded><![CDATA[<p>I must agree. I once spent months getting frustrated w/ ApplyStop before moving on to learn loop code. Seeing identical functionality presented both ways is fascinating and instructive. Nicely done Tomasz.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bert Steele</title>
		<link>http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/comment-page-1/#comment-1423</link>
		<dc:creator>Bert Steele</dc:creator>
		<pubDate>Sun, 17 Jun 2007 20:48:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/#comment-1423</guid>
		<description>Thanks for the looping example.  Examples that address issues via looping and also array approach are appreciated.</description>
		<content:encoded><![CDATA[<p>Thanks for the looping example.  Examples that address issues via looping and also array approach are appreciated.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

