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
all bars to now from X bars ago
Collapse
X
-
Ok maybe something to work on.
Just a quick question, I have my lines being drawn automatically now, and it all seems fine and compiles well, but I have since closed NT and re-opened it again just now and now my indicator doesn't load on the chart? It says it is, but nothing is showing up? Nothing should be different.
-
Jumper, then you could not work with a Ray since that would have an infinite end point. You would rather work directly with for example the DrawLine command and extend yourself by changing the anchor until you hit that session end. That will mean though more custom coding would be needed.
Leave a comment:
-
Awesome thanks, sorry for being so dumb haha, got it working now!
What would I need to do if I want to change it so it's new every session/day? Rather than old ones running right up to the present?
Leave a comment:
-
Originally posted by Jumper View PostSo will that draw from the high/lows? or the open/close of the bar?
Leave a comment:
-
That depends on the price values you pass in to draw at, it will run through them and thus create the angles...
Those would be horizontal for example -
if (Volume[0] > 5000)
{
DrawRay(CurrentBar + "high1", 1, Close[0], 0, Close[0], Color.LimeGreen);
DrawRay(CurrentBar + "low1", 1, Close[0], 0, Close[0], Color.Red);
}
...as in both cases the same Y price value is used.
Leave a comment:
-
That compiles but it draws lines at huge ridiculous angles? I just want flat horizontal lines from the high/low prices of that bar. The lines from that code are nearly vertical.
Leave a comment:
-
Right, would expect - there's no overload suitable for what you passed in, would suggest closely working with intellisense to know what parameters are expected in the call. For example this should compile for you in contrast :
if (Volume[0] > 5000)
{
DrawRay(CurrentBar + "high1", 1, High[0], 2, Close[0], Color.LimeGreen);
DrawRay(CurrentBar + "low1", 1, Low[0], 2, Close[0], Color.Red);
}
Leave a comment:
-
if (Volume[0] > 5000)
{
DrawRay(CurrentBar + "high1", High[0], Close[0], 0, Close[0], Color.LimeGreen);
DrawRay(CurrentBar + "low1", Low[0], Close[0], 0, Close[0], Color.Red);
}
Getting a bunch of errors, cannot convert double to int, best overloaded method match etc etc.
Leave a comment:
-
Originally posted by Jumper View PostAnd what to put in for all the arguments of DrawRay()? Anchor1Y AnchorTime etc.
if (CurrentBar < 10) return;
DrawRay("tag1", 10, Close[0], 0, Close[0], Color.LimeGreen);
That would be just a horizontal ray starting 10 bars ago.
Leave a comment:
-
And what to put in for all the arguments of DrawRay()? Anchor1Y AnchorTime etc.
Leave a comment:
-
Originally posted by Jumper View PostThanks for the reply Bertrand, but I'm afraid your post has confused me a little, don't quite understand what you mean?
On another project, how can I draw a line to the right of the chart(infinite) on the high and low of a bar?
So say I want to do:
if (condition)
{
DrawLine(High[0], Infinite)
}
That type of thing? Because I need to set a start and end point don't I for DrawLine? What do I put for these values if I want it to be from the high and low of the bar that meets the condition to infinite(always there)?
Thanks!
Leave a comment:
-
Thanks for the reply Bertrand, but I'm afraid your post has confused me a little, don't quite understand what you mean?
On another project, how can I draw a line to the right of the chart(infinite) on the high and low of a bar?
So say I want to do:
if (condition)
{
DrawLine(High[0], Infinite)
}
That type of thing? Because I need to set a start and end point don't I for DrawLine? What do I put for these values if I want it to be from the high and low of the bar that meets the condition to infinite(always there)?
Thanks!
Leave a comment:
-
Yes, the sum was just an example for the looping technique. Since you want to compare each bar with the previous > your index used would need to reflect this (vol and vol-1). You then can run for example a count in that loop for how often your condition was hit and if it's not hit reset that to 0 to reflect this would need to happen on consecutive bars.
Outside the loop you could then run a condition checking for the counter state and taking action based on it's value.
Leave a comment:
-
So I want to do it with volume, so it would be something like:
for (int vol = 0; vol <= 10; vol++)
{
if (Volume[0] > Volume[vol])
BarColor = Color.Magenta;
}
Doesn't seem to be working though, still don't understand how to compare the current bar with all previous X bars.
EDIT: Not a SUM of all previous X bars by the way, each individual volume of each bar. Just thought I'd make that clear
Leave a comment:
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by wzgy0920, 04-20-2024, 06:09 PM
|
2 responses
26 views
0 likes
|
Last Post
by wzgy0920
Today, 10:43 PM
|
||
Started by wzgy0920, 02-22-2024, 01:11 AM
|
5 responses
32 views
0 likes
|
Last Post
by wzgy0920
Today, 10:33 PM
|
||
Started by wzgy0920, Yesterday, 09:53 PM
|
2 responses
49 views
0 likes
|
Last Post
by wzgy0920
Today, 10:29 PM
|
||
Started by Kensonprib, 04-28-2021, 10:11 AM
|
5 responses
192 views
0 likes
|
Last Post
by Hasadafa
Today, 10:19 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
11 responses
3,234 views
0 likes
|
Last Post Today, 08:07 PM |
Leave a comment: