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

If I use a stoploss to manage my position,

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

    #16
    Hello,

    Issue is with how you are submitting either the stop loss or the reversal stop.

    You are submitting to a price that is above market when you are trying to sell short with a stop order. This order must be below current price action to be submitted.

    Check into how you are calculating the price on both the SetStopLoss and Exit Short.

    Also, please be carefull with using both orders I would not recommend this. Would recommend you use only one or the other depending on what you need.

    As you can run into an overfill scenario and other type of situations.

    Over-Fills is a serious issue that can occur when using complex entry conditions that bracket the market in both directions end up with both entries being filled instead of one being cancelled. Over-Fills can also occur when you place a trade quickly hoping to close a position while a prior order to close the same position already had an in-flight execution. The exact scenarios in which an over-fill can occur is highly dependent on the specific strategy programming. By default, NinjaTrader will protect against over-fills even though you are using the Unmanaged approach by halting the strategy, but should you decide to custom program your own over-fill handling it is up to you to either prevent over-fills from being a possibility in your code or by introducing logic to address over-fills should one occur.

    Comment


      #17
      Hi Brett,

      Thank you for your detailed reply. Only that I do not understand this paragraph:-

      You are submitting to a price that is above market when you are trying to sell short with a stop order. This order must be below current price action to be submitted.
      If I am selling short, I am betting that the price is going down. I set a stop above my entry price AND at a level which it had recently traded. So what does you mean I am "submitting my price that is above market"?

      Comment


        #18
        Hi Brett,

        Trying to make things less complicated.

        1. For my initial entry, when a flag triggers, I go long.
        2. If the long trade doesn't work as anticipated, I stop and reverse the trade, meaning I go short.
        3. If the short trade triggers the stop level, the trade is finally closed.

        What is the best way to do this?

        Regards

        Kay Wai

        Comment


          #19
          Hi Brett,

          I think I got the code to work the way I wanted it to work!

          Instead of

          SetStopLoss(
          CalculationMode mode, double value)
          ,

          I used

          SetStopLoss(
          string fromEntrySignal, CalculationMode mode, double

          value, bool simulated)
          The only confusion I have with the latter syntax is "bool simulated". The manual explains it as
          If true, will simulate the stop order and submit as
          market once triggered
          If I have it as true, do I need to do anything different if I'm running the strategy in real-time?

          Regards

          Kay Wai

          Comment


            #20
            Kay, great job! It would depend if you wish to have you stop simulated or not then, if it's simulated it would only be sent if triggered by price action, thus 'hidden' from the market.
            BertrandNinjaTrader Customer Service

            Comment


              #21
              Hi Bertrand,

              This is interesting!
              Let me get this right.

              If "bool simulated" is true, the stop is not placed into the market until the price is triggered.

              If "bool simulated is false, the stop is placed into the market upon entry order being executed.

              Is that correct?

              Regards

              Kay Wai

              Comment


                #22
                Hello,

                Your understanding is correct!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Waxavi, Today, 02:10 AM
                0 responses
                6 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by TradeForge, Today, 02:09 AM
                0 responses
                11 views
                0 likes
                Last Post TradeForge  
                Started by Waxavi, Today, 02:00 AM
                0 responses
                2 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by elirion, Today, 01:36 AM
                0 responses
                4 views
                0 likes
                Last Post elirion
                by elirion
                 
                Started by gentlebenthebear, Today, 01:30 AM
                0 responses
                5 views
                0 likes
                Last Post gentlebenthebear  
                Working...
                X