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

Compilation error help

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

    Compilation error help

    I just installed the latest version and custom indicators aren't working. I have very minimal programming experience and none with ninja script so I hope someone can help. I tried to compile one of the indicators that is no longer working and came up with a bunch of errors, all similar in description. CS0101 and CS0102 are the codes I get. The first error code says " the namespace "NinjaTrader.indicator" already contains a definition for "a1MarketInternals" ". The next error has to do with the "TickStyle" part of the script and gives the CS0102 code and says "The type "NinjaTrader.indicator.a1MarketInternals" already contains a definition for "TickStyle". This is how the problem area for the errors appears and I applied BOLD to the lines of script that I believe are wrong.

    #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 System.IO;
    using System.Globalization;
    using System.Collections.Generic;

    using System.Text.RegularExpressions;
    using System.Windows.Forms;

    #endregion

    namespace NinjaTrader.Indicator
    {
    [Description("NYSE TICK and Advance/Decline Line Market Internals")]
    public class a1MarketInternals : Indicator
    {
    #region Variables

    string tkSymbol = "^TICK";
    string adSymbol = "^ADD";
    int tkMinutes = 1;
    int nyseTickHigh = 800;
    int nyseTickLow = -800;

    bool showADplot = true;
    bool showTickPlot = true;
    Color adColor = Color.Yellow;

    TimeSpan newYorkOpen = new TimeSpan(09, 30, 00);
    TimeSpan newYorkClose= new TimeSpan(16, 00, 00);
    TimeZoneInfo est = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");


    public enum TickStyle {
    CandleStick,
    HollowCandles,
    HiLoClose,
    };
    private TickStyle tickStyle = TickStyle.CandleStick;

    int scaleMaxPixels = 0;
    int verticalOffset = 0;
    double tickOpen=0, tickHigh=0, tickLow=0, tickClose=0;
    double adClose=0;
    int tickBar=0, lastTickBar=0, lastTkPriceBar=0;
    int tickHighBreachBar=0, tickLowBreachBar=0;
    int adXpix0=0, adYpix0=0, adXpix1=0, adYpix1=0;
    string tkStat= "???";

    double d=0;
    int x=0, y=0;

    Font textFont = new Font("Impact", 10, System.Drawing.FontStyle.Regular);
    StringFormat FormatLeft = new StringFormat();

    private bool ShowOutline = true;
    private bool EnhanceHL = true;


    private bool ReinitSession = false;
    private bool ForceHiLo = true;

    private int ForcedHiLoBS = 2;

    private int totalvolume = 0, hi, lo;

    private DataSeries dsHigh, dsLow, dsClose;
    private DataSeries adPlot;

    private int startbar = -1;
    private int lastBar = -1;

    private bool useplot = true;
    Pen drawPen = new Pen(Color.Transparent);
    Pen adPen = new Pen(Color.Transparent, 4);
    Pen linePen = new Pen(Color.Black, 5);
    SolidBrush drawBrush = new SolidBrush(Color.Transparent);

    int hiTkBar=0, loTkBar=0;

    #endregion


    protected override void Initialize() {
    Overlay = false;
    PriceTypeSupported = false;
    CalculateOnBarClose = false;
    DrawOnPricePanel = true;

    Add("^TICK",PeriodType.Minute, 1);
    Add("^ADD", PeriodType.Minute, 1);
    }

    protected override void OnStartUp() {
    dsHigh = new DataSeries(this, MaximumBarsLookBack.Infinite);
    dsLow = new DataSeries(this, MaximumBarsLookBack.Infinite);
    dsClose = new DataSeries(this, MaximumBarsLookBack.Infinite);

    adPen.Color = adColor;
    adPlot = new DataSeries(this, MaximumBarsLookBack.Infinite);
    }

    Thanks in advance for any help--

    #2
    Biaxident,

    Thank you for your post.

    Typically, this error means that there is another file or duplicate file that has the same class namespace and/or enum that is being defined.

    Can you check your PC -> (My) Documents -> NinjaTrader 7 -> bin -> Custom
    Look around the Strategy and Indicator folders for any other scripts that could be interferring with it.
    Cal H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by yubo27, Today, 11:16 PM
    0 responses
    10 views
    0 likes
    Last Post yubo27
    by yubo27
     
    Started by oz187, 02-12-2021, 06:04 AM
    2 responses
    117 views
    0 likes
    Last Post yubo27
    by yubo27
     
    Started by Skifree, Yesterday, 01:33 PM
    6 responses
    53 views
    0 likes
    Last Post Skifree
    by Skifree
     
    Started by MJ123, Today, 04:06 PM
    2 responses
    15 views
    0 likes
    Last Post MJ123
    by MJ123
     
    Started by dgutz15, 12-12-2022, 11:50 PM
    4 responses
    68 views
    0 likes
    Last Post drsclaud23  
    Working...
    X