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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        64 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        139 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X