Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Overriding error

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

    Overriding error

    Hello

    First of all, I would like to say that I am an absolute beginner in ninjascript coding...
    I am currently in the learning phase and I need a little help with a problem that I don't know how to solve...
    I get an error when compiling ninjascript, it is probably an error in the object overriding and I don't know how to solve the problem...

    I have defined a range using
    private Series<double> MySeries;

    next I create an object
    MySeries = new Series<double>(this);

    then I specify a condition on this object that will hold the difference
    close - open of the current candle

    MySeries[0] = Close[0] - Open[0];

    and I would like to create a something like this
    if (
    MySeries[0] >2 * StdDev( MySeries[0] )[0]
    )


    but every time I try to compile the script, I get an error related to overriding..
    Once again I apologize for the beginner's question and thank you very much for any help..
    I would like to understand at least the basic logic of how to create ninjascript and where I am making a mistake..

    #2
    Hi Lejczek, thanks for posting. The initialization of MySeries should be:
    MySeries = new Series<double>(this, MaximumBarsLookBack.Infinite);

    If this does not resolve, please post a screen shot of the code and the compile error and I will have a look at it.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Have a nice day Chris
      Thank you very much for your quick reply
      I tried to apply your fix, unfortunately I am getting the same overriding error CS502 CS503..
      In attachement I send my simple code..
      I would like to understand where the error is, so I can learn something and know how to solve similar problem
      Thank You again very much for your time and your help
      Attached Files

      Comment


        #4
        Hi Lejczek, the StdDev function had invalid arguments. It needs a Series and a Period. Something like this will work:
        StdDev(MySeries, 3)[0]

        Kind regards,
        -ChrisL
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Have a nice day ChrisL

          Thank you very much for your advice !
          The code compiles without problems and helped me to understand where the error is..
          I would like to ask one more thing..
          I would like to get the average range of the certain numbers of bar again using iSeries.
          I have again a similar code

          private Series<double> MySeries;
          MySeries = new Series<double>(this, MaximumBarsLookBack.Infinite);
          MySeries[0] = High[0] - Low[0];
          if (MySeries[0] > SMA(MySeries, 20)[0])
          .....

          I am not sure if using SMA() function to get the average value over a few numbers is the most appropriate or there is a better solution ...
          Thank you again very much for any help





          Comment


            #6
            Hi Lejczek, thanks for the follow up. Using the SMA would be the best method to take an average of a series. The code you posted looks good to me. Make sure to test it out.

            Kind regards,
            -ChrisL
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Hi Chris
              Big thanks for your support and help !
              I will continue my study of ninjascript and if I don't know something I will write
              Have a nice day



              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by geddyisodin, 04-25-2024, 05:20 AM
              8 responses
              61 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by jxs_xrj, 01-12-2020, 09:49 AM
              4 responses
              3,287 views
              1 like
              Last Post jgualdronc  
              Started by Option Whisperer, Today, 09:55 AM
              0 responses
              5 views
              0 likes
              Last Post Option Whisperer  
              Started by halgo_boulder, 04-20-2024, 08:44 AM
              2 responses
              22 views
              0 likes
              Last Post halgo_boulder  
              Started by mishhh, 05-25-2010, 08:54 AM
              19 responses
              6,189 views
              0 likes
              Last Post rene69851  
              Working...
              X