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 helpwanted, Today, 03:06 AM
        1 response
        7 views
        0 likes
        Last Post sarafuenonly123  
        Started by Brevo, Today, 01:45 AM
        0 responses
        7 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        385 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X