Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 JoMoon2024, Today, 06:56 AM
    0 responses
    2 views
    0 likes
    Last Post JoMoon2024  
    Started by Haiasi, 04-25-2024, 06:53 PM
    2 responses
    17 views
    0 likes
    Last Post Massinisa  
    Started by Creamers, Today, 05:32 AM
    0 responses
    5 views
    0 likes
    Last Post Creamers  
    Started by Segwin, 05-07-2018, 02:15 PM
    12 responses
    1,786 views
    0 likes
    Last Post Leafcutter  
    Started by poplagelu, Today, 05:00 AM
    0 responses
    3 views
    0 likes
    Last Post poplagelu  
    Working...
    X