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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        23 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        120 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        63 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        41 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        45 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X