Saturday, February 20, 2010

Boobs Old Indian Actress

NinjaTrader specific order-handling methods

would like in this article of this series I like to go on methods of NinjaTrader that Event -controlled are called by the NT API when processing an order. Specifically, these are the methods ...
  • OnExecution ( IExecution execution )
  • OnPositionUpdate ( IPosition position )
  • OnOrderUpdate ( IORD order )
The methods Initialize () and OnBarUpdate () I will not explain. This should be a standard component of any strategy. Interesting at this point is perhaps that I mean Entries and Exits have outsourced their own methods to make the code more readable and maintainable . Both methods are in accordance with the conditions, if a signal is present or already Trade was received calls from OnBarUpdate () out.

But back to the event methods that I have overridden in any strategy to implement the strategies of my own needs better. I will again the crucial post code and if necessary add more explanations:















OnExecution
is the main method if I Stops or would like to set limits . Only here I can be 100% pure be sure that the order was executed. What is the position I find out about execution.Order.Filled , as even a partial - Fill is treated with. Accordingly, I must object in order . Check Since I consider myself to each order an appropriate Order object in the code, these tests are rather trivial. In NinjTrader Help Guide or in the forum, there are other examples of this.












here can be reset or initialized variables accordingly after each position change . Thus, here, for example, be quite simply a change of Entries . I would like for a long act signal only Short , I can here in Long -case bool ' Scheme variable prove true and the corresponding Short variable with false . The opposite case is analogous. Output as little 'treats', I leave my current position here still Chart as text string with .



























This, perhaps the most interesting and probably most important method is to pay very much attention. I must admit, I initially I simply ignored until repeated errors in my Stops and Limits occurred and unwanted orders were issued. Why was that? Well, if I go with my own Exit triggers per Market -Order from the Trade , but in addition Stop - Orders activated in the market have, I have to cancel this first . I can hammer out is indeed about CancelOrder ( IORD ) using the API, but if and when my Stop order canceled really, I only know when I put it in OnOrderUpdate check. Only when the test was successful (see commented code), I really should go out by Market order. I usually notice it, and my strategy will work without the above implementation. However, I had occasionally the case that I had run in fast phases of the market TimedExit and then stop by my order was back in the opposite direction in the market. This is rare but leads to undesirable results.


Furthermore, I can OnOrderUpdate another Rejection - handling for orders install, to but more in general merchandise.

Best regards
darth trader

0 comments:

Post a Comment