• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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
    Patrick H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mike661, Today, 07:22 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_PatrickG  
    Started by memonolog, Today, 07:56 AM
    0 responses
    3 views
    0 likes
    Last Post memonolog  
    Started by tdawson11, Today, 07:48 AM
    0 responses
    3 views
    0 likes
    Last Post tdawson11  
    Started by pstrusi, Today, 07:39 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Jim  
    Started by vantojo, 06-19-2019, 04:06 PM
    6 responses
    34 views
    0 likes
    Last Post vantojo
    by vantojo
     
    Working...
    X