Register Login
Forums    February 9, 2012
TradersStudio Forums
Volatility-based stops in Trend Harmony
Last Post 03-24-2007 01:56 PM by mur ang. 4 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Thomas Gawlik
New Member
New Member
Posts:7

--
09-18-2006 09:33 PM

    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

    mur ang
    Advanced Member
    Advanced Member
    Posts:525

    --
    09-18-2006 09:39 PM

    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[1] 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
    New Member
    New Member
    Posts:3

    --
    03-22-2007 07:33 PM

    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

    Thomas Gawlik
    New Member
    New Member
    Posts:7

    --
    03-24-2007 11:03 AM

    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[1] it is simply saying that our market position has change since yesterday

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

     

    Hope that helps

     

    Tom Gawlik

    mur ang
    Advanced Member
    Advanced Member
    Posts:525

    --
    03-24-2007 01:56 PM
    Correct Marketposition is current bar. It the same as Marketposition[0]. MarketPosition[1] is one bar ago.
    You are not authorized to post a reply.


     TradersStudio, Inc. ® Copyright 2004-2012 All Rights Reserved   Terms Of Use  Privacy Statement