Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Operator >cannot be applied to operands of type method group

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

    Operator >cannot be applied to operands of type method group

    Iam coding a strategy based on volumetric bars, but as soon as I try to reference the previous bar delta (example) I get the error code Operator '>' cannot be applied to operands of type 'method group' and 'method group'.

    This code is fine.
    && barsType.Volumes[CurrentBar].BarDelta > barsType.Volumes[CurrentBar-1].BarDelta

    This line of code looks the same, but I receive an error.
    && barsType.Volumes[CurrentBar].GetMaximumNegativeDelta > barsType.Volumes[CurrentBar-1].GetMaximumNegativeDelta

    In addition to the above I receive the error Operator '*' cannot be applied to operands of type 'double' and 'method group' for below code. Do I just need to create another variable?
    && barsType.Volumes[CurrentBar].BarDelta > (DeltaPercentage * barsType.Volumes[CurrentBar].GetMaximumPositiveDelta)

    Thanks in advance!

    #2
    Hello,

    Thank you for your post.

    GetMaximumNegativeDelta() and GetMaximumPositiveDelta() are methods, so you need to add parentheses to the method call.

    Code:
    barsType.Volumes[CurrentBar].GetMaximumNegativeDelta() > barsType.Volumes[CurrentBar-1].GetMaximumNegativeDelta()
    Code:
    barsType.Volumes[CurrentBar].BarDelta > (DeltaPercentage * barsType.Volumes[CurrentBar].GetMaximumPositiveDelta())
    Please let me know if you have any further questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    160 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    81 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    125 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    206 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    184 views
    0 likes
    Last Post CarlTrading  
    Working...
    X