Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to put Price Type Captured as user input into EMA?
Collapse
X
-
Thanks fellas.
Using the conditions in there worked. It was quite a few of them though, as I was already using an enum for something else.
-
Hello,
Thanks for the forum post.
This actually most be defined before the strategy starts, therefor you would be unable to have a user select this unfortunately or have different price types for different referenced indicators as well would not be supported.
Only option is to base of close and then use your own method to come up with the other PriceType off that input data and create it yourself and use that as a feed.
Let me know if I can be of further assistance.
Leave a comment:
-
You need a conversion conditional statement for each of your Set statements, that reads the input, then sets the plot using the correct DataSeries.Originally posted by forrestang View PostHowdy. I am trying to add a a PriceType that the user inputs into the User Input upon adding the indicator. In the study, I am creating, there are two different MAs, that I would like to assign different price types to.
So I initialize the price type to close via:
Then say I have something like:Code:#region Variables private PriceType myPriceType1 = PriceType.Close; private PriceType myPriceType2 = PriceType.Close; #endregion
And in the Properties, I am capturing the user input via:Code:protected override void OnBarUpdate() { MAFast.Set(EMA(periodFast)[0]); MASlow.Set(EMA(periodSlow)[0]); }
What I want to do, is simply put that variable captured as a user input, into the portion on onBarUpdate() Like so:Code:[Description("Price Type for Fast MA")] [Gui.Design.DisplayName("1.)Fast MA Type")] [Category("Parameters")] public PriceType MyPriceType1 { get { return myPriceType1; } set { myPriceType1 = value; } } [Description("Price Type for Slow MA")] [Gui.Design.DisplayName("2.)Slow MA Type")] [Category("Parameters")] public PriceType MyPriceType2 { get { return myPriceType2; } set { myPriceType2 = value; } }
But this doesn't work. How would I take the variable for the price type the user inputs and put it in there?Code:MAFast.Set(EMA([COLOR=Magenta]myPriceType2[/COLOR], periodFast)[0]);
e.g.,
etcCode:if (this.MyPriceType2 == PriceType.High) MAFast.Set(EMA(High, periodFast)[0]);
Leave a comment:
-
How to put Price Type Captured as user input into EMA?
Howdy. I am trying to add a a PriceType that the user inputs into the User Input upon adding the indicator. In the study, I am creating, there are two different MAs, that I would like to assign different price types to.
So I initialize the price type to close via:
Code:#region Variables private PriceType myPriceType1 = PriceType.Close; private PriceType myPriceType2 = PriceType.Close; #endregion
Then say I have something like:
Code:protected override void OnBarUpdate() { MAFast.Set(EMA(periodFast)[0]); MASlow.Set(EMA(periodSlow)[0]); }
And in the Properties, I am capturing the user input via:
Code:[Description("Price Type for Fast MA")] [Gui.Design.DisplayName("1.)Fast MA Type")] [Category("Parameters")] public PriceType MyPriceType1 { get { return myPriceType1; } set { myPriceType1 = value; } } [Description("Price Type for Slow MA")] [Gui.Design.DisplayName("2.)Slow MA Type")] [Category("Parameters")] public PriceType MyPriceType2 { get { return myPriceType2; } set { myPriceType2 = value; } }
What I want to do, is simply put that variable captured as a user input, into the portion on onBarUpdate() Like so:
Code:MAFast.Set(EMA([COLOR="Magenta"]myPriceType2[/COLOR], periodFast)[0]);
But this doesn't work. How would I take the variable for the price type the user inputs and put it in there?Tags: None
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
161 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
308 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
245 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
349 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
179 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Leave a comment: