So I'm trying to build a strategy with two MA's, lets say these are the 10MA & 20MA, I got my strategy to buy it when they cross and now I want my strategy to automatically take profit when the 5MA crosses the 20MA. How would I code this because it uses a different MA to close the position?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Close position when two moving averages crossing
Collapse
X
-
Close position when two moving averages crossing
Hi all,
So I'm trying to build a strategy with two MA's, lets say these are the 10MA & 20MA, I got my strategy to buy it when they cross and now I want my strategy to automatically take profit when the 5MA crosses the 20MA. How would I code this because it uses a different MA to close the position?Tags: None
-
Hello Lotyok,
Thanks for your reply.
Great question!
The stops and profits window in the Strategy Builder would be for fixed value exits only, such as a profit or stop of say 10 ticks, or $300, or 5% and these would be applied to every entry.
In your case, you are wanting a dynamic exit based on the changing conditions of two moving averages. So you would need to use a set with the conditions of the moving averages cross and in the actions under Order management> select an appropriate exit method such as exitLong() or exitShort().
If you have not already reviewed, here are the resources to help with the Strategy Builder:
Here are the educational resource available on the strategy builder:
Free live webinar every other Thursday at 4:00 PM EST, through this link to all webinars: https://ninjatrader.com/PlatformTraining
Previous recording of the Strategy Builder 301 webinar: https://youtu.be/HCyt90GAs9k?list=PL...auWXkWe0Nf&t=2
Help guide for the strategy builder: https://ninjatrader.com/support/help...gy_builder.htmPaul H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by DJ888, 04-16-2024, 06:09 PM
|
6 responses
18 views
0 likes
|
Last Post
by DJ888
Today, 05:12 PM
|
||
Started by Jon17, Today, 04:33 PM
|
0 responses
1 view
0 likes
|
Last Post
by Jon17
Today, 04:33 PM
|
||
Started by Javierw.ok, Today, 04:12 PM
|
0 responses
6 views
0 likes
|
Last Post
by Javierw.ok
Today, 04:12 PM
|
||
Started by timmbbo, Today, 08:59 AM
|
2 responses
10 views
0 likes
|
Last Post
by bltdavid
Today, 04:10 PM
|
||
Started by alifarahani, Today, 09:40 AM
|
6 responses
41 views
0 likes
|
Last Post
by alifarahani
Today, 03:18 PM
|
Comment