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 charlesugo_1, 05-26-2026, 05:03 PM
                  0 responses
                  59 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
                  161 views
                  0 likes
                  Last Post CarlTrading  
                  Started by CarlTrading, 05-10-2026, 08:12 PM
                  0 responses
                  97 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