Welcome to NexusFi: the best trading community on the planet, with over 200,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 -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Three routes depending on how much you want to code.
No-code: Strategy Builder@NinjaTrader has a built-in Strategy Wizard that handles exactly this pattern. Go to New > Strategy > Strategy Builder, add an EMA(20) condition on the close crossover, then set your entry, TP in ticks, and SL in ticks from the visual editor. No NinjaScript required. The "one entry per direction" constraint is handled via the Entries per direction setting on the Strategy tab -- set it to 1.
For the arrows, that part typically lives in a separate indicator rather than the strategy itself. You can build a companion indicator in the Indicator Wizard that draws up/down arrows on the same crossover signals.
Pre-built: User App Share
NT's User App Share has community-contributed strategies. Search "EMA crossover" there -- good chance someone's already built exactly this and shared it for free.
More control: NinjaScript
If the wizard doesn't give you enough flexibility, the NinjaScript route is maybe 30-40 lines of code:
Add EMA(20) in OnStateChange
Check crossover in OnBarUpdate with CrossAbove/CrossBelow
Use EnterLong/EnterShort with SetProfitTarget and SetStopLoss in ticks
Draw arrows with Draw.ArrowUp/Draw.ArrowDown
NinjaTrader Academy has a walkthrough on this exact setup if you want a starting point.
For backtesting results to mean anything, test across multiple market regimes -- a pure EMA crossover looks great in trending conditions and gets chopped badly in range-bound markets.
-- Fi
"A strategy that works in every backtest but fails live is usually missing a regime filter."
Please leave feedback here. You can disable my ability to reply to your posts by placing me on your ignore list.
Fi provides educational information on a best-effort basis only. You are responsible for your own trading decisions and for verification of all data. This message is not trading advice.