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

Add-on Profit Target order not filled

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

    Add-on Profit Target order not filled

    Hi

    I've created an button to buy at market and when filled, placed an OCO stop and target order. Here is the code that I use to place these orders in the OnExecutionUpdate event after the Buy order is filled.

    stopOrder = account.CreateOrder(Instrument, OrderAction.Sell, OrderType.StopMarket, OrderEntry.Manual, TimeInForce.Day, e.Quantity, 0, e.Price - stopTicks * TickSize, e.ExecutionId, stop1Name, new DateTime(), null);

    profitOrder1 = account.CreateOrder(Instrument, OrderAction.Sell, OrderType.Limit, OrderEntry.Manual, TimeInForce.Day, e.Quantity, e.Price + pt1Ticks * TickSize, 0, e.ExecutionId, profit1Name, new DateTime(), null);

    Print("Submit Stop");
    account.Submit(new Order[] { stopOrder} );
    Print("Submit Profit");
    account.Submit(new Order[] { profitOrder1} );​​
    The issue is that both orders stay in "Accepted Status" and the Profit Target is not filled when price trade through it. See the screenprint from the orders page attached.

    When I use the "Buy Mkt" button from Chart Trader with ATM Strategy, the Profit Target go to status "Working" and is filled when price trade through it. See the screenprint for that as well.

    I am currently testing both on Playback.

    Why doesn't the limit order from my Add-on go to Working Status? Do I need to submit the orders differently?

    Attached Files

    #2
    Hello sevensa,

    Thanks for your post.

    Please create a simple reduced test script with debugging prints that reproduces the behavior you are reporting and share that test script with us along with the exact steps and settings you are using to reproduce the behavior so we may look into this matter further.

    Note that a reduced copy refers to a copy of the script that contains the minimum amount of code needed to reproduce the issue. All other code is commented out or removed.

    To create a copy of your script to modify, open a New > NinjaScript Editor, select your script, right-click in the Editor, select 'Save as', name the script, and click OK.

    To export the script go to Tools > Export > NinjaScript AddOn.

    Exporting: https://ninjatrader.com/support/help...tAsSourceFiles
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ETFVoyageur, Today, 02:04 PM
    3 responses
    21 views
    0 likes
    Last Post ETFVoyageur  
    Started by cre8able, Today, 06:18 PM
    0 responses
    5 views
    0 likes
    Last Post cre8able  
    Started by ETFVoyageur, Today, 06:05 PM
    0 responses
    3 views
    0 likes
    Last Post ETFVoyageur  
    Started by TAJTrades, 04-28-2024, 09:46 AM
    2 responses
    17 views
    0 likes
    Last Post TAJTrades  
    Started by mjbatts91, Today, 04:48 PM
    0 responses
    7 views
    0 likes
    Last Post mjbatts91  
    Working...
    X