Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Compile Error Problem

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

    Compile Error Problem

    Hello;

    I am trying to write this code to export data to the output file.

    Here is the 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.Indicator;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Strategy;
    #endregion

    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
    /// <summary>
    /// Enter the description of your strategy here
    /// </summary>
    [Description("Enter the description of your strategy here")]
    public class Printer : Strategy
    {
    #region Variables
    // Wizard generated variables
    private int myInput0 = 1; // Default setting for MyInput0
    // User defined variables (add any user defined variables below)
    #endregion

    /// <summary>
    /// This method is used to configure the strategy and is called once before any strategy method is called.
    /// </summary>
    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    }

    protected override void OnStartUp()
    {
    //Print your header
    Print("Time,Date,Open,High,Low,Close");
    }
    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Print your data for each bar
    Print(Time[0]+","+Open[0]+","+High[0]+",Low[0]+","+Close[0]+");
    }

    #region Properties
    [Description("")]
    [GridCategory("Parameters")]
    public int MyInput0
    {
    get { return myInput0; }
    set { myInput0 = Math.Max(1, value); }
    }
    #endregion
    }
    }

    I keep getting the following error message when I try to compile.

    Error - Invalid expression term ")" code cs1525 line 38 column 42
    Error - No overload for method 'Print' takes '2' code cs1501 line 49 column 4

    Could any one please help?

    thank you in advance

    aafwintb

    #2
    Hello aafwintb,

    Looks like some formatting errors with your quotation marks.

    Consider changing this line:
    Code:
    Print(Time[0]+","+Open[0]+","+High[0]+",Low[0]+","+Close[0]+");
    To this:
    Code:
    Print(Time[0] + "," + Open[0] + "," + High[0] + "," + Low[0] + "," + Close[0]);
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan that worked.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      574 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      333 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
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X