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

Error in Triple T3

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

    Error in Triple T3

    Hello,

    I am trying to figure out to fix this this but I am at loss. I am not sure what does that error message "The best overloaded method match for 'NinjaTrader.Indicator.IndicatorBase.Add(NinjaTrad er.Gui.Chart.Line)' has some invalid arguments" mean. I tried in Indicator edit and got the same error.

    Can you point out where I did wrong? Will appreciate your help!

    Thanks,
    -traderjh

    #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
    namespace NinjaTrader.Strategy
    {
    /// <summary>
    /// Triple T3
    /// </summary>
    [Description("TripleT3")]
    public class TripleT3 : Strategy
    {
    #region Variables
    private int period1 = 2;
    private int tcount1 = 2;
    private double vfactor1 = 0.6;
    private int period2 = 4;
    private int tcount2 = 4;
    private double vfactor2 = 0.7;
    private int period3 = 5;
    private int tcount3 = 5;
    private double vfactor3 = 0.8;

    private DataSeries fastPrice;
    private DataSeries medPrice;
    private DataSeries slowPrice;
    private int digitSize;
    private double pipSize;
    #endregion
    //**********
    //********** Initialization Routine
    protected override void Initialize()
    {
    Enabled = true;
    CalculateOnBarClose = false;
    ExitOnClose = false;
    T3(period1, tcount1, vfactor1).Plots[0].Pen.Color = Color.Yellow;
    T3(period2, tcount2, vfactor2).Plots[0].Pen.Color = Color.Green;
    T3(period3, tcount3, vfactor3).Plots[0].Pen.Color = Color.Red;
    Add(T3(period1, tcount1, vfactor1));
    Add(T3(period2, tcount2, vfactor2));
    Add(T3(period3, tcount3, vfactor3));
    fastPrice = new DataSeries(this);
    medPrice = new DataSeries(this);
    slowPrice = new DataSeries(this);
    if (Instrument.MasterInstrument.PointValue == 1000) // JPY pairs
    {
    digitSize = 3;
    }
    else
    {
    digitSize = 5;
    }
    pipSize = Instrument.MasterInstrument.PointValue;
    }
    //**********
    //********** Main Routine
    protected override void OnBarUpdate()
    {
    fastPrice.Set(Math.Round(T3(period1, tcount1, vfactor1)[0],digitSize));
    medPrice.Set(Math.Round(T3(period2, tcount2, vfactor2)[0],digitSize));
    medPrice.Set(Math.Round(T3(period3, tcount3, vfactor3)[0],digitSize));
    DrawTextFixed("T3", "Fast:" + fastPrice + "Medium:" + medPrice + "Slow:" + slowPrice,TextPosition.TopLeft,Color.Yellow,new Font("Arial", 12),Color.Black,Color.Black,10);
    }
    //**********
    //********** User Input Parameters
    #region Properties
    #endregion
    } // End of public class
    } // End of namespace

    #2
    Hello traderjh,

    That is because you are trying to compile it as an Indicator when it is trying to inheritate from the "Strategy" Class.

    Code:
    namespace NinjaTrader.[COLOR="red"]Strategy[/COLOR]
    {
    /// <summary>
    /// Triple T3
    /// </summary>
    [Description("TripleT3")]
    public class TripleT3 : [COLOR="Red"]Strategy[/COLOR]
    {
    Move the file into the Strategy folder and remove the "NinjaScript generated code. Neither change nor remove." and recompile.
    JCNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by jxs_xrj, 01-12-2020, 09:49 AM
    6 responses
    3,290 views
    1 like
    Last Post jgualdronc  
    Started by Touch-Ups, Today, 10:36 AM
    0 responses
    9 views
    0 likes
    Last Post Touch-Ups  
    Started by geddyisodin, 04-25-2024, 05:20 AM
    11 responses
    62 views
    0 likes
    Last Post halgo_boulder  
    Started by Option Whisperer, Today, 09:55 AM
    0 responses
    8 views
    0 likes
    Last Post Option Whisperer  
    Started by halgo_boulder, 04-20-2024, 08:44 AM
    2 responses
    25 views
    0 likes
    Last Post halgo_boulder  
    Working...
    X