Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

stop position from code

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

    stop position from code

    will this code give you the current value/position of a stop?

    if not, is there code for that?

    thanks

    protected override void OnBarUpdate()
    {
    string[,] orders = GetAtmStrategyStopTargetOrderStatus("TARGET1", "idValue");

    // Check length to ensure that returned array holds order information
    if (orders.Length > 0)
    {
    for (int i = 0; i < orders.GetLength(0); i++)
    {
    Print("Average fill price is " + orders[i, 0].ToString());
    Print("Filled amount is " + orders[i, 1].ToString());
    Print("Current state is " + orders[i, 2].ToString());
    }
    }
    }

    #2
    No, you will have to run your own variables to track it should you want to track it. You know your entry price and you know the offset you submitted at so it is just a matter of doing the math.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      that is not why I need it

      I already track the stop from initial through every time I move it

      what I was looking for was the ability to have the code check if the stop has been moved manually

      thanks anyway

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      421 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      279 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      238 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      324 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      288 views
      0 likes
      Last Post CarlTrading  
      Working...
      X