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

stop loss order rejected

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

    stop loss order rejected

    running a strategy on market replay data, ver 6.0.1000.5, the entry order gets placed and the target order gets placed but the stop order gets rejected for being "below the market". I don't understand this.... The strategy is flat before this code is run. Price is not changing enough before the fill to cause the rejection...

    EnterShort(contracts,"sig10");
    SetStopLoss(CalculationMode.Price,10);
    SetProfitTarget(CalculationMode.Price,30);

    Similar code used for a long entry works as per the documentation...
    Last edited by maxpi; 11-20-2007, 07:45 PM.

    #2
    Right. When you use CalculationMode.Price, the variable you set is the actual price you want to exit at. For instance if your instrument is trading at 100, you may want to set a Profit Target at 110 and to do that you would do SetProfitTarget(CalculationMode.Price, 110).

    From the looks of your numbers it looks like you want to use CalculationMode.Ticks instead.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Ok, i was using the idea that the value i supplied would be offset from the entry price.

      thanks muchly

      Comment


        #4
        You can do something like Position.AvgPrice + somevalue.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          The docs say the following regarding SetProfitTarget:

          "Should you call this method to dynamically change the target price in the strategy OnBarUpdate() method, you should always reset the target price/offset value when your strategy is flat otherwise, the last price/offset value set will be used to generate your profit target order on your next open position "

          what is meant by "reset the target price/offset value"? Do I issue a SetProfitTarget or update the variable used to fill in the target price immediately upon receiving the info that position is flat from TWS?

          Comment


            #6
            See this reference sample

            RayNinjaTrader Customer Service

            Comment


              #7
              The reference sample helped, thanks. What I was wondering is if one has to wait to be flat before changing the stop values, apparently just changing them at the time of the entry order should be fine?

              Comment


                #8
                Changing them whenever will work for updating the next profit target/stop loss orders sent.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Yes, you can change it at the time of entry order submission, just do it prior to submitting an entry order otherwise it is possible that stop/targets will be submitted at the last known stop/target price for your prior trade.
                  RayNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by PhillT, 04-19-2024, 02:16 PM
                  4 responses
                  35 views
                  0 likes
                  Last Post PhillT
                  by PhillT
                   
                  Started by ageeholdings, 05-01-2024, 05:22 AM
                  5 responses
                  37 views
                  0 likes
                  Last Post ageeholdings  
                  Started by reynoldsn, Today, 02:34 PM
                  0 responses
                  13 views
                  0 likes
                  Last Post reynoldsn  
                  Started by nightstalker, Today, 02:05 PM
                  0 responses
                  20 views
                  0 likes
                  Last Post nightstalker  
                  Started by llanqui, Yesterday, 09:59 AM
                  8 responses
                  32 views
                  0 likes
                  Last Post llanqui
                  by llanqui
                   
                  Working...
                  X