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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        135 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        119 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        69 views
        0 likes
        Last Post PaulMohn  
        Working...
        X