Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Looking for indicator to show profit target at given # ticks beyond the previous bar

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

    Looking for indicator to show profit target at given # ticks beyond the previous bar

    Pretty much what the title says. I'm looking for an indicator where I can set my profit target at, say, 4 ticks, and the indicator will put a little line on the chart showing where that is (above & below) the previous bar like in the attached pic. I searched the NT indicator page but didn't find anything. Anyone know of an indicator that would do this?
    Attached Files

    #2
    Hello EnveousColnago,

    I am not aware of an item like that myself but that would be fairly simple to create using the Ray drawing object.

    You can generate a new empty indicator and place the following inside it to draw with an offset:

    Code:
    protected override void OnBarUpdate()
    {
        if(CurrentBar < 1) return;
       double highPrice = High[1] + (4 * TickSize);
       double lowPrice= Low[1] - (4 * TickSize);
    
       Draw.Ray(this, "HighRay", 1, highPrice, 0, highPrice, Brushes.LimeGreen);
       Draw.Ray(this, "LowRay", 1, lowPrice, 0, lowPrice, Brushes.Red);
    }
    Last edited by NinjaTrader_Jesse; 08-01-2022, 07:49 AM.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello EnveousColnago,

      I am not aware of an item like that myself but that would be fairly simple to create using the Ray drawing object.

      You can generate a new empty indicator and place the following inside it to draw with an offset:

      Code:
      if(CurrentBar < 1) return;
      double highPrice = High[1] + (4 * TickSize);
      double lowPrice= Low[1] - (4 * TickSize);
      
      Draw.Ray(this, "HighRay", 1, highPrice, 0, highPrice, Brushes.LimeGreen);
      Draw.Ray(this, "LowRay", 1, lowPrice, 0, lowPrice, Brushes.Red);
      Thank you! How do I go about converting this code to an indicator? I'm on NT8 btw. I tried New > Ninjascript Editor > right click indicators > New Indicator, then pasting the above code, but it's giving me a bunch of errors. Also tried pasting code into notepad file, changing extension to .cs, zipping in a folder, and importing, but in that case it said it was incompatible with my version of NT

      Comment


        #4
        Originally posted by EnveousColnago View Post

        Thank you! How do I go about converting this code to an indicator? I'm on NT8 btw. I tried New > Ninjascript Editor > right click indicators > New Indicator, then pasting the above code, but it's giving me a bunch of errors. Also tried pasting code into notepad file, changing extension to .cs, zipping in a folder, and importing, but in that case it said it was incompatible with my version of NT
        Those targets and stops are reserved for strategies in NT8.

        Comment


          #5
          Hello EnveousColnago,

          Those are the correct steps to create an indicator, it sounds like you pasted it in the wrong location. This code would go inside the curly braces below OnBarUpdate: I updated the previous post to show OnBarUpdate

          JesseNinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_Jesse View Post
            Hello EnveousColnago,

            Those are the correct steps to create an indicator, it sounds like you pasted it in the wrong location. This code would go inside the curly braces below OnBarUpdate: I updated the previous post to show OnBarUpdate
            Thank you!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by JoMoon2024, Today, 06:56 AM
            0 responses
            6 views
            0 likes
            Last Post JoMoon2024  
            Started by Haiasi, 04-25-2024, 06:53 PM
            2 responses
            17 views
            0 likes
            Last Post Massinisa  
            Started by Creamers, Today, 05:32 AM
            0 responses
            6 views
            0 likes
            Last Post Creamers  
            Started by Segwin, 05-07-2018, 02:15 PM
            12 responses
            1,786 views
            0 likes
            Last Post Leafcutter  
            Started by poplagelu, Today, 05:00 AM
            0 responses
            3 views
            0 likes
            Last Post poplagelu  
            Working...
            X