Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

The name 'Macd' does not exist in the current context

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

    The name 'Macd' does not exist in the current context

    Hello,
    if i try to compile this indicator i've the above error message.
    And can't find what happen exactly.
    See attached
    Attached Files

    #2
    mate41,

    The error that is showing up is located in the TrenDotMacd.cs file not the one you posted the code to. When the compile error shows as orange it means it's located in a different file than the one you're compiling. you can double click the error and it will open the file with the error and take you to the part of the code with the error. If you can't find the error, then post the code from that file and I or someone else I'm sure can help you.

    VT
    Last edited by VTtrader; 11-06-2011, 12:24 PM.

    Comment


      #3
      Thanks for the reply VTtrader,
      i recompiled without any change and the compile errors are no more orange; white only.
      Double clickking the error conduct me to the line where the error occurs.
      You can see a part of the code i've attached on my first post.
      I think it has todo with these lines:
      private int fast = 12; // Default setting for Fast
      private int slow = 26; // Default setting for Slow
      private int smooth = 1; // Default setting for Smooth
      trMacd = new DataSeries(this);
      trMacd.Set(MACD(Input, fast, slow, smooth)[0]);
      Macd.Set(trMacd[0]);

      Comment


        #4
        Mate41,

        Was the error the same, "The name 'Macd' does not exist in the current context "? it looks like you may have several issues going on.

        Both "trMACD" and "Macd" are being used as DataSeries, they need to be declared in the variables region, and instantiated in the Inititialize() method.

        In the variables you need:
        private DataSeries trMacd;
        private DataSeries Macd;

        in the Initialize() method you will need:
        trMacd = new DataSeries(this);
        Macd = new DataSeries(this);

        Both of those have to be in place first, then in OnBarUpdate() you can call the Set method:
        trMacd.Set(MACD(Input, fast, slow, smooth)[0]);
        Macd.Set(trMacd[0]);

        VT

        Comment


          #5
          Thanks for your time VTtrader,
          it's SOLVED. Your post made ​​me a light !!
          I did it as follows:

          In the variables i need:
          private DataSeries trMacd; // was already done

          In the 'initialize' i need:
          trMacd = new DataSeries(this); // was already done

          In the 'protected override void OnBarUpdate()' i need:
          trMacd.Set(MACD(Input, fast, slow, smooth)[0]); // was already done
          Macd.Set(trMacd[0]); // was already done too

          And here comes the solution :
          adding under 'Properties':
          [Browsable(false)]
          [XmlIgnore()]
          public DataSeries Macd
          {
          get { return Values[0]; }
          }
          If this can help someone.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by kazisl, Today, 06:41 PM
          0 responses
          4 views
          0 likes
          Last Post kazisl
          by kazisl
           
          Started by einstein, Today, 06:20 PM
          0 responses
          6 views
          0 likes
          Last Post einstein  
          Started by op1031, Today, 05:51 PM
          0 responses
          5 views
          0 likes
          Last Post op1031
          by op1031
           
          Started by nighttrader99, Today, 04:34 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_ShawnB  
          Started by Simon Investimens, Today, 02:51 PM
          1 response
          16 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Working...
          X