Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple Math

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Simple Math

    Hello all - I'm struggling with simple math formulas in building my strategy. What I am attempting to do is build a stop and a trailing stop using the Average True Range (ATR) as an indicator.

    Here is what I want to say with my stop, if the unrealized P&L has fallen 5 ATRs (20 period ATR). Close trade

    On the trailing stop, every time the P&L moves 5 ATRs in profit place enter a trailing stop 2 ATRs from the high of that day.

    What I am stuck on is how to properly say 5 * ATR (20), code written this way doesn't produce any results.

    Any thoughts? thank you

    #2
    Originally posted by titleistbb22 View Post
    Hello all - I'm struggling with simple math formulas in building my strategy. What I am attempting to do is build a stop and a trailing stop using the Average True Range (ATR) as an indicator.

    Here is what I want to say with my stop, if the unrealized P&L has fallen 5 ATRs (20 period ATR). Close trade

    On the trailing stop, every time the P&L moves 5 ATRs in profit place enter a trailing stop 2 ATRs from the high of that day.

    What I am stuck on is how to properly say 5 * ATR (20), code written this way doesn't produce any results.

    Any thoughts? thank you
    Proper way would be:

    5 * ATR(20)[0]

    Comment


      #3
      Thanks for the response - Im aware of the need to add [0] representing the bars back. I need to play around with this a bit more and re-phrase my question. thx

      Comment


        #4
        Please post the code you use if possible so we can take a look, a basic sample how to move stop and target prices can be found here - http://www.ninjatrader-support2.com/...ead.php?t=3222
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cocoescala, 10-12-2018, 11:02 PM
        6 responses
        939 views
        0 likes
        Last Post Jquiroz1975  
        Started by gbourque, Today, 06:39 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by benmarkal, Yesterday, 12:52 PM
        3 responses
        23 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by helpwanted, Today, 03:06 AM
        1 response
        20 views
        0 likes
        Last Post sarafuenonly123  
        Working...
        X