﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>RightEdge Forums / General / General Discussion  / Fill on the same bar close not working for me... / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>RightEdge Forums</description><link>http://www.rightedgesystems.com/forums/</link><webMaster>rightedge@yyesoftware.com</webMaster><lastBuildDate>Wed, 08 Feb 2012 15:45:06 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Fill on the same bar close not working for me...</title><link>http://www.rightedgesystems.com/forums/Topic11145-7-1.aspx</link><description>Is there an example out there on how to correctly execute a MarketOnClose order on the same bar that the position is opened.&lt;br&gt;Currently I put my order in and when I get filled I add the marketOnClose order. &lt;br&gt;However, this is closing the position on the next days open.&lt;br&gt;[quote]&lt;br&gt;public override void OrderFilled(Position position, Trade trade)&lt;br&gt;	{&lt;br&gt;			if (position.State == PositionState.Open) {&lt;br&gt;		&lt;br&gt;			 OrderSettings o = new OrderSettings();&lt;br&gt;     		        o.OrderType = OrderType.MarketOnClose;&lt;br&gt;			 o.Size = position.CurrentSize;&lt;br&gt;			 position.SubmitOrder(o);&lt;br&gt;				 &lt;br&gt;				}&lt;br&gt;&lt;br&gt;	}&lt;br&gt;&lt;br&gt;[/quote]&lt;br&gt;&lt;br&gt;&lt;br&gt;</description><pubDate>Mon, 15 Aug 2011 09:53:37 GMT</pubDate><dc:creator>gregoryj</dc:creator></item><item><title>RE: Fill on the same bar close not working for me...</title><link>http://www.rightedgesystems.com/forums/Topic11145-7-1.aspx</link><description>There was a bug in the BarClosing logic which caused the whole bar to be reprocessed, instead of just the closing price. This would mean market orders would be filled at the open price instead of the close price. This will be fixed in the next build.&lt;br&gt;&lt;br&gt;Thanks for bringing this to our attention,&lt;br&gt;Daniel</description><pubDate>Wed, 24 Mar 2010 00:37:31 GMT</pubDate><dc:creator>dplaisted</dc:creator></item><item><title>RE: Fill on the same bar close not working for me...</title><link>http://www.rightedgesystems.com/forums/Topic11145-7-1.aspx</link><description>any update on this?&lt;br&gt;</description><pubDate>Tue, 23 Mar 2010 11:03:52 GMT</pubDate><dc:creator>bbmat173</dc:creator></item><item><title>RE: Fill on the same bar close not working for me...</title><link>http://www.rightedgesystems.com/forums/Topic11145-7-1.aspx</link><description>Per your previous thread, we're looking into this.  Stand by.</description><pubDate>Fri, 12 Mar 2010 09:04:43 GMT</pubDate><dc:creator>billb</dc:creator></item><item><title>Fill on the same bar close not working for me...</title><link>http://www.rightedgesystems.com/forums/Topic11145-7-1.aspx</link><description>Hello, &lt;br&gt;&lt;br&gt;I want to simulate fills on the close of the same bars on which a position is sent for execution in the RE paper trader. I looked at all the other threads that treated this issue, implemented the code and suggestions but still dont seem to be able to get where I want to. I use daily bar data and daily system frequency. I simply like to get the price on the fill of the same bar when the order was executed due to a signal that was triggered on the very same bar. With below code I get filled on the open of that bar which is very strange and would definitely mean I am forward looking. I just want to get filled on the close of the same bar as the signal and execution for both, new open and closing orders.&lt;br&gt;&lt;br&gt;Could you please have a look and suggest what I may be doing wrong?&lt;br&gt;&lt;br&gt;thanks a lot&lt;br&gt;Brian&lt;br&gt;&lt;br&gt;SYSTEM CLASS:&lt;br&gt;&lt;br&gt;public override void Startup()&lt;br&gt;{&lt;br&gt;SystemData.CreateTicksFromBars = true;&lt;br&gt;SystemData.EnableTradeOnClose = true;&lt;br&gt;SystemData.BarClosing += BarClosing;&lt;br&gt;}&lt;br&gt;&lt;br&gt;public void BarClosing(object sender, NewBarEventArgs args)&lt;br&gt;{&lt;br&gt;foreach (Symbol symbol in args.Symbols)&lt;br&gt;{&lt;br&gt;SymbolScripts[symbol].BarClosing();&lt;br&gt;}&lt;br&gt;}&lt;br&gt;&lt;br&gt;SYMBOL CLASS:&lt;br&gt;&lt;br&gt;public void BarClosing()&lt;br&gt;{&lt;br&gt;//Trade Entries&lt;br&gt;TradeExecution.TradeEntry(SystemData, settings, Symbol, Bars, positionList);&lt;br&gt;}&lt;br&gt;&lt;br&gt;Trade Entry is a function within I send a market order.</description><pubDate>Fri, 12 Mar 2010 00:23:53 GMT</pubDate><dc:creator>bbmat173</dc:creator></item></channel></rss>
