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 Barry Milan, Today, 10:35 PM
    0 responses
    2 views
    0 likes
    Last Post Barry Milan  
    Started by DJ888, Yesterday, 06:09 PM
    2 responses
    9 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    40 views
    0 likes
    Last Post jeronymite  
    Started by bill2023, Today, 08:51 AM
    2 responses
    16 views
    0 likes
    Last Post bill2023  
    Started by sidlercom80, 10-28-2023, 08:49 AM
    167 responses
    2,260 views
    0 likes
    Last Post jeronymite  
    Working...
    X