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 bmartz, Today, 09:30 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by geddyisodin, Today, 05:20 AM
        3 responses
        20 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by lorem, Today, 09:18 AM
        1 response
        5 views
        0 likes
        Last Post lorem
        by lorem
         
        Started by GussJ, 03-04-2020, 03:11 PM
        14 responses
        3,245 views
        0 likes
        Last Post GussJ
        by GussJ
         
        Started by ArkansasClint, Today, 09:28 AM
        0 responses
        4 views
        0 likes
        Last Post ArkansasClint  
        Working...
        X