Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Invalid expression term ')'

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

    Invalid expression term ')'

    I have been trying again and again to figure out what this error is but I can not seem to figure out what is wrong with it.

    I am getting the error in that is mentioned in the title.

    When I double click on the error, I am taken to the following line of code:
    Code:
    if (SMA(sMAPeriod)[0] - ((SignalHigh - SignalLow)*StopPerc) > LongStopB.StopPrice))
    Here is where it is in context:
    Code:
    protected override void OnExecution(IExecution execution)
    {
    if (LongLimit != null && LongLimit == execution.Order)
    {
    if (execution.Order.OrderState == OrderState.Filled)
    {
    ExitLongStop(AvgPrice-(execution.Price - AvgPrice),"LongStopB","LongEntryB");
    }
    if (SMA(sMAPeriod)[0] - ((SignalHigh - SignalLow)*StopPerc) > LongStopB.StopPrice))
    {
    ExitLongStop(SMA(sMAPeriod) - ((SignalHigh - SignalLow)*StopPerc),"LongStopB","LongEntryB");
    }
    }
    }
    LongStopB is an IOrder variable that is in the global variables section

    It is then defined in the OnBarUpdate() section as:
    Code:
    LongStopB = ExitLongStop(StopPriceLong,"LongStopB","LongEntryB");
    I then have an if statement that then uses this to set my stop Loss

    Code:
    if ("series of conditions")
    {
    ExitLongStop(StopPriceLong,"LongStopB","LongEntryB");
    }
    Is that enough information to help me figure out what is causing this error?

    Incidentally, I also receive " ; expected " and when I click on that, it takes me to the same line of code.

    Thank you for any help that anyone is able to provide.

    #2
    Hello jg123,

    Thank you for your post.

    Change the line that the error references to the following:
    Code:
    if (SMA(sMAPeriod)[0] - ((SignalHigh - SignalLow)*StopPerc) > LongStopB.StopPrice)
    You had an additional ')' in the line.

    Comment


      #3
      Thank you, Patrick

      That did fix it, but it then opens up an entire new can of worms. I will discuss this in a new thread.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      647 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X