Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Gradient Brush Application-NT8

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

    Gradient Brush Application-NT8

    Dear Support,

    NT8 includes a gradient brush on the color pallet, however, the color is Solid DimGray when applied.

    Can you please elaborate on expectations and application of the gradient brush option. Also, how to obtain linear gradient color when this brush is applied to a candlestick chart. Would appreciate if you provide an example of a gradient candle chart.

    Many thanks

    #2
    Hello aligator,

    Thanks for opening the thread.

    The Gradient Brush is defined in the skin that you use for NinjaTrader 8 at the bottom of the Documents/NinjaTrader 8/template/Skins/mySkin/BluePrint.xaml file. Some skins define this as one color instead of a gradient.

    Code:
    	<!-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Colors available in Custom Color Pickers <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -->
    	<!-- Custom colors can be added here, using the LinearGradientBrush listed here as an exmaple template -->
    	<!-- First, copy the existing content between the <LinearGradientBrush> and </LinearGradientBrush> tags-->
    	<!-- Next, paste the content after the existing </LinearGradientBrush> tag, inside the <collections:ArrayList> block-->
    	<!-- Finally, replace the StartPoint, EndPoint, and GradientStops with your desired values to add to the color picker -->
    
    	<collections:ArrayList x:Key="customColorPickerList">
    		<LinearGradientBrush StartPoint="0.5, -0.05"
    				 EndPoint="0.5, 0.66"
    				 po:Freeze="true">
    			<LinearGradientBrush.GradientStops>
    				<GradientStop Color="{StaticResource ButtonBackgroundStop1}"
    				  Offset="0" />
    				<GradientStop Color="{StaticResource ButtonBackgroundStop2}"
    				  Offset="1" />
    			</LinearGradientBrush.GradientStops>
    		</LinearGradientBrush>
    	</collections:ArrayList>
    It is currently not possible to read a Brush from the BarBrush object, but if you wanted to set the BarBrush to a LinearGradientBrush in NinjaScript, you could create a LinearGradientBrush the same way you would create a SolidColorBrush and assign the BarBrush to that LinearGradientBrush.

    Further reading on Skins, Brushes, and LinearGradientBrushes can be found here:

    Skins - https://ninjatrader.com/support/help...r_own_skin.htm

    BarBrush - https://ninjatrader.com/support/help...s/barbrush.htm

    Working with Brushes - https://ninjatrader.com/support/help...th_brushes.htm

    LinearGradientBrushes - https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jim View Post
      Hello aligator,

      Thanks for opening the thread.

      The Gradient Brush is defined in the skin that you use for NinjaTrader 8 at the bottom of the Documents/NinjaTrader 8/template/Skins/mySkin/BluePrint.xaml file. Some skins define this as one color instead of a gradient.

      Code:
      	<!-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Colors available in Custom Color Pickers <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -->
      	<!-- Custom colors can be added here, using the LinearGradientBrush listed here as an exmaple template -->
      	<!-- First, copy the existing content between the <LinearGradientBrush> and </LinearGradientBrush> tags-->
      	<!-- Next, paste the content after the existing </LinearGradientBrush> tag, inside the <collections:ArrayList> block-->
      	<!-- Finally, replace the StartPoint, EndPoint, and GradientStops with your desired values to add to the color picker -->
      
      	<collections:ArrayList x:Key="customColorPickerList">
      		<LinearGradientBrush StartPoint="0.5, -0.05"
      				 EndPoint="0.5, 0.66"
      				 po:Freeze="true">
      			<LinearGradientBrush.GradientStops>
      				<GradientStop Color="{StaticResource ButtonBackgroundStop1}"
      				  Offset="0" />
      				<GradientStop Color="{StaticResource ButtonBackgroundStop2}"
      				  Offset="1" />
      			</LinearGradientBrush.GradientStops>
      		</LinearGradientBrush>
      	</collections:ArrayList>
      It is currently not possible to read a Brush from the BarBrush object, but if you wanted to set the BarBrush to a LinearGradientBrush in NinjaScript, you could create a LinearGradientBrush the same way you would create a SolidColorBrush and assign the BarBrush to that LinearGradientBrush.

      Further reading on Skins, Brushes, and LinearGradientBrushes can be found here:

      Skins - https://ninjatrader.com/support/help...r_own_skin.htm

      BarBrush - https://ninjatrader.com/support/help...s/barbrush.htm

      Working with Brushes - https://ninjatrader.com/support/help...th_brushes.htm

      LinearGradientBrushes - https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
      Thank you Jim,

      When the Gradient Brush option in NT8 is applied to a candle chart the gradient is in vertical direction of the candle. Also, no option is provided to change the default color of the gradient. A few question please:

      1. Is it possible to apply the gradient to the width of the bar instead of height, how?
      2. Is it possible to change the default gradient brush to a different color, how?
      3. Is possible to provide a simple sample indicator around using gradient brush to paint bars based on a cross over (i.e. price and SMA, etc.)?

      Also, when I try to open the default "Documents/NinjaTrader 8/template/Skins/Light/BluePrint.xaml" I get an error and the file will not open.

      Many thanks.
      Last edited by aligator; 09-17-2017, 05:22 PM.

      Comment


        #4
        Hello aligator,

        BluePrint.xaml will need to be opened with a text editor. There you can modify the LinearGradientBrush's StartPoint and EndPoints so the gradient goes from left to right instead of top to bottom. You can also change the colors used for that skin's Gradient Brush.

        From an indicator, you can find this brush and assign it to BarBrush as follows:

        Code:
        LinearGradientBrush myGradBrush = null; 
        System.Collections.ArrayList brushes = Application.Current.TryFindResource("customColorPickerList") as System.Collections.ArrayList;
        foreach ( Object obj in brushes )
        {
        	myGradBrush = obj as LinearGradientBrush; 
        }
        BarBrush = myGradBrush;
        Keep in mind, this will only work reliably for skins that define one LinearGradientBrush for the color list. If you want to access a specific gradient brush from a skin that defines more than one LinearGradientBrush, the skin must define another instance of the color outside the customColorPickerList so it can have its own key assigned.

        XAML:
        Code:
        <Color x:Key="MyCustomColorOne">Red</Color>
        <Color x:Key="MyCustomColorTwo">Blue</Color>
        
        <LinearGradientBrush x:Key="myKeyTest" StartPoint="0.5, -0.05"
           EndPoint="0.5, 0.66"
           po:Freeze="true">
         <LinearGradientBrush.GradientStops>
          <GradientStop Color="{StaticResource MyCustomColorOne}"
            Offset="0" />
          <GradientStop Color="{StaticResource MyCustomColorTwo}"
            Offset="1" />
         </LinearGradientBrush.GradientStops>
        
        </LinearGradientBrush>
        
        <collections:ArrayList x:Key="customColorPickerList">
         <LinearGradientBrush StartPoint="0.5, -0.05"
            EndPoint="0.5, 0.66"
            po:Freeze="true">
          <LinearGradientBrush.GradientStops>
           <GradientStop Color="{StaticResource MyCustomColorOne}"
             Offset="0" />
           <GradientStop Color="{StaticResource MyCustomColorTwo}"
             Offset="1" />
          </LinearGradientBrush.GradientStops>
        
         </LinearGradientBrush>
         
        </collections:ArrayList>
        That unique key can then be used to access the brush as follows:

        C#
        Code:
        myGradBrush = Application.Current.TryFindResource("myKeyTest") as LinearGradientBrush;
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Waxavi, Today, 02:10 AM
        0 responses
        4 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by TradeForge, Today, 02:09 AM
        0 responses
        9 views
        0 likes
        Last Post TradeForge  
        Started by Waxavi, Today, 02:00 AM
        0 responses
        2 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by elirion, Today, 01:36 AM
        0 responses
        4 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by gentlebenthebear, Today, 01:30 AM
        0 responses
        4 views
        0 likes
        Last Post gentlebenthebear  
        Working...
        X