Announcement

Collapse
No announcement yet.

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

        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 Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              603 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              349 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              104 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              560 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              560 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X