Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
ATR(int period)[int barsAgo]
Collapse
X
-
Hi Alex, unfortunately that way of adding would not be supported, you could only add the complete indicator study as designed and not an individual custom, indexed value. If you wish to add delayed version of the ATR, then just create a custom verison of the ATR that would set a delayed by one bar plot for example.
-
I did like this
So, I add "1 period ago" just in position rule. Can you advice, how could I do to set "1 bar before enter".Code:protected override void Initialize() { ATR(my_per).Plots[0].Pen.Color = Color.Blue; Add(ATR(my_per)); CalculateOnBarClose = true; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Condition for long if (C[1] < C[2] + 1 * TickSize) { EnterLongStop(DefaultQuantity, C[0] + ATR(my_per)[B][1][/B], "Long Entry 1");
Comment
-
If you just need to access the ATR one bar ago, why are you adding it at all? Just access it directly where you need it.Originally posted by alexstox View PostWhy it caused error, when I put "1 period ago" to plot in Initialize()?
[ATTACH]21698[/ATTACH]
Code:protected override void Initialize() { (ATR(my_per)[B][1][/B]).Plots[0].Pen.Color = Color.Blue; Add((ATR(my_per)[B][1][/B])); CalculateOnBarClose = true; }
Regardless, you cannot index anything in the Initialize() method, as nothing indexable yet exists.
Comment
-
I want to clarify. If I use entryATR in EnterLong() condition, I just put entryATR before EnterLong() condition. Will entryATR be first in calculation by script, than EnterLong()? Am I right?
Code:if (myEntryCondition) { entryATR = ATR(14)[0]; EnterLong(); }
Comment
-
Whenever i do an order entry for 20,000 contracts for example, it will say on the screen "Entry 19,000 @1.3144 and Entry 1,000 @1.3144" and then another 2 on the stop orders? does that mean that each order was a separate order and if so how do i make them each one order?
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
581 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
338 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment