Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with donchian breakout alert

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

    Problem with donchian breakout alert

    Hi guys,

    i have a problem with donchian breakout alert.

    I want to have a alert which screens the instruments in my market analyzer for positions which breakout/touch the upper/lower donchian channel lines.

    Since i don't find any solution to this problem i tried to code something in the strategy wizard.
    This code should set an alert if the upper donchian channel line was touched.

    My code looks like this:

    {

    CalculateOnBarClose = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (Close[0] >= DonchianChannel(20).Upper[0])
    {
    Alert("MyAlert820", Priority.High, "test", "", 0, Color.White, Color.Black);
    }



    ...and it doesn't work.

    Best solution would be to set a different color for the position in the market analyzer if the position was touch the upper/lower donchian channel line.(20 days and 20 weeks channel)

    Is this possible?


    Thanks Chris

    #2
    Hello christoph_schober,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    I have tested your code inside an indicator and it works as expected. I used a Session Template of Default 24/7 in the Market Analyzer (right click > Properties > Session Template) and connected to the Simulated Data Feed to drive the markets up to the required levels (File > Connect > Simulated Data Feed).

    I have attached the indicator I used to this response so you may try it out on your end. You can import the indicator by first downloading the .Zip archive and then going to File > Utilities > Import NinjaScript > select the file > Open.
    Attached Files

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    36 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    23 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    162 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    96 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    152 views
    2 likes
    Last Post CaptainJack  
    Working...
    X