Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 tells me t expects a statement in a nested if situation

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

    NT8 tells me t expects a statement in a nested if situation

    NT8 allows the 'Allowed.txt' upload


    But if I add one line as per 'Error.txt' upload I get an error message that a statement is expected on Line 253


    I do not understand my problem. HELP.
    Attached Files

    #2
    Hello galsermil,

    The line you marked with (Added line) is an else if.

    There isn't any action for the else above it.

    Try this instead:
    if((Close[1] == LineSignal[1]) && ((Open[0] == Close[1]) || (Open[0] == (Close[1] +TickSize))))
    {
    }
    /*(Added Line)*/ else if((Close[1] ==( LineSignal[1]+TickSize)) && ((Open[0] ==( Close[1] -TickSize)) || (Open[0] == Close[1]) || (Open[0] == (Close[1] +TickSize))))
    EnterLong(Contracts,"SpeedTickPivot");
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea,

      I believe what you have done is close the 'if' block and then add the 'else if' but for my purposes there is another 'else if' to follow before the action of <Enter > is taken. Will I need to close the first ;else if' curly brackets before I add the second else if? Thank you

      Comment


        #4
        Hello galsermil,

        I added a set of curly brases so that the if statement has an action block. The C# code you suggested in post #1 can't work because you have an if statement, no action block, and then an else if. That is invalid C#.

        If you are unfamiliar with single line action blocks, I recommend you use curly braces for the action block of every if statement to make this less confusing.
        Chelsea B.NinjaTrader Customer Service

        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