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 Hwop38, 05-04-2026, 07:02 PM
    0 responses
    174 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    329 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    252 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    356 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    183 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X