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)
Hi guys, I'd like to implement stop close only order in ninjatrader and was wondering if anyone has done this already and would care to share a few bits of code/info. I'm new to ninjatrader and the only sensible way I could think of is to implement a variable which tracks the stop and in OnBarUpdate() if the close falls below (for long positions) and above (for short positions) exit the position immediately. I know there is probably a better way of doing this with perhaps simulated stops. Does anyone have any experience with this?
Please help !
Thanks in advance.
Can you help answer these questions from other members on NexusFi?
Seems to me if you have CalculateOnBarClose = true, such as in Initialize(), then you can simply just refer to the prior close to meet your criteria. Take a look at some of the sample strategies, but I'm thinking something like below should work, obviously do some paper trades before trying anything live.
Thanks deefster. It makes sense now. I incorporated your suggestions into Ninjatrader's SampleOnOrderUpdate strategy so as to create a strategy which initially uses a stop close only order.
I've attached it so you or others can use/modify at their leisure. You are welcome to give any suggestions for improvement as you see fit.