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

NOOB: Info on buy/sell order for EOD data

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

    #16
    It do not have to be a double, i have also tried with an int but get the same error. It must be possible to use an int as an array in this way???

    Comment


      #17
      If you want to use an int please use an IntSeries. Same exact concept as DataSeries. http://www.ninjatrader-support.com/H...riesClass.html
      Josh P.NinjaTrader Customer Service

      Comment


        #18
        But i dont want the array to contain any bar data. I just want a simpe array that contains different int values that has nothing to do with the current bar chart. The references you sent me bouth state "that holds a series of int values and ALWAYS contains the same number of elements as bars in a chart". So it is not possible to use standard C# arrays in NT?

        My second question is if there is a indicator for historical volatility in NT? Cant find any info in the help files. I did find this old thred

        but there is no one from NT that has comented if the indicator is exact or if it has any errors?

        Comment


          #19
          Man this is not my day I have a sterategy that has errors in it but now i want to start making an indicator. However when i am compiling the indicator i get errors from that strategy. Why is that i just want to compile the indicator and i dont want to do anything with the strategy.

          Comment


            #20
            zwoop,

            All NinjaScript files compile at the same time when you press compile. They all need to be error free. If you don't want to finish working on an unfinished work before starting on a different you can comment out all the uncompilable lines to let it compile and then let you work on your indicators.

            If you want a C# array you will then have to use the C# techniques for achieving this. Unfortunately this is outside of what we can cover. I suggest you try searching on google for some resources on how they do it though.
            Josh P.NinjaTrader Customer Service

            Comment


              #21
              My second question is if there is a indicator for historical volatility in NT? Cant find any info in the help files. I did find this old thred
              http://www.ninjatrader-support2.com/...cal+Volatility
              but there is no one from NT that has comented if the indicator is exact or if it has any errors?

              The way i have made the array is the standard C# way that is why im puzzled when i get the error

              Comment


                #22
                Hello,


                I'm jumping in here, so I may be way off, but:

                Post your code and we can help.

                A good volatility measurement can be found via the Bollinger indicator.
                DenNinjaTrader Customer Service

                Comment


                  #23
                  #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

                  // This namespace holds all strategies and is required. Do not change it.
                  namespace NinjaTrader.Strategy
                  {
                  /// <summary>
                  /// Enter the description of your strategy here
                  /// </summary>
                  [Description("Enter the description of your strategy here")]
                  public class Test1 : Strategy
                  {
                  #region Variables
                  // Wizard generated variables
                  private int myInput0 = 1; // Default setting for MyInput0
                  // User defined variables (add any user defined variables below)
                  int upp=new int[60], down=new int[60], unChanged=new int[60];
                  #endregion

                  /// <summary>
                  /// This method is used to configure the strategy and is called once before any strategy method is called.
                  /// </summary>
                  protected override void Initialize()
                  {
                  ClearOutputWindow();
                  CalculateOnBarClose = true;
                  BarsRequired=3;

                  }

                  /// <summary>
                  /// Called on each bar update event (incoming tick)
                  /// </summary>
                  protected override void OnBarUpdate()
                  {
                  UppUpp();
                  DownUpp();
                  UppDown();
                  DownDown();

                  //DownDownDown();

                  }

                  private void UppUpp(){
                  if(Close[1]>Close[2] && Open[0]>Close[1])
                  if(Close[0]>Open[0])
                  upp[0]++;
                  else if(Close[0]<Open[0])
                  down[0]++;
                  else
                  unChanged[0]++;

                  if (Bars.CurrentBar == Bars.Count-2)
                  Print("++ UPP: "+ (upp[0]/(upp[0]+down[0]+unChanged[0])*100).ToString("N0") +"% Down: "+ (down[0]/(upp[0]+down[0]+unChanged[0])*100).ToString("N0") +"%");
                  }

                  private void DownUpp(){
                  if(Close[1]<Close[2] && Open[0]>Close[1])
                  if(Close[0]>Open[0])
                  upp[1]++;
                  else if(Close[0]<Open[0])
                  down[1]++;
                  else
                  unChanged[1]++;

                  if (Bars.CurrentBar == Bars.Count-2)
                  Print("++ UPP: "+ (upp[1]/(upp[1]+down[1]+unChanged[1])*100).ToString("N0") +"% Down: "+ (down[1]/(upp[1]+down[1]+unChanged[1])*100).ToString("N0") +"%");
                  }

                  private void UppDown(){
                  if(Close[1]>Close[2] && Open[0]<Close[1])
                  if(Close[0]>Open[0])
                  upp[2]++;
                  else if(Close[0]<Open[0])
                  down[2]++;
                  else
                  unChanged[2]++;

                  if (Bars.CurrentBar == Bars.Count-2)
                  Print("++ UPP: "+ (upp[2]/(upp[2]+down[2]+unChanged[2])*100).ToString("N0") +"% Down: "+ (down[2]/(upp[2]+down[2]+unChanged[2])*100).ToString("N0") +"%");
                  }

                  private void DownDown(){
                  if(Close[1]<Close[2] && Open[0]<Close[1])
                  if(Close[0]>Open[0])
                  upp[3]++;
                  else if(Close[0]<Open[0])
                  down[3]++;
                  else
                  unChanged[3]++;

                  if (Bars.CurrentBar == Bars.Count-2)
                  Print("++ UPP: "+ (upp[3]/(upp[3]+down[3]+unChanged[3])*100).ToString("N0") +"% Down: "+ (down[3]/(upp[3]+down[3]+unChanged[3])*100).ToString("N0") +"%");
                  }

                  private void DownDownDown(){
                  }

                  #region Properties
                  [Description("")]
                  [Category("Parameters")]
                  public int MyInput0
                  {
                  get { return myInput0; }
                  set { myInput0 = Math.Max(1, value); }
                  }
                  #endregion
                  }
                  }

                  Comment


                    #24
                    This is my code now, all i want to do i use a simpe array as it is outlined in the code but i just get an error doing so.

                    Comment


                      #25
                      zwoop, unfortunately we can't debug those C# methods for you, however you can take a look at this thread here members discussed related topics providing valuable insight into using arrays / arraylists in C# - http://www.ninjatrader-support2.com/...ad.php?t=24801
                      BertrandNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Kaledus, Today, 01:29 PM
                      3 responses
                      9 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by frankthearm, Yesterday, 09:08 AM
                      14 responses
                      47 views
                      0 likes
                      Last Post NinjaTrader_Clayton  
                      Started by gentlebenthebear, Today, 01:30 AM
                      2 responses
                      13 views
                      0 likes
                      Last Post gentlebenthebear  
                      Started by PaulMohn, Today, 12:36 PM
                      2 responses
                      17 views
                      0 likes
                      Last Post PaulMohn  
                      Started by Conceptzx, 10-11-2022, 06:38 AM
                      2 responses
                      56 views
                      0 likes
                      Last Post PhillT
                      by PhillT
                       
                      Working...
                      X