Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing Order

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

    Changing Order

    tPos = MarketPosition(NJSymb, "Sim101")
    AddQty = tPos
    Act = "BUY"
    LngAdd = command("PLACE", "Sim101", NJSymb, Act, AddQty, "MARKET", 0, 0, "", "", OrIDNow, "", StIDNow)
    tPos = MarketPosition(NJSymb, "Sim101")
    pXitQty = (tPos + AddQty)
    ChngXit = command("CHANGE", "Sim101", NJSymb, "SELL", pXitQty, "LIMIT", pXit2, 0, "", "", "Target2", "", StIDNow)
    ChngStp = command("CHANGE", "Sim101", NJSymb, "SELL", pXitQty, "STOPLIMIT", 0, pStp2, "", "", "Stop2", "", StIDNow)

    ' REM ChngXit = command("CHANGE", "Sim101", NJSymb, "SELL", pXitQty, "LIMIT", pXit2, pStp2, "", "", "", "", StIDNow)
    TrdSel = 0
    Exit Function
    End Select

    Reference the above . . .

    Why is it required to send two change orders as shown above (works fine) in order to accomplish the task of changing the limit side (profit) and stop side (loss) of a strategy? The command function holds a place for both values. It would seem that it would be possible to accomplish this in a single command, but the requirement to send "Target2" or "Stop2" seems to require two changes. IS THIS CORRECT? . . . or does someone know how to do this in one command. The commented ('REM) line above does not work and gives error:
    OIF, ' is missing order ID/Name parameter.

    When I add the original Order Name it gives error:
    OIF, ' invalid order ID/Name 'ES 03-11.T2S1.2'

    Simple question . . . and simple answer desired . . . either:
    Yes . . . do this . . . or No . . . two lines of code required.

    Best,
    Dox

    #2
    Hi Dox,

    No, changing two orders requires two lines.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you very much!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      110 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      59 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      37 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      41 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      78 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X