View Full Version : What I'm doing wrong? On Reverse...
cicondo
07-22-2009, 01:48 AM
Hi support...
I'm a little bit confused of what's going wrong with my test implementation.
I develop a strategy which places a limit order and wait than for the fill. If the fill isn't triggered and the reverse signal is rising everything works well. But if I was filled, there will be only close the current position, canceling the attached sto/target, but the new limit order will not be placed....
See attachements for further informations
many thanks
cicondo
NinjaTrader_Bertrand
07-22-2009, 05:28 AM
cicondo, from the traces output you're not running into ignored orders (Internal Order Handling Rules), so I would suggest to simplify your code to debug where it does not work to place the reveral for you. For example what I spot is when you're long and recognizing a short entry, you work with ExitShort(), where you should work with EnterShort() to reverse the position.
cicondo
07-23-2009, 03:18 AM
Hi Bertrand,
thank'S a lot of you ideas. I have found the bug, so it works pefect with limt and market orders and a free choice of targets.
I must say it is hard to find out what's going wrong in a realtime system in combination with threaded callbacks...
But now I know excatly what it is doing the correct way...
Many, many thanks.
cicondo
PS: The core problem is that it is an other kind of stuff to write a stretegy for your own use, instead for paying customers. this needs a much more robust coding.
By the way...if there is something wrong by placing an order, get I informed by a try/catch clause?
cicondo, from the traces output you're not running into ignored orders (Internal Order Handling Rules), so I would suggest to simplify your code to debug where it does not work to place the reveral for you. For example what I spot is when you're long and recognizing a short entry, you work with ExitShort(), where you should work with EnterShort() to reverse the position.
NinjaTrader_Bertrand
07-23-2009, 04:06 AM
cicondo, you're welcome - for debugging your order behavior the TraceOrders feature would do it.
For a better debugging environment, please see this link - http://www.ninjatrader-support.com/HelpGuideV6/VisualStudio.html
For a reference sample on 'Try and Catch' blocks, please see this one - http://www.ninjatrader-support2.com/vb/showthread.php?t=9825
cicondo
07-23-2009, 04:36 AM
:D
Thank's
For the Try/Catch...I asked for was not the concept of using this feature, it was more in handling with ordering problem. Is there any effect to use it for the ordering process? Means if there is something wrong throws the ordersystem an exception?
And thanks again
cicondo
cicondo, you're welcome - for debugging your order behavior the TraceOrders feature would do it.
For a better debugging environment, please see this link - http://www.ninjatrader-support.com/HelpGuideV6/VisualStudio.html
For a reference sample on 'Try and Catch' blocks, please see this one - http://www.ninjatrader-support2.com/vb/showthread.php?t=9825
NinjaTrader_Bertrand
07-23-2009, 05:42 AM
cicondo, no this is related to debugging your code - for debugging your order behavior and feedback you get from those, please work with TraceOrders and the output window -
http://www.ninjatrader-support2.com/vb/showthread.php?t=3627