Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi Time Frame - SampleDataSeries

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

    Multi Time Frame - SampleDataSeries

    Hello - I am working on modifiying the SampleDataSeriew example. I have writen the below code

    // Condition set 1
    if (BarsInProgress == 0)
    {
    // Set DataSeries object to store the trading range of the primary bar
    primarySeries.Set(Stochastics(7, 12, 3).K);
    }

    // Executed on secondary bar updates only
    if (BarsInProgress == 1)
    {
    // Set the DataSeries object to store the trading range of the secondary bar
    secondarySeries.Set(Close[0] - Close[24]);
    }

    // When conditions in both primary and secondary enter long
    if (CrossAbove(primarySeries[0],20,1) && secondarySeries[0] > 0)
    EnterLong();

    Ninja is indicating errors with the primarySeries.Set which are

    The best overloaded method match for 'NinjaTrader.Data.DataSeries.Set(double)' has some invalid arguments

    and

    Argument '1': cannot convert from 'NinjaTrader.Data.DataSeries' to 'double'


    Ninja also does not like the final condition. Indicating the following errors

    The best overloaded method match for 'NinjaTrader.Strategy.StrategyBase.CrossAbove(doub le, NinjaTrader.Data.DataSeries.int)'

    Argument '2': cannot convert from 'int' to NinjaTrader.Data.DataSeries'

    Any help on this would be appreciated. thank you

    #2
    Hello titleistbb22,

    You will need to use a double value for primary series.

    primarySeries.Set(Stochastics(7, 12, 3).K[0]);

    Your crossing statement needs a DataSeries as first input, and this can be your primarySeries.

    if (CrossAbove(primarySeries, secondarySeries[0], lookbackPeriod))

    > 0 doesn't work in the CrossAbove statement.

    See below for help constructing CrossAbove statements or check out SampleMaCrossOver strategy.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you I will work on that - your second statement that my cross doesn't have the correct components isn't correct. Its two statements to enter long, >0 has nothing to do with the Cross Over.

      Using a double will hopefully clear this up

      Thank you
      Last edited by titleistbb22; 09-17-2010, 11:14 AM.

      Comment


        #4
        I have the same problem. I unsuccessfully looked for any suggestion. My code is

        if (CrossAbove(TEMA(20)[0], MAMA(High,0.5,0.05).Fama[0], 5))

        NT7 throws errors:

        The best overloaded method match for 'NinjaTrader.Strategy.StrategyBase.CrossAbove(doub le, NinjaTrader.Data.DataSeries.int)'

        Argument '2': cannot convert from 'double' to NinjaTrader.Data.DataSeries'

        Any help would be appreciated. Thanks!

        Comment


          #5
          Interesting to see someone working on the same problem I had. My advise, if Ninja has not fixed the fundamental problem of dynamic position sizing, look for different trading platforms to use.

          I greatly appreciate the free product and service ninja provided, but without this feature you have to look else where.

          Best of luck

          Comment


            #6
            Try this:

            Code:
                 if (CrossAbove(TEMA(20)[0], MAMA(High,0.5,0.05).Fama, 5))
            Originally posted by achoicys View Post
            I have the same problem. I unsuccessfully looked for any suggestion. My code is

            if (CrossAbove(TEMA(20)[0], MAMA(High,0.5,0.05).Fama[0], 5))

            NT7 throws errors:

            The best overloaded method match for 'NinjaTrader.Strategy.StrategyBase.CrossAbove(doub le, NinjaTrader.Data.DataSeries.int)'

            Argument '2': cannot convert from 'double' to NinjaTrader.Data.DataSeries'

            Any help would be appreciated. Thanks!

            Comment


              #7
              Your's should work too?

              CrossAbove()



              Definition
              Checks for a cross above condition over the specified bar look back period.

              Method Return Value
              This method returns true if a cross above condition occured; otherwise, false.

              Syntax
              CrossAbove(IDataSeries series1, double value, int lookBackPeriod)
              CrossAbove(IDataSeries series1, IDataSeries series2, int lookBackPeriod)


              Originally posted by sledge View Post
              Try this:

              Code:
                   if (CrossAbove(TEMA(20)[0], MAMA(High,0.5,0.05).Fama, 5))

              Comment


                #8
                It looks like the documentation no longer matches what NT 7 is doing.

                This fails too.

                Code:
                     if (CrossAbove(TEMA(20)[0], 27.2, 5))
                Originally posted by sledge View Post
                Your's should work too?

                CrossAbove()



                Definition
                Checks for a cross above condition over the specified bar look back period.

                Method Return Value
                This method returns true if a cross above condition occured; otherwise, false.

                Syntax
                CrossAbove(IDataSeries series1, double value, int lookBackPeriod)
                CrossAbove(IDataSeries series1, IDataSeries series2, int lookBackPeriod)

                Comment


                  #9
                  ok, I'm starting to wake up.

                  27.2 is probably defaulting to a float.
                  using (double) 27.2 type casts it and it compiles.


                  Originally posted by sledge View Post
                  It looks like the documentation no longer matches what NT 7 is doing.

                  This fails too.

                  Code:
                       if (CrossAbove(TEMA(20)[0], 27.2, 5))

                  Comment


                    #10
                    Even though the documentation says that MAMA.....Fama[0] returns a double, it appears it doesn't.

                    Use:

                    Code:
                    if (CrossAbove(High, (double)MAMA(High,0.5,0.05).Fama[0], 1)) 
                    {
                    Originally posted by achoicys View Post
                    I have the same problem. I unsuccessfully looked for any suggestion. My code is

                    if (CrossAbove(TEMA(20)[0], MAMA(High,0.5,0.05).Fama[0], 5))

                    NT7 throws errors:

                    The best overloaded method match for 'NinjaTrader.Strategy.StrategyBase.CrossAbove(doub le, NinjaTrader.Data.DataSeries.int)'

                    Argument '2': cannot convert from 'double' to NinjaTrader.Data.DataSeries'

                    Any help would be appreciated. Thanks!

                    Comment


                      #11
                      Originally posted by titleistbb22 View Post
                      Thank you I will work on that - your second statement that my cross doesn't have the correct components isn't correct. Its two statements to enter long, >0 has nothing to do with the Cross Over.

                      Using a double will hopefully clear this up

                      Thank you


                      Have you tried:


                      Code:
                      // When conditions in both primary and secondary enter long
                      if (CrossAbove(primarySeries,(double)20,1) && secondarySeries[0] > 0)
                      
                      EnterLong();

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      649 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      370 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      109 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      574 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      576 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X