PDA

View Full Version : Multi-option drop down parameters


theperm
05-15-2007, 12:30 PM
How do i specify multiple options with drop down/combo box type parameter?

Similar to EntryHandling parameter.

NinjaTrader_Ray
05-15-2007, 12:40 PM
This can be done by declaring an enum within your strategy. If you are not familiar with this C# concept I would suggest leaving it for now. This is outside of what we support however, I will provide sample code on how this can be done in the near future.

theperm
05-15-2007, 02:48 PM
Excellent, I'm familiar with it.

heres an example for anyone else
public enum PosTypes {Long, Short} // be sure to make this public

PosTypes posType = PosTypes.Long;

[Description("Pos Type")]
[Category("Parameters")]
public PosTypes PosType
{
get { return posType; }
set { posType = value }
}

NinjaTrader_Dierk
05-15-2007, 11:51 PM
FYI: There already is an equivalent NT enum: NinjaTrader.Cbi.MarketPosition.

theperm
05-16-2007, 03:36 AM
I know, bad example on my part, i just pulled it out of thin air.

J_o_s
08-17-2010, 05:17 AM
FYI: There already is an equivalent NT enum: NinjaTrader.Cbi.MarketPosition.
Hm, that's interesting. :) Is there also such a class for relational operators? (<,>,>=,etc)

I was just wondering, because I'm making an indicator, and would like to include a drop-down menu with various relational operators so that the user can choose how the condition should be tested. For example with such an drop-down menu it would be possible for the user to choose between 'Variable1 > Variable2' condition and the 'Variable1 < Variable2' condition.

How can I achieve such a feature with enums? (or perhaps a different way?)

Any thoughts are highly appreciated :)

Regards,

NinjaTrader_Bertrand
08-17-2010, 12:18 PM
J_o_s, I'm not aware of one for relational operators, I would suggest you create an enum case for either scenario you would need to express your potential conditions.