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

issue with cancelling order.

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

    issue with cancelling order.

    if (StratState == 2 && Close[0] > Silver_Stop)
    {
    EnterLongStopLimit(0, false, 1, Entry_Sig_High, Entry_Sig_High, "Gold_" + CurrentBar);
    EnterLongStopLimit(0, false, 1, Entry_Sig_High, Entry_Sig_High, "Silver_" + CurrentBar);
    SetProfitTarget("Silver_" + CurrentBar, CalculationMode.Price, Silver_Goal);
    SetProfitTarget("Gold_" + CurrentBar, CalculationMode.Price, Gold_Goal);
    SetStopLoss(CalculationMode.Price, Silver_Stop);
    }

    from my understanding, since I have live until canceled as false, these 2 enter long limits should stay active until the IF statement is no longer true. so in this case, as soon as the close price moves bellow the silver stop (red diamond in image) but as you can see it stays active and just waits for the price to rise up to the entry (green diamond). what can I do to have this order vanish as soon as price dips bellow the stop diamond before hitting the entry diamond?
    Click image for larger version

Name:	cancelorder.jpg
Views:	123
Size:	94.5 KB
ID:	1116129

    #2
    Hello CoffeeOutlaw,

    The isLiveUntilCancelled parameter should be true for the order to remain live until it is cancelled or filled. When false the order will automatically cancel when the submission bar closes.


    I also recommend calling set methods before placing the entry order (as these cannot be unset).
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea, I still am having no luck getting these orders to cancel even when I load up the sample strategy "Sample Cancel Order" the orders still don't cancel. from looking at that code it seems that it should cancel the order named "Long Limit Entry" after 3 bars and replace it with one called "market order" but looking back thru a lot of past data with that script I have zero "market orders" and all my filled orders are the "long limit entry" it seems that nothing I can do even running the sample scripts will make it cancel an order

      Comment


        #4
        Hello CoffeeOutlaw,

        Are you referring to this reference sample in the help guide?


        Are you looking at the Strategy Performance window for Historical & Real-time on the Orders display and confirming no orders are cancelled? (This cancels the entry if not filled in 3 bars)

        I've tested on my end and I am seeing tons of cancelled orders.
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Brevo, Today, 01:45 AM
        0 responses
        3 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        3 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        239 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        6 views
        0 likes
        Last Post oviejo
        by oviejo
         
        Working...
        X