Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Operands of Method group issue

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

    Operands of Method group issue

    Hi,

    I've created an indicator to show volume spikes. It's not happy about something. I've tried them as integers, but still no joy. There is something i'm missing. Still knew to coding.

    Cheers

    ERRORS ---------------------------
    Indicator\HighVolAlert.cs Operator '>' cannot be applied to operands of type 'method group' and 'double' CS0019 - click for info 56 8
    ----------------------------------------
    Indicator\HighVolAlert.cs Operator '*' cannot be applied to operands of type 'double' and 'NinjaTrader.Indicator.VOLMA' CS0019 - click for info 49 15
    ---------------------------------------------------------------------------------


    #2


    #region Variables

    privatebool volType ; // Test type
    privatedouble volRatio = 1; // Default setting for VolRatio
    privatedouble volLevel = 1; // Default setting for VolLevel

    #endregion



    Comment


      #3
      {

      if (VolType == false)
      {
      if (VOL > (volRatio*VOLMA(14)))
      {
      HighVol.Set(Close[
      0]);
      }
      }
      if (VolType == true)
      {
      if (VOL > volLevel)
      {
      HighVol.Set(Close[
      0]);
      }
      }
      }

      Comment


        #4
        #region Properties
        [Browsable(
        false)]
        [XmlIgnore()]
        public DataSeries HighVol
        {
        get { return Values[0]; }
        }
        [Description(
        "Decide Test type")]
        [GridCategory(
        "Parameters")]
        publicbool VolType
        {
        get { return volType; }
        set { volType = value; }
        }

        [Description(
        "Use this for Ratios")]
        [GridCategory(
        "Parameters")]
        publicdouble VolRatio
        {
        get { return volRatio; }
        set { volRatio = Math.Max(1, value); }
        }
        [Description(
        "Use this for fixed levels")]
        [GridCategory(
        "Parameters")]
        publicdouble VolLevel
        {
        get { return volLevel; }
        set { volLevel = Math.Max(1, value); }
        }
        #endregion
        }
        }

        Comment


          #5
          Originally posted by Aussiemike View Post
          {

          if (VolType == false)
          {
          if (VOL > (volRatio*VOLMA(14)[0]))
          {
          HighVol.Set(Close[
          0]);
          }
          }
          if (VolType == true)
          {
          if (VOL > volLevel)
          {
          HighVol.Set(Close[
          0]);
          }
          }
          }
          Correction in red. VOLMA(14) is a DataSeries: you want a specific indexed value, which returns a double. You cannot multiply the DataSeries, or run a comparison on it.

          Comment


            #6
            Thanks again...

            Comment


              #7
              Though for sure that would be it, but it's still showing errors.

              if (VolType == false)
              {
              if (VOL[0] > (volRatio*(VOLMA(14)[0])))
              {
              HighVol.Set(Close[
              0]);
              }
              }
              if (VolType == true)
              {
              if (VOL >= volLevel)
              {
              HighVol.Set(Close[
              0]);
              }

              This is for VOLMA error
              Indicator\HighVolAlert.cs Cannot apply indexing with [] to an expression of type 'method group' CS0021 - click for info 49 8 volLevel

              This is for volLevel error
              Indicator\HighVolAlert.cs Operator '>=' cannot be applied to operands of type 'method group' and 'double' CS0019 - click for info 56 8


              Comment


                #8
                Would this compile well for you?

                if (VolType == false)
                {
                if (VOL()[0] > (volRatio * (VOLMA(14)[0])))
                {
                HighVol.Set(Close[0]);
                }
                }
                if (VolType == true)
                {
                if (VOL()[0] >= volLevel)
                {
                HighVol.Set(Close[0]);
                }

                Comment


                  #9
                  Yes thanks.

                  I remember a friend telling me some things needed these open/close brackets even if no argument.

                  Indicator working well

                  Cheers.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  633 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  364 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  105 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  567 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  568 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X