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 fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,404 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by Shai Samuel, 07-02-2022, 02:46 PM
    4 responses
    95 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Started by DJ888, Yesterday, 10:57 PM
    0 responses
    8 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    159 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Yesterday, 09:29 PM
    0 responses
    8 views
    0 likes
    Last Post Belfortbucks  
    Working...
    X