Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Export horizontal Line Value to excel or text file

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

    Export horizontal Line Value to excel or text file

    Hi,

    I want to Export Horizontal line value to excel or text file.

    once i draw the Horizontal line on the chart the value of the line to go to the excel or text file.

    i tried a lot with "SimpleExcelWriter" but no luck

    please Help me

    Thank you,

    #2
    Hello,

    Thank you for the question.

    I can provide a sample for writing to a text file, for excel I do not have an example that demonstrates this.

    For the text file, please see this document: http://www.ninjatrader.com/support/f...ead.php?t=3475

    Some users have had success using the Excel interop dll's with NinjaTrader to write directly to an excel file but I am uncertain on how exactly to correctly set these up. If you would like to use this, I would suggests reading the other users posts on this forum.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      i already downloaded that indicator. but my requirement is Export Horizontal line value to excel or text file. just line value. how to find line value and send to excel or txt?

      Comment


        #4
        Hello,

        You can either assign the object to a variable when you create it, the next line you could then use the variable to get its values.

        Another way would be to loop through the collection of DrawObjects which there is a post about here: http://ninjatrader.com/support/forum...1&postcount=10

        Regarding the variable way, that would likely be the most simple, here is an example:

        Code:
        ILine tempLine = DrawLine("MyLine", 10, Close[10], 0, Close[0], Color.Blue);
        Print(tempLine.EndY);
        Each of the Drawing Objects can be a variable by appending an I to the beginning of the object name, or IHorizontalLine, IDot etc..

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          belkheyat center of gravity indicator

          does any one please have belkhyat center of gravity indicator

          Comment


            #6
            yasser,

            Please post this as a new question as a new thread. This is not related to the original question in this thread and will likely not be answered because you can only see the thread title from the forum.

            This would likely be a good starting place: http://ninjatrader.com/support/forum...splay.php?f=40
            JesseNinjaTrader Customer Service

            Comment


              #7
              Hello,

              Thank you so much for your Help

              I am not a programmer. will you please help me . please show me where can i assign variable and how to send that to excel. i attached "SimpleExcelWriter.cs" code...

              #region Using declarations
              using System;
              using System.Diagnostics;
              using System.Drawing;
              using System.Drawing.Drawing2D;
              using System.ComponentModel;
              using System.Xml.Serialization;
              using NinjaTrader.Cbi;
              using NinjaTrader.Data;
              using NinjaTrader.Gui.Chart;
              using CarlosAg.ExcelXmlWriter;
              #endregion

              namespace NinjaTrader.Indicator
              {
              [Description("")]
              [Gui.Design.DisplayName("SimpleExcelWriter")]
              public class SimpleExcelWriter : Indicator
              {
              #region Variables
              private int date = 0;
              private double currentOpen = 0;
              private double currentHigh = 0;
              private double currentLow = 0;
              private double currentClose = 0;
              private bool currentOpenSaved = false;
              private bool currentLowSaved = false;
              private Workbook book = new Workbook();
              private Worksheet sheet;
              private WorksheetRow row;
              private string path = Cbi.Core.UserDataDir.ToString() + "test.xls";

              #endregion

              protected override void Initialize()
              {
              CalculateOnBarClose = true;
              }

              protected override void OnBarUpdate()

              {
              if(book != null)
              {
              if (CurrentBar == 0)
              {
              sheet = book.Worksheets.Add("Simple quote");
              row = sheet.Table.Rows.Add();
              row.Cells.Add("Time");
              row.Cells.Add("Open");
              row.Cells.Add("High");
              row.Cells.Add("Low");
              row.Cells.Add("Close");
              row.Cells.Add("Volume");
              }
              row = sheet.Table.Rows.Add();
              row.Cells.Add(new WorksheetCell(Time[0].ToString()));
              row.Cells.Add(new WorksheetCell(Open[0].ToString(), DataType.Number));
              row.Cells.Add(new WorksheetCell(High[0].ToString(), DataType.Number));
              row.Cells.Add(new WorksheetCell(Low[0].ToString(), DataType.Number));
              row.Cells.Add(new WorksheetCell(Close[0].ToString(), DataType.Number));
              row.Cells.Add(new WorksheetCell(Volume[0].ToString(), DataType.Number));
              book.Save(path);
              }
              }



              #region Properties

              #endregion
              }
              }

              #region NinjaScript generated code. Neither change nor remove.

              Comment


                #8
                Hello paruchuriphani,

                Writing to excel is not supported by NinjaTrader support to do.

                However, there are community members that have gotten writing to excel to work.

                As a tip, you will need to include excel interop dll files.

                Below are a few links to point you in the right direction.
                http://ninjatrader.com/support/forum...702#post311702

                http://ninjatrader.com/support/forum...702#post311702

                http://ninjatrader.com/support/forum...397#post212397


                This thread will remain open for any community members that would like to assist.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by judysamnt7, 03-13-2023, 09:11 AM
                4 responses
                57 views
                0 likes
                Last Post DynamicTest  
                Started by ScottWalsh, Today, 06:52 PM
                4 responses
                36 views
                0 likes
                Last Post ScottWalsh  
                Started by olisav57, Today, 07:39 PM
                0 responses
                7 views
                0 likes
                Last Post olisav57  
                Started by trilliantrader, Today, 03:01 PM
                2 responses
                19 views
                0 likes
                Last Post helpwanted  
                Started by cre8able, Today, 07:24 PM
                0 responses
                9 views
                0 likes
                Last Post cre8able  
                Working...
                X