Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

doubt in AvgFillPrice..????

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

    doubt in AvgFillPrice..????

    hi i have one doubt
    #region Variables
    private IOrder entryOrder = null;

    protected override void OnBarUpdate()
    {
    .....
    ...
    ....

    if( entryOrder == null && c <= b)

    {
    entryOrder = EnterLong();

    Print("a=" + entryOrder.AvgFillPrice);

    }

    everything flows correctly and executes but

    for a= entryOrder.AvgFillPrice as i mention in print commd .. its not printing the value just printing 0 y its not printing the price value

    #2
    Are you running the strategy in CaclualteOnBarClose false or true?

    There may be a bit of a delay in getting the AvgFillPrice after your entry order is executed depending on when OBU() is called.

    With that known, you may want to start checking for this variable in the OnExecution() event handler which will be updated every time there is an execution detected:

    MatthewNinjaTrader Product Management

    Comment


      #3
      Are you running the strategy in CaclualteOnBarClose false or true?
      yes im using CaclualteOnBarClose true

      protected override void OnExecution(IExecution execution)
      i didnt add this part in my program shld i have to add this

      Comment


        #4
        Originally posted by DealI View Post
        hi i have one doubt
        #region Variables
        private IOrder entryOrder = null;

        protected override void OnBarUpdate()
        {
        .....
        ...
        ....

        if( entryOrder == null && c <= b)

        {
        entryOrder = EnterLong();

        Print("a=" + entryOrder.AvgFillPrice);

        }

        everything flows correctly and executes but

        for a= entryOrder.AvgFillPrice as i mention in print commd .. its not printing the value just printing 0 y its not printing the price value
        At the time that the Print statement is executed, immediately after the entry, the order is unlikely to have been filled, so the AvgFillPrice would be zero.

        You probably want to check this when you have a position, so check for that first.

        Code:
        if (Position.MarketPosition != MarketPosition.Flat)
        {
        //do stuff here;
        }

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X