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 cre8able, 02-11-2023, 05:43 PM
            3 responses
            235 views
            0 likes
            Last Post rhubear
            by rhubear
             
            Started by frslvr, 04-11-2024, 07:26 AM
            8 responses
            113 views
            1 like
            Last Post NinjaTrader_BrandonH  
            Started by stafe, 04-15-2024, 08:34 PM
            10 responses
            45 views
            0 likes
            Last Post stafe
            by stafe
             
            Started by rocketman7, Today, 09:41 AM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by traderqz, Today, 09:44 AM
            2 responses
            10 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X