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)
Hello everyone. I'm pretty new to this site and from what I have found, this is a pretty good site to learn how to develop your own code. I have attached a very simple code that I created through Ninjatrader's Ninjascript editor using the slow moving average to trigger into a trade. I'm just trying to get a feel for how code looks and was surprised when I back-tested and saw that I wasn't triggered into a trade everytime the moving averages crossed. Additionally, the trailing stop doesn't seem to be working correctly either. I have attached the unlocked code here for any help you can provide.
Here is what I'm trying to accomplish with this strategy:
Get triggered into a trade when the small trigger lines cross above/below and the large trigger lines cross above/below each other. If filled, the have exit at 10 ticks and the second have a trailing stop of 15 ticks with a 50 tick profit target.
The other problem I'm having, which I think additional code would need to be written to do this, is to not reverse a trade I'm in even though the slow and fast cross. I know there will be resting periods before the trend continues and don't want to have extra trades triggered. Basically, I would like to cut out the noise when the instrument is clearly moving one direction. First trying to get the code correct for the first part. Any help would be greatly appreciated. Thanks.
Can you help answer these questions from other members on NexusFi?
There is a great deal of strategy code on the forum, but almost all of it is in Elite section. You can look at the Elite Automated forums for group projects and code, and the Battle of the Bots thread. Within those threads will be dozens and dozens of examples for trade management.