Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
NT doesnt have a supported option for Market/Limit If Touched orders, and looking at the threads online I did find little to go on. Basically I am trying to get the same fill I get with market orders, but at a price that is closer to targets I would use in limit orders.
This is a work in progress== I am trying to shift the order entry from OnBarUpdate to OnMarketData but am not sure if I am interpreting the intent/use correctly.
Guru response definitely appreciated,
Jon
Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
Can you help answer these questions from other members on NexusFi?
The intent is that you look at the price every tick, with OnMarketData. So you are constantly looking at the price so that it gives you a lot of flexibility in order management.
I am, I think, so ingrained in 'OnBarUpdate' mindset that I am having a conceptual challenge on how that will integrate together (with OnMarketData) to manage the trade.
For example, this is typically what my strategy orders from
and I am starting to think in this fashion to move the ordering into
with the OnBarUpdate just manages the indicators and conditions that go along with that
...
but my gut says that this is too simplistic and I am missing an element to have it function correctly. Input from your experience is definitely appreciated.
Jon
Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
It is a good start but I would leave the above code for BarUpdate. You just need the parts that need to be in OnMarketData as small as possible. ( And it doesn't need to be there ).
OnBarUpdate DOES just manages the indicators and anything that has High[0], etc needs to be in there.
It is not as difficult as people think. I have been using limit with touch orders in my strats for a couple of years and trading live everyday for a while and they work nicely.
It is not as difficult as people think. I have been using limit with touch orders in my strats for a couple of years and trading live everyday for a while and they work nicely.
traderwerks,
Again, thanks for the share..
Just to clarify then, to sync my head, and nothing code specific ..
It really doesnt matter what chart type/period is being used, and you are using the normal(?!) available EnterLongStopLimit() with (I guess) true bool condition (because I am thinking on adding a cancel order if not filled in 2 bars etc). For some reason my feeling was there might be different Enter() commands only useable inside OnMarketData, but cant find any in the help
This has been REALLY helpful!
Thanks
Jon
Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
It really doesnt matter what chart type/period is being used, and you are using the normal(?!) available EnterLongStopLimit() with (I guess) true bool condition (because I am thinking on adding a cancel order if not filled in 2 bars etc).
Well, you are mostly correct. It would be a EnterLongLimit order. No sense in putting a stop orde r in OnMarketData.
Trader.Jon
For some reason my feeling was there might be different Enter() commands only useable inside OnMarketData, but cant find any in the help
OnMarketData is just like OnBarUpdate, only it happens a lot more often ( usually ). So anything you can use in OnBarUpdate, you can use in OnMarketData.
OnMarketData is just like OnBarUpdate, only it happens a lot more often ( usually ). So anything you can use in OnBarUpdate, you can use in OnMarketData.
traderwerks,
With your (much appreciated) assistance I was able to get an order placed and covered in a strategy, running parallel to orders placed with OnBarUpdate. I didnt change any of the entry handling code: just moved to code as suggested
#region Region_OnMarketData
//
protected override void OnMarketData(MarketDataEventArgs e)
{
//Update bid / ask / spread variables
UpdateBidAskSpread(out cAsk, out cBid, out cSpread);
if ( e.Price == touch_price )
{ Print("Last = "+e.Price);
if ((iOrderL1 == null || Historical) && iQuantity1 != 0)
{ iOrderL1 = EnterLongLimit(0, true, iQuantity1, Closes[0][0] + 1*TickSize, sENTRY1L);
LL_EntryBar0_OMD_L1 = CurrentBars[0];
Print("Entered LL_Order from OnMarketData PreviousBar#= "+CurrentBars[0]+", Time of bar= "+Times[0][0]+", bar closed "+Closes[0][0]+", BarHI= "+Highs[0][0]+", BarLO= "+Lows[0][0]);
}
}
}
Prints show me behaviour I expected, plus some I didnt. The orders in OnBarUpdate are only submitted once,
The 'entries per direction' is set to 1 so the orders are not sent out, but it is still bothersome that the order handling isnt working the same.
From the output:
Last = 1.404
3/28/2011 7:45:55 AM Entered internal PlaceOrder() method at 3/28/2011 7:45:55 AM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=1.4041 StopPrice=0 SignalName='e1L' FromEntrySignal=''
3/28/2011 7:45:55 AM Ignored PlaceOrder() method at 3/28/2011 7:45:55 AM: Action=Buy OrderType=Limit Quantity=1 LimitPrice=1.4041 StopPrice=0 SignalName='e1L' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'
Entered LL_Order from OnMarketData PreviousBar#= 653, Time of bar= 3/28/2011 7:45:52 AM, bar closed 1.404, BarHI= 1.4052, BarLO= 1.404
Last = 1.404
3/28/2011 7:45:55 AM Entered internal PlaceOrder() method at 3/28/2011 7:45:55 AM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=1.4041 StopPrice=0 SignalName='e1L' FromEntrySignal=''
3/28/2011 7:45:55 AM Ignored PlaceOrder() method at 3/28/2011 7:45:55 AM: Action=Buy OrderType=Limit Quantity=1 LimitPrice=1.4041 StopPrice=0 SignalName='e1L' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'
Entered LL_Order from OnMarketData PreviousBar#= 653, Time of bar= 3/28/2011 7:45:52 AM, bar closed 1.404, BarHI= 1.4052, BarLO= 1.404
Last = 1.404
3/28/2011 7:45:56 AM Entered internal PlaceOrder() method at 3/28/2011 7:45:56 AM: BarsInProgress=0 Action=Buy OrderType=Limit Quantity=1 LimitPrice=1.4041 StopPrice=0 SignalName='e1L' FromEntrySignal=''
3/28/2011 7:45:56 AM Ignored PlaceOrder() method at 3/28/2011 7:45:56 AM: Action=Buy OrderType=Limit Quantity=1 LimitPrice=1.4041 StopPrice=0 SignalName='e1L' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'
Entered LL_Order from OnMarketData PreviousBar#= 653, Time of bar= 3/28/2011 7:45:52 AM, bar closed 1.404, BarHI= 1.4052, BarLO= 1.404
Last = 1.404
Any thoughts or suggestions?
Jon
Followup: Even though the 1L long entry from OnMarketData was stopped out, the print is still showing entry price would be 1.404. The next bar closed 1.4030 and was a trigger bar for a market order L2 that was completed, but the e.Price still printing out at 1.4040
Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
After you place your order, reset your touch price or whatever so you don't get any more orders. The order will be cancelled at the end of the bar.
I think thats probably the only thing I havent tried yet
It is annoying that I am still restricted by bar updates (in a way)
Thanks,
Jon
Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!