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 CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    52 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    29 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    194 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    355 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    274 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X