Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Using drawing tool as input for indicator
Collapse
X
-
Will this be supported in the future?
Thanks for the reply. Will this be supported in the future?
Currently I have an indicator that I have written that has two inputs, a high of your choice and a low of your choice. My problem is that I would like to know what bar the 2 inputs come from. Is there an onclick scenario/solution that could be used? Or do you have any other ideas?
Comment
-
Thx, last question/s ...for today anyway ...
Is there another way to plot something x bars from the begining of the chart, rather than "bars ago"?
Can a variable be used within a Close, Open, Low, High command. For example ...
private int xbars = 250;
xbars = (CurrentBar - xbarsInput)
Plot1.Set(Close[xbars])
Comment
-
Not sure what you mean. Most [] indexing is on barsAgo. There is no other way. If you wanted the bar at a specific time you want to use GetBar() http://www.ninjatrader-support.com/H...V6/GetBar.htmlJosh P.NinjaTrader Customer Service
Comment
-
That works, but opens up new questions ...
Is there a way to get the datetime value based on other criteria. For example ...
if(low[0] < AValue)
{
dateTimeVar = DateTime
}
// and then populate the dateTimeVar into new DateTime
barsAgoX = GetBar(new DateTime(dateTimeVar));
My other question is that I like to have otherdateTimeVar as an input - what type of variable would it be and would I have to (how?) convert it to make it work in ....
barsAgoA = GetBar(new DateTime(otherdateTimeVar));
Comment
-
Originally posted by traderT View PostIs there a way to get the datetime value based on other criteria. For example ...
if(low[0] < AValue)
{
dateTimeVar = DateTime
}
if(low[0] < AValue)
{
dateTimeVar = Time[0];
}
On your second question, create an input of type DateTime. Here is a reference sample on creating user defined inputs.
RayNinjaTrader Customer Service
Comment
-
Thanks NT_Ray, much appreciated. I tried to apply what you said, but the results I am getting don't seem right...
if((BBA ==1)
&& (Low[0] <= BullB))
{
BBB = Time[0];
barsAgoB = GetBar(BBB);
Print(BBB);
Print(barsAgoB);
}
DrawLine("Btag", barsAgoA, High[barsAgoA], (barsAgoB), Low[barsAgoB], Color.Red);
The print(bbb) gives me the correct time , but the format of that time is different from what I have seen used with the getbar statement.
//Print results
05/12/2008 20:23:00
0
The 0 should actually correspond to the getbar of 20:23, but the output is 0
For example, this gives me the correct BarsAgoA result ...
barsAgoA = GetBar(new DateTime(2008, 12, 05, 20, 19, 0));
The getbar result for this is 22, which is correct.
Am I using the getbar incorrectly with the suggestion that you posted? If so, how can I fix it?
Comment
-
getbar
Thanks for the reply. I have found a different, though not as good way to do things. Currently my code is a mess (well, it's always a mess). However, there is light at the end of the tunnel and I will hopefully post the code either later this week or on the weekend. I am sure that there is a better way to code what I am trying to do and hopefully when I post my code, more suggestions will be forthcoming. Thanks for the help. When I have time I will explain the getbar query better.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by WHICKED, Today, 12:56 PM
|
0 responses
4 views
0 likes
|
Last Post
by WHICKED
Today, 12:56 PM
|
||
Started by Spiderbird, Today, 12:15 PM
|
2 responses
10 views
0 likes
|
Last Post
by Spiderbird
Today, 12:48 PM
|
||
Started by WHICKED, Today, 12:45 PM
|
0 responses
7 views
0 likes
|
Last Post
by WHICKED
Today, 12:45 PM
|
||
Started by FrazMann, Today, 11:21 AM
|
2 responses
6 views
0 likes
|
Last Post Today, 12:38 PM | ||
Started by rjbtrade1, 11-30-2023, 04:38 PM
|
2 responses
80 views
0 likes
|
Last Post
by DavidHP
Today, 08:12 AM
|
Comment