NexusFi: Find Your Edge


Home Menu

 





opacity


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one SamirOfSalem with 7 posts (1 thanks)
    2. looks_two KySt with 6 posts (1 thanks)
    3. looks_3 forrestang with 1 posts (0 thanks)
    4. looks_4 Bullywig with 1 posts (0 thanks)
    1. trending_up 3,673 views
    2. thumb_up 2 thanks given
    3. group 4 followers
    1. forum 14 posts
    2. attach_file 4 attachments




 
Search this Thread

opacity

  #11 (permalink)
 SamirOfSalem   is a Vendor
 
Posts: 74 since Jan 2020
Thanks Given: 23
Thanks Received: 44

Hmm.. maybe we're on the wrong track. So you've changed the "width"? With a thin line you'll hardly be able to tell the difference, so the effect of opacity will be kind of visibly lost anyway. With Argb colours, the first number is the alpha, and it should have some effect. Try changing 33 to 40 and see if that works.

If that still doesn't work, a look at the NT documentation under best practices, but note that they're using .FromRGB rather than Argb:



Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Cheap historycal L1 data for stocks
Stocks and ETFs
MC PL editor upgrade
MultiCharts
 
  #12 (permalink)
 KySt 
Accokeek, USA
 
Experience: Intermediate
Platform: NT & TOS
Trading: ES RUT
Posts: 92 since Mar 2011
Thanks Given: 17
Thanks Received: 24

Thank you Samir for your help
I pieced this together. It works, but does not have the values in the menu for ease of edit. The script value would have to be edited.
AddLine(new SolidColorBrush(Color.FromRgb(192,192,192)), 0, "KenZeroLine");
Lines[0].Width = 15;
Lines[0].Opacity = 15;


Reply With Quote
  #13 (permalink)
 SamirOfSalem   is a Vendor
 
Posts: 74 since Jan 2020
Thanks Given: 23
Thanks Received: 44


I can't help but feel that using "Stroke" would've been a better approach. It would've let you apply color, opacity and dashstyling as we. In NinjaScript, strokes are generally easier to deal with than brushes in terms of saving into templates etc as they serialize readily.

But since you're already using brushes, see if adding this helps:

 
Code
Lines[0].IsOpacityVisible = true;

Reply With Quote
  #14 (permalink)
 KySt 
Accokeek, USA
 
Experience: Intermediate
Platform: NT & TOS
Trading: ES RUT
Posts: 92 since Mar 2011
Thanks Given: 17
Thanks Received: 24


SamirOfSalem View Post
I can't help but feel that using "Stroke" would've been a better approach. It would've let you apply color, opacity and dashstyling as we. In NinjaScript, strokes are generally easier to deal with than brushes in terms of saving into templates etc as they serialize readily.

But since you're already using brushes, see if adding this helps:

 
Code
Lines[0].IsOpacityVisible = true;

Samir, you are talking way over my head
If you think another method is more efficient, by all means.
I just appreciate what you have done!

Reply With Quote
Thanked by:
  #15 (permalink)
 SamirOfSalem   is a Vendor
 
Posts: 74 since Jan 2020
Thanks Given: 23
Thanks Received: 44


KySt View Post
Samir, you are talking way over my head
If you think another method is more efficient, by all means.
I just appreciate what you have done!

Hello Ky.

Sorry if I confused you. To explain, here's some sample code with comments around the relevant lines:

 
Code
namespace NinjaTrader.NinjaScript.Indicators
{
	public class KyLine : Indicator
	{
		protected override void OnStateChange()
		{
			if (State == State.SetDefaults)
			{
				Description									= @"Enter the description for your new custom Indicator here.";
				Name										= "KyLine";
				Calculate									= Calculate.OnBarClose;
				IsOverlay									= true;	


				PriceLevel					= 28000;
				
				AddLine(Brushes.Orange, 28000, "MyLine");
				
				//next line exposes the Opacity parameter for you
				Lines[0].IsOpacityVisible = true;
				
				//Let's say you plan to use another colour for something else, like a drawing
				//Instead of using Brushes to determine colour, then an int to set width, and a float to set opacity, and so on..
				//just use Stroke which has all these properties already
				AnotherColour = new Stroke();
				AnotherColour.Brush = Brushes.Green;
				AnotherColour.Width = 4;
				AnotherColour.Opacity = 44;
				AnotherColour.DashStyleHelper = DashStyleHelper.DashDot;
			}
			else if (State == State.Configure)
			{
			}
		}

		protected override void OnBarUpdate()
		{
			//Add your custom indicator logic here.
		}		

		[NinjaScriptProperty]
		[Range(1, double.MaxValue)]
		[Display(Name="PriceLevel", Order=1, GroupName="Parameters")]
		public double PriceLevel
		{ get; set; }
		

		[NinjaScriptProperty]
		public Stroke AnotherColour
		{get; set;}


	}
}
I hope this helps.

Reply With Quote
Thanked by:




Last Updated on November 22, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts