Possible to add 'DashStyleHelper' as enum for User Input? - futures io
futures io futures trading



Possible to add 'DashStyleHelper' as enum for User Input?


Discussion in NinjaTrader

Updated
    1. trending_up 1,250 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Possible to add 'DashStyleHelper' as enum for User Input?

(login for full post details)
  #1 (permalink)
Legendary Urban Samurai
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,194 since Jun 2010
Thanks: 290 given, 876 received

Imagine you want to draw a line of the form:

 
Code
Draw.Line(this, "line", false, 10, High[10], 0, High[10], Brushes.Cyan, DashStyleHelper.Dot, 1);
For the DashStyleHelper bit... is it possible to add this in a user input in a way that would allow the user to select from the available options of a line? I.e.,
  • Dash
  • DashDot
  • DashDotDot
  • Dot
  • Solid

In the same way you can add a Brush color as a user input via:
 
Code
		[NinjaScriptProperty]
		[XmlIgnore]
		[Display(Name="Some Color", Order=1, GroupName="1)MyColors")]
		public Brush MyColor
		{ get; set; }

		[Browsable(false)]
		public string MyColorSerializable
		{
			get { return Serialize.BrushToString(MyColor); }
			set { MyColor= Serialize.StringToBrush(value); }
		}

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Indicators for pair trading MES and M2K
Platforms and Indicators
NT8 indicator to simulate a Funding Evaluation where to …
NinjaTrader
COTbase for quant trading?
Elite Algorithmic NinjaTrader Trading
Volume Profile Indicator for Ninja Script in NT8
NinjaTrader
SimplerOptions
Trading Reviews and Vendors
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Battlestations: Show us your trading desks!
137 thanks
Want your NinjaTrader indicator created, free?
32 thanks
Big Mike in Ecuador
30 thanks
Saturday Morning Market Replay!
20 thanks
Selling Options on Futures?
19 thanks
 
(login for full post details)
  #2 (permalink)
Market Wizard
Quebec
 
Experience: Intermediate
Platform: NinjaTrader wt Rancho Dinero's profiling tools
Broker: AMP/CQG
Trading: ES, NQ, YM
 
trendisyourfriend's Avatar
 
Posts: 3,979 since Oct 2009
Thanks: 3,657 given, 5,120 received

You can with an enum and a switch. Example right here:
https://ninjatrader.com/support/forum/forum/ninjascript-educational-resources/reference-samples/3529-indicator-creating-a-user-defined-parameter-type-enum?t=3420

Reply With Quote
The following user says Thank You to trendisyourfriend for this post:
 
(login for full post details)
  #3 (permalink)
Legendary Urban Samurai
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,194 since Jun 2010
Thanks: 290 given, 876 received


I just happened to stumble across an indie that did this the other day. So posting just in case someone else has such a need.

In the class level, can add:
 
Code
		private PlotStyle	myPlotStyle = PlotStyle.Line;
		private DashStyleHelper	myDashStyle  = DashStyleHelper.DashDot;



In the properties section for a user input:
 
Code
		[Display(ResourceType = typeof(Custom.Resource), Name = "", Description = "", GroupName = "Plot Parameters", Order = 0)]
		public PlotStyle MyPlotStyle				        
		{	
                         get { return myPlotStyle; }
                         set { myPlotStyle = value; }
		}
		
		[Display(ResourceType = typeof(Custom.Resource), Name = "", Description = "", GroupName = "Plot Parameters", Order = 1)]
		public DashStyleHelper MyDashStyle				        
		{
			get { return myDashStyle; }
			set { myDashStyle = value; }
		}

The dashstyleHelper can be used in methods such as Draw.Line() or other on-chart drawings.

Both of the above items can be used in standard plots, and configured in onStateChange() like:
 
Code
			else if (State == State.Configure)
			{
				Plots[0].PlotStyle = myPlotStyle;
				Plots[0].DashStyleHelper = myDashStyle;	
                        }

Started this thread Reply With Quote
The following user says Thank You to forrestang for this post:
 
(login for full post details)
  #4 (permalink)
Legendary Urban Samurai
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,194 since Jun 2010
Thanks: 290 given, 876 received

Updating in the case someone else may want more custom user inputs in a simple fashion(I'm sure plenty of people that already know how to do this, but just in case there are other novices out there like me).

Here is an example of creating a simpleFont object that can be configured as a user input. It is really cool, convenient, as it gives you a user input that offers you a bit of control in the input screen.

You can configure the fontFamily AND size with a dropdown, and some other features. It's pretty slick. Text color you still would have to add in manually a separate user input as you can see in my image.

At the class level, you add:
 
Code
private SimpleFont myTextFont = new NinjaTrader.Gui.Tools.SimpleFont("Impact", 12);

In the properties section, you'd add:
 
Code
		[XmlIgnore]
		[Display(ResourceType = typeof(Custom.Resource), Name = "Text Type", Description = "", GroupName = "Text Control", Order = 0)]
		public SimpleFont MyTextFont
		{ 
			get {return myTextFont;}
			set {myTextFont = value;}
		}


2021-01-05_221512

Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Possible to add 'DashStyleHelper' as enum for User Input?


Last Updated on January 5, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts