Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Can not chance stop price. Log included.

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

    Can not chance stop price. Log included.

    Hello,

    me again Happens I have another unexplained behavior now that the markets are open. I have a problem moving the stop price.

    Here is the log, with explanations:

    POSITION: Long 1 @ 9014
    Activating Trail for Position Long
    Cancelled custom managed order at 27/07/2009 18:24:55: Order='22eef3ad407c446e9a80cd0f6b0abc22/Sim101' Name='HA3 STP' State=Accepted Instrument='YM 09-09' Action=Sell Limit price=0 Stop price=8998 Quantity=1 Strategy='HeinekenAshiReversal' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='22eef3ad407c446e9a80cd0f6b0abc22' Gtd='01/12/2099 00:00:00'
    27/07/2009 18:24:55 Entered internal PlaceOrder() method at 27/07/2009 18:24:55: Action=Sell OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=9009 SignalName='HA3 STP' FromEntrySignal='HA3 L'
    27/07/2009 18:24:55 Ignored PlaceOrder() method: Action=Sell OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=9009 SignalName=HA3 STP' FromEntrySignal='HA3 L' Reason='There already is a matching, terminal exit order in place'


    Basiucallz I am short one contract after the execution, so my stop loss on the last position has to change.

    Here is what I do:
    * I cancel the stop order in the system.
    * I enter a new one.

    Ad can be seen above, there is a cancel for a stop loss for signal "HA3 STP". This cancel is accepted from your system.
    I then enter a new stop, same signal name. And I get the info that there laready is a terminal exit order in place.

    Can be related to me doing that on a life feed, NOW (i.e. cancel and set stop happen in the same execution event). Do I have to wait until the cancel is accepted (which makes my code harder)? What can eplain this, and what is the proposed strategy to move trailing stops, if not cancel/reentry? Shall I just put in the new stop, and your system will turn that from a new order into an update?

    My code is:
    if (
    Stop != null
    && (StopPrice != Stop.StopPrice || Quantity != Stop.Quantity)
    ) {
    _Manager._Strategy.CancelOrder (Stop);
    Stop = null;
    }
    if (StopPrice == 0 || Quantity == 0) {
    return null;
    }
    string signal = Token + " STP";
    string entrysignal = null;
    switch (Direction) {
    case MarketPosition.Long:
    entrysignal = Token + " L";
    Stop = _Manager._Strategy.ExitLongStop (0, true, Quantity, StopPrice, signal, entrysignal);
    break;
    case MarketPosition.Short:
    entrysignal = Token + " S";
    Stop = _Manager._Strategy.ExitShortStop (0, true, Quantity, StopPrice, signal, entrysignal);
    break;
    }
    _Manager._ActiveOrders [Stop.Token] = new OrderIndex (this, OrderSlot.Stop);
    return Stop;

    #2
    Known bug resolved in a later version. You cannot cancel a stop and then replace it. Suggest you just send amends instead. If you wanted to move the stop out of play for the time being, modify the price down significantly and then bring it back up when you need it again.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      Known bug resolved in a later version. You cannot cancel a stop and then replace it. Suggest you just send amends instead. If you wanted to move the stop out of play for the time being, modify the price down significantly and then bring it back up when you need it again.
      Please explain later version. I am on 11 - anything later for download?

      So, it is ok if I just set up a new stop order and let the system handle that? Did that. Now I have to wait for the next runner to come by

      Moving out of place not necessary Actually this is about pulling the stop up once I am in runner mode

      Comment


        #4
        Not sure if you want a new order. You can just amend the original to pull it up.

        Later version = NT7
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Too bad with "new version NT7"... better get going with that one

          That said, I rewrote all my code and now I do updates... works like a charm Had a fast run in YM, and for a minute it basically was just pulling up stops.

          Thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by xepher101, 05-10-2024, 12:19 PM
          4 responses
          51 views
          0 likes
          Last Post xepher101  
          Started by DawnTreader, 05-08-2024, 05:58 PM
          22 responses
          82 views
          0 likes
          Last Post DawnTreader  
          Started by Mathias79, Today, 03:44 PM
          0 responses
          17 views
          0 likes
          Last Post Mathias79  
          Started by Austiner87, Today, 03:42 PM
          0 responses
          11 views
          0 likes
          Last Post Austiner87  
          Started by lorem, 04-25-2024, 09:18 AM
          19 responses
          84 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X