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

Could someone fix this code. Thanks

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

    Could someone fix this code. Thanks

    I have 2 time series.

    The error is "no overload for method "T3" Is it just syntax or the way I tried to enter the Second Data Series.

    Much Appreciated, Greg O.




    protected override void Initialize()
    {
    Add(FractalLevel(1));
    Add(T3(High, 26, 3, 0.7));
    Add(FractalLevel(1));
    Add(T3(Low, 26, 3, 0.7));
    SetTrailStop("", CalculationMode.Ticks, 8, false);
    Add((PeriodType)23,10);

    CalculateOnBarClose = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    if(CurrentBars[0]<1||CurrentBars[1]<1) return;

    if(BarsInProgress==0)

    // Condition set 1
    if (ToTime(Time[0]) >= ToTime(9, 30, 0)
    && ToTime(Time[0]) <= ToTime(15, 30, 0)
    && CrossAbove(Close, FractalLevel(1).Plot0, 1)
    && Closes[1] > (T3(Closes[1],High, 26, 3, 0.7)))
    {
    EnterLong(DefaultQuantity, "");
    }

    // Condition set 2
    if (ToTime(Time[0]) >= ToTime(9, 30, 0)
    && ToTime(Time[0]) <= ToTime(15, 30, 0)
    && CrossBelow(Close, FractalLevel(1).Plot1, 1)
    && Closes[1] < (T3(Closes[1],Low, 26, 3, 0.7)))
    {
    EnterShort(DefaultQuantity, "");

    #2
    Hello greg500,

    Thanks for the note.

    You can only supply one data series to the parameter list of T3.

    When you call T3 with a data series supplied, you can access the array like this:

    Code:
    T3(IDataSeries input, int period, int tCount, double vFactor)[int barsAgo]
    For instance, accessing the Low T3 1 bar ago would look like this:

    Code:
    T3(Low, 26, 3, 0.7)[1];
    If you let me know what this line is supposed to accomplish I will advise an alternate approach:
    Code:
    (T3(Closes[1],High, 26, 3, 0.7))
    I look forward to assisting further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thank you so much ChrisL

      I'm not much of a ninjascript coder

      Greg

      Comment


        #4
        // Condition set 1
        if (ToTime(Time[0]) >= ToTime(9, 30, 0)
        && ToTime(Time[0]) <= ToTime(15, 30, 0)
        && CrossAbove(Close, FractalLevel(1).Plot0, 1)
        && Closes[1] > (T3(Closes[1],High, 26, 3, 0.7)))
        {
        EnterLong(DefaultQuantity, "");
        }

        // Condition set 2
        if (ToTime(Time[0]) >= ToTime(9, 30, 0)
        && ToTime(Time[0]) <= ToTime(15, 30, 0)
        && CrossBelow(Close, FractalLevel(1).Plot1, 1)
        && Closes[1] < (T3(Closes[1],High, 26, 3, 0.7)))
        {
        EnterShort(DefaultQuantity, "");


        error < > cannot be applied to double bool series sorry!

        Comment


          #5
          I'm actually trying to get the T3 code to Use the Second Data Series?

          Add((PeriodType)23,10);

          I thought Closes[1] meant Use the second data series???

          Yikes

          Comment


            #6
            Hello greg500,

            Thanks for the reply.

            To access the second data series, you would use the Lows[][] or Highs[][] series:

            ... && Closes[1][0] > (T3(Highs[1], 26, 3, 0.7)[0])

            or

            ... && Closes[1][0] < (T3(Lows[1], 26, 3, 0.7)[0])

            The plural series array takes this form:

            Primary series: Lows[0][value0,value1,value2,...]
            Second series: Lows[1][value0,value1,value2,...]

            And so on.The first index can be thought as of the series selector.

            Here is the help guide link to the plural Lows and Highs arrays available in NinjaTrader:



            Please let us know if you have any questions.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              okay,,

              What a Novice,, I need more code practice!!!

              Thank You Chris... That fixed the error and the code works for the second data series...

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by cmtjoancolmenero, Yesterday, 03:58 PM
              11 responses
              39 views
              0 likes
              Last Post cmtjoancolmenero  
              Started by FrazMann, Today, 11:21 AM
              0 responses
              3 views
              0 likes
              Last Post FrazMann  
              Started by geddyisodin, Yesterday, 05:20 AM
              8 responses
              52 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by DayTradingDEMON, Today, 09:28 AM
              4 responses
              26 views
              0 likes
              Last Post DayTradingDEMON  
              Started by George21, Today, 10:07 AM
              1 response
              22 views
              0 likes
              Last Post NinjaTrader_ChristopherJ  
              Working...
              X