Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

making progress, but still need help

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

    making progress, but still need help

    I've been troubleshooting this program for 2 weeks now. I have it narrowed down quite a bit and have new information.

    Basically, my strategy always enters a position, and it never exits using my ExitLongStop or ExitShortStop commands. It only reverses positions when a EnterShortStop is triggered. I just realized this after major debugging and printing.

    Here is the portion of my code with this logic. I'm assuming there is some fundamental thing that I'm missing. I hope someone can help.

    if ( movAvgVal[0] > movAvgVal[1] )
    {
    EnterLongStop(upBand, "Long Buy");
    }

    else if ( movAvgVal[0] < movAvgVal[1])
    {
    EnterShortStop(dnBand, "Short Buy");
    }


    if ((Position.MarketPosition == MarketPosition.Long))
    {
    ExitLongStop(movAvgVal2[0], "Long Exit");
    }


    else if ((Position.MarketPosition == MarketPosition.Short))
    {
    ExitShortStop(movAvgVal2[0], "Buy to Cover");
    }
    }


    The code will not run my ExitLongStop or ExitShortStop commands. If I change them to ExitLong() and ExitShort(), it will execute them, but it messes up the logic and testing. I need them to be stops.

    Please help, I'm been at this non stop for 2 weeks.

    #2

    ExitLongStop(double stopPrice, string fromEntrySignal)

    Your code: ExitLongStop(movAvgVal2[0], "Long Exit");

    Where do you have an entry signal "Long Exit"?

    Comment


      #3
      NinjaTrader Dierk,

      You are a genius! Thanks so much. I think this fixed it! I need to do more testing in the morning. I assumed that the parameters would be similar for EnterLongStop() and ExitLongStop.


      Thanks again!



      Originally posted by NinjaTrader_Dierk View Post
      http://www.ninjatrader-support.com/H...tLongStop.html
      ExitLongStop(double stopPrice, string fromEntrySignal)

      Your code: ExitLongStop(movAvgVal2[0], "Long Exit");

      Where do you have an entry signal "Long Exit"?

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X