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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      78 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X