Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help Adding Exit Condition Based on Moving Average

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help Adding Exit Condition Based on Moving Average

    I’ve developed a NinjaTrader strategy that successfully handles entry conditions for futures trading. However, I would like to enhance it by adding an exit condition based on the color change of a moving average, which reflects market direction.

    Here’s what I’m looking for:

    - **For Long Trades**: Exit the position when the moving average changes from green (bullish) to red (bearish).
    - **For Short Trades**: Exit the position when the moving average changes from red (bearish) to green (bullish).

    I’m using a colored moving average to visually represent the market trend. I would like the strategy to automatically close the trade once the color indicates a trend reversal. I assume I’ll need to reference the moving average’s color property within the strategy code to trigger the exit, but I’m not sure how to do this efficiently.

    Could someone assist me in implementing this logic or point me to relevant resources that would help integrate this exit condition into my existing strategy?
    Thank you!


    #2
    Hello NasdaqAnalytica,

    You would need to come up with a price condition for that, colors cannot be used for strategy signals.

    Once you have identified the values you want to use for the exit condition based on the indicators price you could add new sets to submit exit orders based on those conditions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    111 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    59 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    38 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    41 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    78 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X