Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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:
Can you help answer these questions from other members on NexusFi?
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;
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:
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:
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;}
}
}