NexusFi: Find Your Edge


Home Menu

 





Reading values from Excel to Ninja


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one spinnybobo with 3 posts (1 thanks)
    2. looks_two redratsal with 1 posts (2 thanks)
    3. looks_3 tinkug112 with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
      Best Posters
    1. looks_one bukkan with 3 thanks per post
    2. looks_two Jigsaw Trading with 2 thanks per post
    3. looks_3 redratsal with 2 thanks per post
    4. looks_4 spinnybobo with 0.3 thanks per post
    1. trending_up 8,249 views
    2. thumb_up 9 thanks given
    3. group 9 followers
    1. forum 8 posts
    2. attach_file 0 attachments




 
Search this Thread

Reading values from Excel to Ninja

  #1 (permalink)
 
spinnybobo's Avatar
 spinnybobo 
Crete, IL/USA
 
Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61

Hello

I was wondering if anybody could help with some code to do the following:

I have some values I store in excel like VAH, POC, and VAL for market profile as well as others.
I would like to be able to create an indicator in NinjaTrader that when applied to a chart I can call all of the values from the excel spreadsheet and plot as horizontal lines.

The next step for this code would be to have an option to only call the last _____ number of values. I might want to plot only the last 6 values or the last 60 values. If I have a chart that is full of 1000 values, this would be the only reason to not call all of them--otherwise I would have to create multiple database of excel spreadsheets.

any ideas for coding would be much appreciated. I have some c++, and java experience and went through a few tutorials from Scott and Big Mike which were very helpful. This code would be most helpful as a lot of the work is putting lines on the chart.

thanks
Spencer

Follow me on Twitter Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Cheap historycal L1 data for stocks
Stocks and ETFs
What broker to use for trading palladium futures
Commodities
Trade idea based off three indicators.
Traders Hideout
 
  #3 (permalink)
 
Jigsaw Trading's Avatar
 Jigsaw Trading  Jigsaw Trading is an official Site Sponsor
 
Posts: 2,988 since Nov 2010
Thanks Given: 831
Thanks Received: 10,393


You can do it with Interop for Excel


Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 bukkan 
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks Given: 161
Thanks Received: 271

i made a ninja to client (like excel) dde connector. the reverse is also possible. i did a basic framework for fellow member PrTester. you can contact him for an upgraded version, if he has any. the basic code which i did was is presented below.

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

using NDde.Client;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    [Description("Enter the description of your new custom indicator here")]
    public class DDEClient : Indicator
    {
        #region Variables
        
        DdeClient client = null;
        
        #endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
            
            Overlay                = true;
        }
        
        protected override void OnStartUp()
        {
            client = new DdeClient("Excel","Sheet1");
            if (!client.IsConnected)
            {
                client.Connect();
            }
            
            string command = "R1C1:R2C2";
            client.StartAdvise(command,1,true,60000);
            client.Advise += client_Advise;
            
        }

        
        private void client_Advise(object sender,DdeAdviseEventArgs e)
        {
            System.Windows.Forms.MessageBox.Show("Hi PrTester");
            
        }
        
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            
        }
        
        protected override void OnTermination()
        {
            if (client != null)
            {
                client.Advise -= client_Advise;
                if (client.IsConnected)
                {
                    client.Disconnect();
                }
                client.Dispose();
            }
        }

        #region Properties
       

       
        #endregion
    }
}
the code will connect excel and nt. write anything in cell A1 or A2, B2 a msg box will pop up.

you need the necessary dll, search the download section for NinjaDDE.

Reply With Quote
Thanked by:
  #5 (permalink)
 
redratsal's Avatar
 redratsal 
Milan (I)
 
Experience: Advanced
Platform: Ninjatrader
Broker: Kinetick
Trading: FDAX,6E,CL,YM,NQ,ES
Posts: 1,648 since Oct 2010
Thanks Given: 1,215
Thanks Received: 2,090


spinnybobo View Post
Hello

I was wondering if anybody could help with some code to do the following:

I have some values I store in excel like VAH, POC, and VAL for market profile as well as others.
I would like to be able to create an indicator in NinjaTrader that when applied to a chart I can call all of the values from the excel spreadsheet and plot as horizontal lines.

The next step for this code would be to have an option to only call the last _____ number of values. I might want to plot only the last 6 values or the last 60 values. If I have a chart that is full of 1000 values, this would be the only reason to not call all of them--otherwise I would have to create multiple database of excel spreadsheets.

any ideas for coding would be much appreciated. I have some c++, and java experience and went through a few tutorials from Scott and Big Mike which were very helpful. This code would be most helpful as a lot of the work is putting lines on the chart.

thanks
Spencer

Hi,

I did something similar ,

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #6 (permalink)
 
spinnybobo's Avatar
 spinnybobo 
Crete, IL/USA
 
Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61

thanks redratsal, bukkan, and DionysusToast for contributing. I will definitely take a look at those links and the code. I think this will help get me started:-)

Follow me on Twitter Started this thread Reply With Quote
  #7 (permalink)
 
tinkug112's Avatar
 tinkug112 
Vizag+india
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Nifty
Posts: 90 since May 2012
Thanks Given: 110
Thanks Received: 89

Hi spinny,
Wondering if you got this figured out? Can you share it ?
I am looking at connecting feed from Excel to NT.

Reply With Quote
  #8 (permalink)
 
spinnybobo's Avatar
 spinnybobo 
Crete, IL/USA
 
Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61


tinkug112 View Post
Hi spinny,
Wondering if you got this figured out? Can you share it ?
I am looking at connecting feed from Excel to NT.

I never got things working, but it looks like this method by dionysus a good way


Follow me on Twitter Started this thread Reply With Quote
Thanked by:
  #9 (permalink)
 supergordon 
Los Angeles, CA
 
Experience: Beginner
Platform: Multicharts
Broker: Optimus Futures
Trading: CL
Posts: 7 since Mar 2014
Thanks Given: 31
Thanks Received: 7

There's a pay-for product out there called XLSgate. They offer a free-trial version and then a lite version if you don't want to purchase that has much of the same write functionality but without the read functionality. I needed to get data back and forth to Excel throughout the trading day and XLSgate worked. Just an FYI - I don't work for these guys or have any stake in their activities.

I tried this solution but am not a good programmer - still working on it - so the pay-for solution helped me out.

Reply With Quote
Thanked by:




Last Updated on September 13, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts