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

SL and PT did not place

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

    SL and PT did not place

    Hello,
    I am running automated strategy and i faced problem, that sl and pt orders were not placed when limit order was filled. how is this possible? Luckily i came to computer and closed position manually, but if i was not price could run away from sl... is there a way how this could be handled properly? how to find out that sl or pt were not properly "placed" after entry limit price was filled.

    #2
    Hello kujista,

    In this situation we would need more detail on what you were doing in code to better understand what could have happened. How are you submitting the targets and what code was being used when this happened?
    JesseNinjaTrader Customer Service

    Comment


      #3
      3 actions were made:

      1. SetStopLoss(tradeItem.EntryName, CalculationMode.Price, tradeItem.StopLoss_Price, false);
      ​2. SetProfitTarget(tradeItem.EntryName, CalculationMode.Price, tradeItem.ProfitTarget_Price);
      ​3. t.Order = EnterLongLimit(timeFrameTicks, true, t.Contracts, t.EntryPrice, t.EntryName);

      These were commands which place order... nothing significant was called.

      Comment


        #4
        Hello kujista,

        In the code you provided two different variables are being used as the entry name, are you certain that the entry name was specified correctly for the targets?

        1. SetStopLoss(tradeItem.EntryName, CalculationMode.Price, tradeItem.StopLoss_Price, false);
        ​2. SetProfitTarget(tradeItem.EntryName, CalculationMode.Price, tradeItem.ProfitTarget_Price);
        ​3. t.Order = EnterLongLimit(timeFrameTicks, true, t.Contracts, t.EntryPrice, t.EntryName);​
        JesseNinjaTrader Customer Service

        Comment


          #5
          Yes definitiely... This code works in 99%... this happend twice, i suggest some connection problem or something...

          Comment


            #6
            Hello kujista,

            You will likely need to enable traceorders and monitor for the next time this happens to see if the orders are being ignored for some reason. If the orders were not submitted at all that would generally be due to an incorrect signal name being used or the targets are being called at an incorrect time. The Set methods need to be called right before the entry order just like the 3 lines of code you provided, if you have the Set methods being called in a different part of your logic or outside the entry condition its possible that could relate to the problem. The Set methods should be part of the entry condition.

            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Rogers101, 05-05-2024, 11:30 AM
            10 responses
            35 views
            0 likes
            Last Post Rogers101  
            Started by tradingnasdaqprueba, Today, 03:42 AM
            2 responses
            21 views
            0 likes
            Last Post tradingnasdaqprueba  
            Started by cmtjoancolmenero, 04-25-2024, 03:58 PM
            21 responses
            114 views
            0 likes
            Last Post cmtjoancolmenero  
            Started by Quanto, 04-17-2024, 10:43 AM
            3 responses
            28 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by Mindset, Yesterday, 06:19 AM
            3 responses
            17 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X