IOrder.AvgFillPrice - NinjaTrader Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming

Started:September 3rd, 2014 (05:43 PM) by manev31 Views / Replies:404 / 0
Last Reply:September 3rd, 2014 (05:43 PM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread


Old September 3rd, 2014, 05:43 PM   #1 (permalink)
Elite Member
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex
Posts: 8 since Aug 2014
Thanks: 1 given, 1 received


Can someone please tell me why am I not geting any print in the output window of the following command:

if (Position.MarketPosition == MarketPosition.Long && entryOrder != null)

this is the whole context:

protected override void Initialize()
CalculateOnBarClose = true;

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
// Submit an entry limit order if we currently don't have an entry order open
if (entryOrder == null && CurrentDayOHL().CurrentOpen[0] > PriorDayOHLC().PriorHigh[0] && ToTime(Time[0]) > ToTime(8, 30, 0) && ToTime(Time[0]) < ToTime(8, 46, 0))
/* The entryOrder object will take on a unique ID from our EnterLong()
that we can use later for order identification purposes in the OnOrderUpdate() method. */
entryOrder = EnterLong(1, "MyEntry");


/* If we have a long position and the current price is 4 ticks in profit, raise the stop-loss order to breakeven.
We use (7 * (TickSize / 2)) to denote 4 ticks because of potential precision issues with doubles. Under certain
conditions (4 * TickSize) could end up being 3.9999 instead of 4 if the TickSize was 1. Using our method of determining
4 ticks helps cope with the precision issue if it does arise. */

if (Position.MarketPosition == MarketPosition.Long && entryOrder != null)

if (Position.MarketPosition == MarketPosition.Long && entryOrder !=null && (Close[0] >= entryOrder.AvgFillPrice + (80 * (TickSize / 2))))
// Checks to see if our Stop Order has been submitted already
if (stopOrder != null && stopOrder.StopPrice < entryOrder.AvgFillPrice)
// Modifies stop-loss to breakeven
stopOrder = ExitLongStop(0, true, stopOrder.Quantity, entryOrder.AvgFillPrice, "MyStop", "MyEntry");


Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > IOrder.AvgFillPrice

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

All times are GMT -4. The time now is 09:10 PM.

Copyright © 2016 by All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts

Page generated 2016-10-26 in 0.06 seconds with 18 queries on phoenix via your IP