Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Publicly expose the value of the horizontal line so it can be read by an indicator

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

    Publicly expose the value of the horizontal line so it can be read by an indicator

    Hi,

    I am referring to this indicator created by Chris L:
    This indicator will read the horizontal lines that you have applied to a chart and display the price at which that line sits.


    Is it possible to publicly expose the value of the horizontal line so it can be read by an indicator of another chart?

    I am manually drawing a horizontal line on ES. I am trying to use Ninjascript plot a horizontal line of the same level on MES, so it is synced. When the line of the ES is moved, the line on the MES moves accordingly.


    Appreciate your advice on how the above can be done.

    Thanks so much.
    Last edited by Rainmakersg; 02-16-2023, 10:04 AM.

    #2
    Hello, thanks for writing in. The only way you could span your drawing objects between different instruments is to save the price value to a .txt file and have the other indicator read the same file and draw the price level. There is an example of using a System Input/Output here:

    https://ninjatrader.com/support/help...system_io_file _propertie.htm

    I also found this example that should be helpful:
    I originally developed this indicator for NT7 and now have converted to NT8. It simply plots lines on chart at price lines specified in a text file. A few times NT7 would drop a line I added through Draw Tools, or I would accidentally delete a line. So, I created this indicator that plotted my […]


    Kind regards,

    -ChrisL



    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.​

    Comment


      #3
      Hi Chris,

      Thanks so much for your speedy reply, and thanks for your suggested method.

      My worry is that the read/write takes time and it is not as instantaneous if the processing is done in RAM.

      Can you advise any way to fix the following (if it can be fixed at all):

      Relevant code:

      .
      .
      .

      HorizontalLine HLine;
      private double SenderHL;
      .
      .
      .

      protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
      {

      foreach (Gui.NinjaScript.IChartObject thisObject in ChartPanel.ChartObjects)
      {
      if(thisObject is NinjaTrader.NinjaScript.DrawingTools.HorizontalLin e)
      {
      HLine = thisObject as NinjaTrader.NinjaScript.DrawingTools.HorizontalLin e;

      SenderHL = HLine.StartAnchor.Price;

      }
      }

      }
      .
      .
      .​

      public double PublicSenderHL

      {
      get
      {
      Update();
      return SenderHL;
      }
      }​

      Comment


        #4
        Hi, If you want to do it from in-memory, I have an example on setting up a property changed event that other indicators can subscribe to:

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        572 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        331 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        549 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        550 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X