Monday, December 01, 2008     | Register
TradersStudio Forums
Subject: Volatility-based stops in Trend Harmony

You are not authorized to post a reply.   
Author Messages
tgawlik
Posts:7

09-18-2006 9:33 PM Alert 

I am looking for some guidance on the best way for setting up volatility-based stops in Trend Harmony.  In particular something along the lines of

ProtStopLong  = EPrice - (3*ATR)

ProtStopShort = EPrice + (3*ATR)

I have successfully done it in Super Turtle using the Bias Method provided but I'm wondering if there is a cleaner way in Trend Harmony before I start into major code modifications.

Thanks in advance,

 

Tom Gawlik

murray
Posts:431

09-18-2006 9:39 PM Alert 

Here is a function I wrote to take care of this and set up for percent risk money management.

 

Sub ATRStopAndRisk(AtrMult)
Dim ATROnEntry As BarArray
settraderisk(Average(TrueRange,3,0)*AtrMult)
If MarketPosition<>MarketPositionΏ] Then
ATROnEntry=AtrMult*Average(TrueRange,3,1)
End If
ExitLong("ATRStopLX","",GetCurrentSize(""),EntryPrice-ATROnEntry,Stop,Day)
ExitShort("ATRStopSX","",GetCurrentSize(""),EntryPrice+ATROnEntry,Stop,Day)
End Sub

 

Make it a system function. Comment out the dollar stop and add this function.

tracy_crider
Posts:3

03-22-2007 7:33 PM Alert 

I'm having difficulty with this code snippet, cant find any reference to MarketPosition in the TSHelp file nor LangRef. Maybe it's just a matter of getting the help file indexed properly, however...What are the two characters at the end of the IF test:

MarketPosition <> MarketPosition ?? <==

And how do I find a definition for MarketPosition?

 

Thanks,

Tracy

tgawlik
Posts:7

03-24-2007 11:03 AM Alert 

Tracy:

I'm sure Murray will clarify if I get something wrong but here is my understanding:

I believe MarketPosition can take one of three values, -1 = short position in the market, 0 = no position in the market, 1 = long position in the market

For MarketPosition<>MarketPositionΏ] it is simply saying that our market position has change since yesterday

MarketPosition[??] is the offset in days (any positive integer) so MarketPositionΏ] is our market position yesterday.

 

Hope that helps

 

Tom Gawlik

murray
Posts:431

03-24-2007 1:56 PM Alert 
Correct Marketposition is current bar. It the same as MarketpositionΎ]. MarketPositionΏ] is one bar ago.
You are not authorized to post a reply.
Forums > Technical Trading > Trade Plans, Money Management & Risk Control > Volatility-based stops in Trend Harmony



ActiveForums 3.6
TradersStudio® Copyright 2004-2008 All Rights Reserved   |  Privacy Statement  |  Terms Of Use