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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    21 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Working...
    X