NexusFi: Find Your Edge


Home Menu

 





IOrder.AvgFillPrice


Discussion in NinjaTrader

Updated
    1. trending_up 1,376 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 0 attachments




 
Search this Thread

IOrder.AvgFillPrice

  #1 (permalink)
 manev31 
Switzerland
 
Experience: Intermediate
Platform: Tradestation, Python
Trading: Forex
Posts: 12 since Aug 2014
Thanks Given: 2
Thanks Received: 1

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)
Print(entryOrder.AvgFillPrice.ToString());



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)
Print(entryOrder.AvgFillPrice.ToString());


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");
}
}

}

Started this thread Reply With Quote




Last Updated on September 3, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts