Announcement

Collapse
No announcement yet.

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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    82 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    43 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    56 views
    0 likes
    Last Post CarlTrading  
    Working...
    X