Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is there code to bring chart to front?

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

  • NinjaTrader_ChelseaB
    replied
    Hello arbuthnot,

    I am not aware of any supported or unsupported methods of controlling the chart range or scale.

    However, this thread will remain open for any community members that would like to assist.

    Leave a comment:


  • arbuthnot
    replied
    Hi again

    I don't think there's going to be a solution to this (and I know the basic method is officially unsupported anyway) but is there a line I could add to the code so that when the chart in question is brought to the front using BringToFront, the chart is automatically brought to the right so the 'current action' is necessarily visible?

    Thanks again in advance.

    Leave a comment:


  • arbuthnot
    replied
    Thanks to you also, Patrick.

    I'd worked out the solution just before you posted.

    Now I know!

    Cheers.

    Leave a comment:


  • arbuthnot
    replied
    Originally posted by sledge View Post
    Did you add to the using section as mentioned below?
    Thanks very much, sledge.

    I've edited my original reply as now see what you mean by then using section and I know why I didn't find it because it wasn't expanded.

    Sorry, I've never altered anything in this section before so please excuse a newbie in this advanced type of coding.

    I'm sure it'll work now.
    Last edited by arbuthnot; 07-17-2015, 09:07 AM.

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello arbuthnot,

    Sledge is referring to the following at the top of Chelsea's code:
    Code:
    #region Using declarations
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Gui.Chart;
    
    using System.Collections.Generic;
    using System.Windows.Forms;
    #endregion

    Leave a comment:


  • sledge
    replied
    Originally posted by arbuthnot View Post
    Hi

    I'm coming back to this thread after a couple of years as I'm only now applying this for the first time.

    Also to say that I know this is not officially supported but if anyone could give me a pointer, I'd be very grateful.

    In post #2 of this thread, Chelsea kindly attached a sample indicator. I've adapted this slightly in another indicator as follows to test it:

    Code:
    if(
    CurrentBar == Count - 2
    && Close[0] > Open[0] // for example
    ) 
    			
    {
    				Form myForm = this.ChartControl.FindForm();
    			
    				myForm.BringToFront();
    }
    This compiles and works well.

    However, when I've copied this exact code into a long and complex indicator, it won't compile, with the error message:



    Many thanks in advance.
    Did you add to the using section as mentioned below?

    Leave a comment:


  • arbuthnot
    replied
    Hi

    I'm coming back to this thread after a couple of years as I'm only now applying this for the first time.

    Also to say that I know this is not officially supported but if anyone could give me a pointer, I'd be very grateful.

    In post #2 of this thread, Chelsea kindly attached a sample indicator. I've adapted this slightly in another indicator as follows to test it:

    Code:
    if(
    CurrentBar == Count - 2
    && Close[0] > Open[0] // for example
    ) 
    			
    {
    				Form myForm = this.ChartControl.FindForm();
    			
    				myForm.BringToFront();
    }
    This compiles and works well.

    However, when I've copied this exact code into a long and complex indicator, it won't compile, with the error message:

    The type or namespace 'Form' could not be found (are you missing a directive or an assembly reference?)
    Many thanks in advance.

    Leave a comment:


  • arbuthnot
    replied
    Thanks again, Chelsea.

    I really appreciate that you let me know about this as it could well prove to be extremely helpful.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello arbuthnot,

    You are correct. Unsupported means that is not official NinjaScript code, is not documented, and we cannot offer assistance in its use.

    However, I did want to mention that it is possible.

    Leave a comment:


  • arbuthnot
    replied
    Much obliged for that, Chelsea.

    I'll try it out on one of my indicators - that will be very effective.

    Just one question: what exactly do you mean by 'supported' and 'unsupported'? Do you mean this does not belong to official NinjaScript coding?

    Thanks for letting me know.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello arbuthnot,

    Thanks for your post.

    I first want to mention that there is no supported way to do this.

    That being said, there is an unsupported way of achieving this.

    You can add System.Windows.Forms to the using section and then use ChartControl to get handle of the Form window and then use BringToFront() on the form.

    Attached is a sample of how this works.
    Attached Files

    Leave a comment:


  • arbuthnot
    started a topic Is there code to bring chart to front?

    Is there code to bring chart to front?

    Hi everyone

    Like many users, I have many charts open at the same time.

    Is the following at all possible:

    When an indicator or strategy (of my own devising) hits any 'action' point I stipulate in the code (this would normally be associated with a sound alert), does there exist any code that would immediately bring that particular chart to the foreground (so I can easily make a visual check before placing a trade)?

    Many thanks in advance for any advice with this.

Latest Posts

Collapse

Topics Statistics Last Post
Started by timmbbo, Today, 09:10 AM
1 response
10 views
0 likes
Last Post NinjaTrader_Manfred  
Started by space_trader, 11-26-2020, 05:06 AM
2 responses
164 views
1 like
Last Post klaus w
by klaus w
 
Started by Kicks.Spin, Today, 07:46 AM
1 response
4 views
0 likes
Last Post NinjaTrader_PaulH  
Started by Renejm, Today, 06:17 AM
1 response
5 views
0 likes
Last Post NinjaTrader_Jesse  
Started by kazisl, Yesterday, 06:41 PM
2 responses
14 views
0 likes
Last Post NinjaTrader_PaulH  
Working...
X