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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        66 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        36 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        59 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        52 views
        0 likes
        Last Post CarlTrading  
        Working...
        X