Forum

Free Download More Info
Welcome to the Personal Stock Streamer Developers Forum. Anyone can read messages, but you must be a registered user in order to post. (Sorry, we did this in order to prevent forum spam.)

Everyone who is registered for the Developers Forum on this site should now also have permission to log in and post to the Support Forum.  This was done by hand, so we may have missed a couple of people.  Please let us know if you do not have access to both forums.
Subscribe to RSS Feed
PSS Developers Forum -> Avg. Basis on Trailing stop ext
Not logged in.
2006-06-01 16:01:10
1 of 4
#762
I noticed you had this little snippet in the code:

   ' find the starting high water mark for the given ticker
   public Function GetDefaultStopMark ( ticker )
      dMark = ticker.GetProperty("Avg. Basis")
      ' if there are no current holdings or the current price is higher, then set the high water mark from the current price
      dTickerPrice = ticker.GetProperty("Price")
      If (dMark = 0 Or dTickerPrice > dMark) Then
         dMark = dTickerPrice
      End If


I understand that the Avg. Basis is only available if there is an open transaction on the ticker, but what is the significance of using the avg. basis to set the DefaultStopMark?

Here is how I see the code:
if dmark = 0 (if the avg, basis is zero, then we have not entered a transaction on it) OR tickerPrice > dmark (the price is higher on the ticker than the avg. basis so set the dmark to the tickerPrice)
otherwise, we will keep the dmark set to the value of the avg. basis.

The confusion I guess is that I cannot understand why we would want to keep the avg. basis value if it is higher than the ticker price. My guess is that we are already in trouble on the ticker if the price is below this value.
 

Larry E. Hayes
Investors Haven

Larry E. Hayes
Investors Haven
Posted by: lehayes
2006-06-01 17:55:05
2 of 4
#764
in reply to #762
> The confusion I guess is that I cannot understand why we would want to keep the avg. basis value if it is higher than the ticker price. My guess is that we are already in trouble on the ticker if the price is below this value.

Yeah, pretty much. I figured that if the goal of the stop is to mimize your losses, you should base it on the higher of the average basis and current price, rather than just the current price. Of course this is also one of the reasons I posted the code; if you want to change how it calculates the initial high water mark, it's easy.
      
Anatoly Ivasyuk
DTLink Software

Anatoly Ivasyuk
DTLink Software
2006-06-01 17:58:56
3 of 4
#765
in reply to #764
No the code is fine, i am more interested in your insights on it. Is the avg. Basis a good method of determining a level for a stop loss?
      
Larry E. Hayes
Investors Haven

Larry E. Hayes
Investors Haven
Posted by: lehayes
2006-06-01 18:20:50
4 of 4
#771
in reply to #765
I think so, but that's just my opinion.
      
Anatoly Ivasyuk
DTLink Software

Anatoly Ivasyuk
DTLink Software