<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>BullCharts : Stop loss issue using highest</title>
  <link>http://www.bullcharts.com.au/forum/</link>
  <description>This is an XML content feed of; BullCharts : BullScript : Stop loss issue using highest</description>
  <copyright>Copyright (c) 2006-2009 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 15 Apr 2026 13:33:22 +0000</pubDate>
  <lastBuildDate>Sat, 14 Nov 2009 16:10:36 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.bullcharts.com.au/forum/RSS_post_feed.asp?TID=593</WebWizForums:feedURL>
  <image>
   <title>BullCharts</title>
   <url>http://www.bullcharts.com.au/forum/http://www.bullcharts.com.au/images/bull_logo.gif</url>
   <link>http://www.bullcharts.com.au/forum/</link>
  </image>
  <item>
   <title>Stop loss issue using highest : Brilliant work Kim :)  </title>
   <link>http://www.bullcharts.com.au/forum/forum_posts.asp?TID=593&amp;PID=2201#2201</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.bullcharts.com.au/forum/member_profile.asp?PF=189" rel="nofollow">maximo</a><br /><strong>Subject:</strong> 593<br /><strong>Posted:</strong> 14&nbsp;Nov&nbsp;2009 at 4:10pm<br /><br /><P>Brilliant work Kim :)</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Sat, 14 Nov 2009 16:10:36 +0000</pubDate>
   <guid isPermaLink="true">http://www.bullcharts.com.au/forum/forum_posts.asp?TID=593&amp;PID=2201#2201</guid>
  </item> 
  <item>
   <title>Stop loss issue using highest : Thanks for your help with this,...</title>
   <link>http://www.bullcharts.com.au/forum/forum_posts.asp?TID=593&amp;PID=2198#2198</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.bullcharts.com.au/forum/member_profile.asp?PF=707" rel="nofollow">krickaby</a><br /><strong>Subject:</strong> 593<br /><strong>Posted:</strong> 12&nbsp;Nov&nbsp;2009 at 10:35pm<br /><br /><FONT size=2>Thanks for your help with this, the barnumber and lastvalue were the trick that worked.</FONT><DIV><FONT size=2>Here is the final indicator that is working.</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT color=#800080><FONT color=#800080><P><FONT size=2>&#091;Target</FONT></FONT></FONT><FONT size=2>=Price<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>Author</FONT></FONT>=Rickaby, Kim<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>Period</FONT></FONT>=Weekly<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>Category</FONT></FONT>=Stop Loss<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>Description</FONT></FONT>="Used to have trailing stop loss based on the number of shares purchased and how much money to risk. Calculates stop loss based on highest weekly close since purchased. Need to select 'This indicator is relevant to this security' only in the advanced tab when creating." <FONT color=#800080><FONT color=#800080>&#093;</P></FONT></FONT></FONT><P><FONT size=2>Pricetype:=<FONT color=#0000c0><FONT color=#0000c0>expression</FONT></FONT>(<FONT color=#008b8b><FONT color=#008b8b>"Enter Tpye. O,H,L,C"</FONT></FONT>,<FONT color=#0000c0><FONT color=#0000c0>c</FONT></FONT>); </FONT></P><P><FONT size=2>Dollar:= <FONT color=#0000c0><FONT color=#0000c0>input</FONT></FONT>(<FONT color=#008b8b><FONT color=#008b8b>"Enter MAX dollar loss"</FONT></FONT>, 500, 1, 10000);</FONT></P><P><FONT size=2>Noshares:=<FONT color=#0000c0><FONT color=#0000c0>input</FONT></FONT>(<FONT color=#008b8b><FONT color=#008b8b>"Enter number shares"</FONT></FONT>, 1, 1, 500000);</FONT></P><P><FONT size=2>Purchasedate:=<FONT color=#0000c0><FONT color=#0000c0>inputdate</FONT></FONT>(<FONT color=#008b8b><FONT color=#008b8b>"Purchase Date"</FONT></FONT>);</FONT></P><P><FONT size=2>Bars:=<FONT color=#0000c0><FONT color=#0000c0>lastvalue</FONT></FONT>(<FONT color=#0000c0><FONT color=#0000c0>barnumber</FONT></FONT>)- <FONT color=#0000c0><FONT color=#0000c0>datediff</FONT></FONT>(<FONT color=#008b8b><FONT color=#008b8b>"W"</FONT></FONT>, Purchasedate, <FONT color=#0000c0><FONT color=#0000c0>systemdate</FONT></FONT>)-1;</FONT></P><P><FONT size=2>Startofweek:=<FONT color=#0000c0><FONT color=#0000c0>if</FONT></FONT>(<FONT color=#0000c0><FONT color=#0000c0>dayofweek</FONT></FONT>(Purchasedate)=1,Purchasedate, <FONT color=#0000c0><FONT color=#0000c0>dateadd</FONT></FONT>(<FONT color=#008b8b><FONT color=#008b8b>"d"</FONT></FONT>,-<FONT color=#0000c0><FONT color=#0000c0>dayofweek</FONT></FONT>(Purchasedate)+1, Purchasedate));</FONT></P><P><FONT size=2>Highvalue:=<FONT color=#0000c0><FONT color=#0000c0>if</FONT></FONT>(<FONT color=#0000c0><FONT color=#0000c0>barnumber</FONT></FONT>&gt;=Bars, <FONT color=#0000c0><FONT color=#0000c0>highest</FONT></FONT>(Pricetype, <FONT color=#0000c0><FONT color=#0000c0>barnumber</FONT></FONT>-Bars), <FONT color=#0000c0><FONT color=#0000c0>hist</FONT></FONT>(<FONT color=#0000c0><FONT color=#0000c0>c</FONT></FONT>,Bars));</FONT></P><P><FONT size=2>Stoploss:=Highvalue-(Dollar/Noshares);</FONT></P><FONT color=#800080><FONT color=#800080><P><FONT size=2>&#091;color</FONT></FONT></FONT><FONT size=2>=red<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>linestyle</FONT></FONT>=dotted<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>width</FONT></FONT>=2<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>Name</FONT></FONT>=Stoploss<FONT color=#800080><FONT color=#800080>&#093;</P></FONT></FONT></FONT><FONT color=#0000c0><FONT color=#0000c0><P><FONT size=2>if</FONT></FONT></FONT><FONT size=2> (<FONT color=#0000c0><FONT color=#0000c0>now</FONT></FONT>&gt;=<FONT color=#0000c0><FONT color=#0000c0>dateadd</FONT></FONT>(<FONT color=#008b8b><FONT color=#008b8b>"w"</FONT></FONT>,-1, Purchasedate), Stoploss, <FONT color=#0000c0><FONT color=#0000c0>undefined</FONT></FONT>);</FONT></P><FONT color=#800080><FONT color=#800080><P><FONT size=2>&#091;color</FONT></FONT></FONT><FONT size=2>=blue<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>linestyle</FONT></FONT>=Bar<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>width</FONT></FONT>=1<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>Name</FONT></FONT>=Purchasedate<FONT color=#800080><FONT color=#800080>&#093;</P></FONT></FONT></FONT><FONT color=#0000c0><FONT color=#0000c0><P><FONT size=2>if</FONT></FONT></FONT><FONT size=2>(onorskipped(Startofweek), <FONT color=#0000c0><FONT color=#0000c0>L</FONT></FONT>, <FONT color=#0000c0><FONT color=#0000c0>undefined</FONT></FONT>);</FONT></P></DIV>]]>
   </description>
   <pubDate>Thu, 12 Nov 2009 22:35:54 +0000</pubDate>
   <guid isPermaLink="true">http://www.bullcharts.com.au/forum/forum_posts.asp?TID=593&amp;PID=2198#2198</guid>
  </item> 
  <item>
   <title>Stop loss issue using highest : Here&amp;#039;s a way of auto offsetting...</title>
   <link>http://www.bullcharts.com.au/forum/forum_posts.asp?TID=593&amp;PID=2194#2194</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.bullcharts.com.au/forum/member_profile.asp?PF=189" rel="nofollow">maximo</a><br /><strong>Subject:</strong> 593<br /><strong>Posted:</strong> 09&nbsp;Nov&nbsp;2009 at 12:46am<br /><br /><P>Here's a way of auto offsetting from your purchase date:</P><P>Barnumber ; returns the number of the current bar.</P><P>LastValue(Barnumber) ;returns the number of the last bar in the chart.</P><P>You can subtract the barnumber of the exact date of purchase&nbsp;using the above</P><DIV>function of the last bar in the chart and then render any value or indicator :)</DIV><DIV></DIV><span style="font-size:10px"><br /><br />Edited by maximo - 09&nbsp;Nov&nbsp;2009 at 3:28am</span>]]>
   </description>
   <pubDate>Mon, 09 Nov 2009 00:46:35 +0000</pubDate>
   <guid isPermaLink="true">http://www.bullcharts.com.au/forum/forum_posts.asp?TID=593&amp;PID=2194#2194</guid>
  </item> 
  <item>
   <title>Stop loss issue using highest : I can&amp;#039;t help with a solution...</title>
   <link>http://www.bullcharts.com.au/forum/forum_posts.asp?TID=593&amp;PID=2193#2193</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.bullcharts.com.au/forum/member_profile.asp?PF=632" rel="nofollow">rcameron</a><br /><strong>Subject:</strong> 593<br /><strong>Posted:</strong> 08&nbsp;Nov&nbsp;2009 at 4:21pm<br /><br />I can't help with a solution to your issue after having looked for a similar problem for some time. However, a small tip may help you on the coding, but you may already know it. You can use the expression function to select H, L, O, C, V rather than the Dataarray &nbsp;variable and If statement logic you've used. Eg expr:= expression("Select parameter",C) and substitute expr for Value2 in the formula. Cheers Rod]]>
   </description>
   <pubDate>Sun, 08 Nov 2009 16:21:50 +0000</pubDate>
   <guid isPermaLink="true">http://www.bullcharts.com.au/forum/forum_posts.asp?TID=593&amp;PID=2193#2193</guid>
  </item> 
  <item>
   <title>Stop loss issue using highest : Hope someone can help with a problem...</title>
   <link>http://www.bullcharts.com.au/forum/forum_posts.asp?TID=593&amp;PID=2191#2191</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.bullcharts.com.au/forum/member_profile.asp?PF=707" rel="nofollow">krickaby</a><br /><strong>Subject:</strong> 593<br /><strong>Posted:</strong> 08&nbsp;Nov&nbsp;2009 at 12:34pm<br /><br />Hope someone can help with a problem with a indicator I am creating.<DIV>&nbsp;</DIV><DIV>I am trying to create a stop loss that calculates the highest closing price since purchasing a stock.&nbsp; The stop loss works provided that the stock has been going up, however if the purchase price is less than a high x times ago before&nbsp;purchase date&nbsp;it calculates the stop based on that high.&nbsp; </DIV><DIV>&nbsp;</DIV><DIV>The issue is that I calculated the number of bars between purchase date and today, I then do a highest.&nbsp; But as the highest starts from the day of purchase it then ends up going back x number of bars before purchase.&nbsp; I tried to make the bar value adjust based on the NOW which should be the bar being processed but Bullcharts returns and error which is "Error905: Object reference not set to an instance of an object.&nbsp; If I replace the BARS variable in the highest function with a number then error goes away but indicator returns wrong values.</DIV><DIV>&nbsp;</DIV><DIV>To see this exact problem use WOW on a weekly and set the number to replace BARS as 32, the indicator has the defaults set for the rest of the values which should work.</DIV><DIV>&nbsp;</DIV><DIV>Any help on this would be aprreciated.</DIV><DIV>&nbsp;</DIV><DIV>Thanks</DIV><DIV><FONT color=#800080 size=3><FONT color=#800080 size=3><P><FONT size=2>&#091;Target</FONT></FONT></FONT><FONT size=2>=Price<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>Author</FONT></FONT>=Rickaby<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>Period</FONT></FONT>=Weekly<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>Category</FONT></FONT>=Stop Loss<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>Description</FONT></FONT>="Used to have trailing stop loss based on the number of shares purchased and how much money to risk. Calculates stop loss based on highest weekly close since purchased. Need to select 'This indicator is relevant to this security' only in the advanced tab when creating." <FONT color=#800080><FONT color=#800080>&#093;</P></FONT></FONT></FONT><P><FONT size=2>Dataarray:=<FONT color=#0000c0><FONT color=#0000c0>input</FONT></FONT>(<FONT color=#008b8b><FONT color=#008b8b>"Enter Type. 1=o, 2=h, 3=l, 4=c"</FONT></FONT>, 4, 1, 4);</FONT></P><P><FONT size=2>Value2:=<FONT color=#0000c0><FONT color=#0000c0>If</FONT></FONT>(Dataarray=1,<FONT color=#0000c0><FONT color=#0000c0>O</FONT></FONT>, <FONT color=#0000c0><FONT color=#0000c0>If</FONT></FONT>(Dataarray=2,<FONT color=#0000c0><FONT color=#0000c0>H</FONT></FONT>, <FONT color=#0000c0><FONT color=#0000c0>If</FONT></FONT>(Dataarray=3,<FONT color=#0000c0><FONT color=#0000c0>L</FONT></FONT>, <FONT color=#0000c0><FONT color=#0000c0>C</FONT></FONT>))); </FONT></P><P><FONT size=2>Dollar:= <FONT color=#0000c0><FONT color=#0000c0>input</FONT></FONT>(<FONT color=#008b8b><FONT color=#008b8b>"Enter MAX dollar loss"</FONT></FONT>, 500, 1, 10000);</FONT></P><P><FONT size=2>Noshares:=<FONT color=#0000c0><FONT color=#0000c0>input</FONT></FONT>(<FONT color=#008b8b><FONT color=#008b8b>"Enter number shares"</FONT></FONT>, 291, 1, 500000);</FONT></P><P><FONT size=2>Purchasedate:=<FONT color=#0000c0><FONT color=#0000c0>inputdate</FONT></FONT>(<FONT color=#008b8b><FONT color=#008b8b>"Purchase Date"</FONT></FONT>,<FONT color=#0000c0><FONT color=#0000c0>date</FONT></FONT>(2009,03,24));</FONT></P><P><FONT size=2>Bars:=<FONT color=#0000c0><FONT color=#0000c0>if</FONT></FONT>(<FONT color=#0000c0><FONT color=#0000c0>now</FONT></FONT>&gt;Purchasedate, <FONT color=#0000c0><FONT color=#0000c0>datediff</FONT></FONT>(<FONT color=#008b8b><FONT color=#008b8b>"W"</FONT></FONT>, Purchasedate, <FONT color=#0000c0><FONT color=#0000c0>now</FONT></FONT>) ,0);</FONT></P><P><FONT size=2>Highvalue:=<FONT color=#0000c0><FONT color=#0000c0>if</FONT></FONT>(<FONT color=#0000c0><FONT color=#0000c0>now</FONT></FONT>&gt;Purchasedate,<FONT color=#0000c0><FONT color=#0000c0>Highest</FONT></FONT>(Value2,Bars),<FONT color=#0000c0><FONT color=#0000c0>undefined</FONT></FONT>);</FONT></P><P><FONT size=2>Stoploss:=Highvalue-(Dollar/Noshares);</FONT></P><FONT color=#800080><FONT color=#800080><P><FONT size=2>&#091;color</FONT></FONT></FONT><FONT size=2>=red<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>linestyle</FONT></FONT>=dotted<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>width</FONT></FONT>=2<FONT color=#800080><FONT color=#800080>&#093;</P></FONT></FONT></FONT><FONT color=#0000c0><FONT color=#0000c0><P><FONT size=2>if</FONT></FONT></FONT><FONT size=2> (<FONT color=#0000c0><FONT color=#0000c0>now</FONT></FONT>&gt;Purchasedate,Stoploss,<FONT color=#0000c0><FONT color=#0000c0>undefined</FONT></FONT>);</FONT></P><FONT color=#800080><FONT color=#800080><P><FONT size=2>&#091;color</FONT></FONT></FONT><FONT size=2>=blue<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>linestyle</FONT></FONT>=Bar<FONT color=#800080><FONT color=#800080>;</FONT></FONT> <FONT color=#800080><FONT color=#800080>width</FONT></FONT>=1<FONT color=#800080><FONT color=#800080>&#093;</P></FONT></FONT></FONT><FONT color=#0000c0><FONT color=#0000c0><P><FONT size=2>if</FONT></FONT></FONT><FONT size=2>(OnOrSkipped(Purchasedate),<FONT color=#0000c0><FONT color=#0000c0>h</FONT></FONT>,<FONT color=#0000c0><FONT color=#0000c0>undefined</FONT></FONT>);</FONT><FONT size=3></P></FONT></DIV>]]>
   </description>
   <pubDate>Sun, 08 Nov 2009 12:34:10 +0000</pubDate>
   <guid isPermaLink="true">http://www.bullcharts.com.au/forum/forum_posts.asp?TID=593&amp;PID=2191#2191</guid>
  </item> 
 </channel>
</rss>