Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 Code Conversion

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

    NT8 Code Conversion

    Hi,

    Trying to covert code from NT7 to NT8 and I am stuck with the following 2 areas. I do not know if there are ChartControl definition for ChartTypeStyle.

    else if (State == State.Configure)
    {
    if (ChartControl != null && ChartControl.ChartStyleType == ChartStyleType.CandleStick)

    candles = true;
    else
    candles = false;
    }

    Not clear about the correct code for the above "IF" statement
    /////////////////////////////////////////////////

    Also, the following definition for Brush will not accept calculated integer values instead of numeric RGB integers i.e (50,80,120)

    Brush myColor = new SolidColorBrush(Color.FromRgb(value1,value2,value3 ));
    myColor.Freeze();

    How the definition of Brush must be coded to accept integer series?

    Many thanks.
    Last edited by aligator; 10-26-2015, 09:41 PM.

    #2
    Why would you post this in NT7 forums? No wonder no one saw this.

    Comment


      #3
      Originally posted by sledge View Post
      Why would you post this in NT7 forums? No wonder no one saw this.
      Thanks for help , General Programming was the forum.

      Comment


        #4
        Hello Alligator,
        You can check the ChartStyle type by using ChartBars.Properties.Chartstyle.
        Code:
        if(ChartControl != null && ChartBars.Properties.ChartStyleType == ChartStyleType.Candlestick)
        {
        candles = true;
        else
        candles = false;
        }
        Please see the following link on ChartBars.Properties. http://ninjatrader.com/support/helpG...properties.htm

        Color.FromRgb uses byte values. To use integers you would need to convert the integer values to Byte.

        Code:
        Brush myColor = new SolidColorBrush(Color.FromRgb(Convert.ToByte(value1), Convert.ToByte(value2), Convert.ToByte(value3)));
        For more information on Color.FromRgb please see the following link, https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

        I would also like to note while this is a general programming question we do ask that you post any questions on NinjaTrader 8, including programming questions, in the NinjaTrader 8 section. These types of questions could be asked in General Discussion

        If we can be of any other assistance please let us know.
        Cody B.NinjaTrader Customer Service

        Comment


          #5
          In Nt7 when I try to use Color.FromRgb(value1,value2,value3) the compiler doesn't recognize it. Am I missing a hierarchy declaration? I tried using System.Windows.Media; it still didn't recognize it. I want to use this to create a color gradient method.

          Comment


            #6
            Hello,
            What variable type do you have value1, value2, and value3 set to? i.e. integer, double, byte, etc.

            Color.FromRgb() only accepts bytes as its overloads. Please see the following Microsoft Documentation on this, https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

            If you have value1, value 2, and value3 set to be something other than a byte you would need to convert it using Convert.ToByte()
            Please see my example below:
            Code:
            Color.FromRgb(Convert.ToByte(value1), Convert.ToByte(value2), Convert.ToByte(value3)));
            I would also like to note to keep continuity of this thread we do ask that you post your questions in the associated sections. For example if you have a general question on NinjaScript using NinjaTrader 7 you would ask this under NinjaScript Development > General Programming.

            The NinjaTrader 8 threads are meant to be used for questions, general feedback, and bug reporting for NinjaTrader 8.
            Cody B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,606 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            9 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            19 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            6 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            15 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X