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