Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss Order not submitting

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

    SetStopLoss Order not submitting

    Hello,

    I have small catch in this code, i am not getting it work. Basically i want to submit stop loss order to low of previous bar of entry condition bar. But i am getting error after multiple tries. Can you suggest what is going wrong. I am also using Exit On Close.
    Attached Files
    Devdas
    NinjaTrader Ecosystem Vendor - Devdas

    #2
    Hello..... Some one here ?
    Devdas
    NinjaTrader Ecosystem Vendor - Devdas

    Comment


      #3
      hello devdas,

      Thanks for your post and patience.

      Have you tried printing the signalBar_low value just before you set the stoploss just to make sure of the value?

      Comment


        #4
        Hi Paul,

        thanx for looking it here.

        As you suggest i printed that value and it seems ok, i checked maually on all 8 trades.
        But 2 of them as its clear that stop order didnt executed. Notie also the error on log is still generating. May be that error is due to setting signalBar_low = 0 when it gets Flat. But i am not sure that is causing any problem.

        One more thing , i am setting a huge value of initial Stop Loss in Initialize() to ensure that Calculated Stop is used for trigger.I have used ST = 200,000 in that. I set this huge values because on smaller value strategy was not using Calculated Stop Price rather than hitting Stop order with smaller values.
        Attached Files
        Devdas
        NinjaTrader Ecosystem Vendor - Devdas

        Comment


          #5
          Hello,

          Thanks for your reply.

          Does it make sense to add a condition, where you set your stop loss, to first test if the current bar low is less than or equal to the low 1 bar ago? Or perhaps check the difference between the current Low and the Low[1] and if less than some value set your stoploss at some other value?

          Comment


            #6
            Well thats very annoying and confusing me more.
            I cant understand why i need to compare CurrentBar Low to Low[1] ?
            As i am using CalculationMode.Price then any price lower than entry price i can set for Stop Loss in case of Long and it should be submitted as soon as long triggers.

            Well i set lower Value of ST = 300 ticks and now error is not appearing but also number of prints of signalBar_low in output is also reduce. Trades that hit stop with ST = 300 ticks are absent from that. Look at prior post figures, first print value of 7798.4 is absent now from here and corresponding trade had hit the stop with ST = 300 ticks.

            Looks also next trade with signalBar_low = 8451.05 which never retraced and hence its signalBar_low value is appearing in output.

            I have attached snap of current code also with slight modification like commenting the line
            signalBar_low =0;
            Attached Files
            Devdas
            NinjaTrader Ecosystem Vendor - Devdas

            Comment


              #7
              Hello devdas,

              Thanks for your reply.

              Sorry if this is confusing but I only know what snippets of your code you share and evidence of results so I am guessing at what the issues are. I suggested a comparison from the Low 1 bar ago to the current bar low to ensure that price had not retraced, is that not possible or do you have other code that checks for this?

              Comment


                #8
                Hello Paul.

                I got it working. Actually catch was "DoneForSession" variable and i guess to some extent fix Stop Value ST. Ultimately its comparing the User Calculated Stop to Fix Stop for submission, this is what i am taking this from it.
                I need to set ST = 10000 ticks which is relatively large value compared to session range we get. But again too high value again threw error as before.
                Attached Files
                Devdas
                NinjaTrader Ecosystem Vendor - Devdas

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                558 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                324 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                545 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                547 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X