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 charlesugo_1, 05-26-2026, 05:03 PM
              0 responses
              56 views
              0 likes
              Last Post charlesugo_1  
              Started by DannyP96, 05-18-2026, 02:38 PM
              1 response
              143 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by CarlTrading, 05-11-2026, 05:56 AM
              0 responses
              160 views
              0 likes
              Last Post CarlTrading  
              Started by CarlTrading, 05-10-2026, 08:12 PM
              0 responses
              96 views
              0 likes
              Last Post CarlTrading  
              Started by Hwop38, 05-04-2026, 07:02 PM
              0 responses
              276 views
              0 likes
              Last Post Hwop38
              by Hwop38
               
              Working...
              X