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, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    47 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X