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

Problem with simple code

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

    Problem with simple code

    I created this simple strategy as first step, simple one, through the Wizard. But the "finish" comes with error message. The parameters are simple and streightforward, I entered them as follows:

    Conditions: VOL()[1] <= (VOLMA(20)[0])*(1-0.7)
    Actions: DrawArrowUp("My up arrow" + CurrentBar, false,0, Low[0]+-6 * TickSize, Color.Black)

    The code comes up as follows:

    // 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")]
    publicclass VolumBreakout : Strategy
    {
    #region Variables
    // Wizard generated variables
    // User defined variables (add any user defined variables below)
    #endregion
    ///<summary>
    /// This method is used to configure the strategy and is called once before any strategy method is called.
    ///</summary>
    protectedoverridevoid Initialize()
    {
    Add(VOL());
    Add(VOLMA(
    20));
    CalculateOnBarClose =
    true;
    }
    ///<summary>
    /// Called on each bar update event (incoming tick)
    ///</summary>
    protectedoverridevoid OnBarUpdate()
    {
    // Condition set 1
    if (VOL()[1] <= (VOLMA(20)[0]) * (1 + -70))
    {
    DrawArrowUp(
    "My up arrow" + CurrentBar, false, 0, Low[0] + -6 * TickSize, Color.Black);
    }
    }
    #region Properties
    #endregion
    }
    }

    Thanks for the help.

    #2
    It seems that no matter what new strategy i try to make, it comes up with same error.

    Comment


      #3
      I am not sure what you are trying to accomplish with Low[0] + -6 * TickSize

      You might want to try :

      For Arrow 6 Ticks above the Low:
      Low[0] + (6*TickSize)
      Fro Arrow 6 Ticks below the Low: Low[0] - (6*TickSize)

      Comment


        #4
        Hi ju1234,

        Which error message are you getting exactly?

        If other files in your collection have errors, they will show up as well when you try to compile a new code...so please review this thread and debug / delete your files giving you the error messages - http://www.ninjatrader-support2.com/...ead.php?t=4678
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Well, it tells me the name of file that has errors but when i try to delete it, it says "Cannot delete it because it may be referenced by another file" or something like that. Can i delete it using the windows explorer?

          Comment


            #6
            To TajTrades: -6*TickSize just puts an arrow six ticks below the low of the price bar. It works fine in another strategy, so this is not the cause. Thanks.

            Comment


              #7
              ju1234,

              We never recommend you manipulate any files manually as it can mess up dependencies. You will just have to find where you are referencing the file else where and remove the reference before you can delete the file.
              Josh P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Jonafare, 12-06-2012, 03:48 PM
              5 responses
              3,986 views
              0 likes
              Last Post rene69851  
              Started by Fitspressorest, Today, 01:38 PM
              0 responses
              2 views
              0 likes
              Last Post Fitspressorest  
              Started by Jonker, Today, 01:19 PM
              0 responses
              2 views
              0 likes
              Last Post Jonker
              by Jonker
               
              Started by futtrader, Today, 01:16 PM
              0 responses
              8 views
              0 likes
              Last Post futtrader  
              Started by Segwin, 05-07-2018, 02:15 PM
              14 responses
              1,792 views
              0 likes
              Last Post aligator  
              Working...
              X