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 elirion, Today, 01:36 AM
        0 responses
        3 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by gentlebenthebear, Today, 01:30 AM
        0 responses
        4 views
        0 likes
        Last Post gentlebenthebear  
        Started by samish18, Yesterday, 08:31 AM
        2 responses
        9 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by Mestor, 03-10-2023, 01:50 AM
        16 responses
        391 views
        0 likes
        Last Post z.franck  
        Started by rtwave, 04-12-2024, 09:30 AM
        4 responses
        34 views
        0 likes
        Last Post rtwave
        by rtwave
         
        Working...
        X