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

Is AverageFillPrice available after EnterLong?

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

    Is AverageFillPrice available after EnterLong?

    I'm entering at market with a price-based stoploss. I want to scalp out one contract at 1:1 R/R.

    If I EnterLong and hold an order reference, e.g.:

    var order = EnterLong();

    am I able to immediately access the order.AverageFillPrice property? Or will this be unavailable until the OnOrderUpdate callback?

    This is roughly what I want to do:

    Code:
    var stopPrice = DonchianChannel(3).Lower[0];
    var scalpEntry = EnterLong(1, "Scalp");
    var entryPrice = scalpEntry.AverageFillPrice; // is this value guaranteed to be available at this point?
    var target = entryPrice + Math.Abs(entryPrice - stopPrice);
    SetProfitTarget("Scalp", CalculationMode.Price, target, false);

    #2
    Hello kevinenergy,

    Thanks for the post.

    As long as the Order object is not null it will hold information on the order. It would be recommended to wait for OnOrderUpdate to get any information from the Order object. The order will appear instantly with the Sim101 account, but that behavior could vary while trading live.

    Please let me know if I can assist further.
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by elderan, Today, 08:03 PM
    0 responses
    2 views
    0 likes
    Last Post elderan
    by elderan
     
    Started by algospoke, Today, 06:40 PM
    0 responses
    10 views
    0 likes
    Last Post algospoke  
    Started by maybeimnotrader, Today, 05:46 PM
    0 responses
    9 views
    0 likes
    Last Post maybeimnotrader  
    Started by quantismo, Today, 05:13 PM
    0 responses
    7 views
    0 likes
    Last Post quantismo  
    Started by AttiM, 02-14-2024, 05:20 PM
    8 responses
    169 views
    0 likes
    Last Post jeronymite  
    Working...
    X