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
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.BertrandNinjaTrader Customer Service
-
I did like this
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
-
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
-
Camron, for the future please post your issues in a new, separate thread. You're getting partial fills here for your FX spot simulated trading, go to Tools > Options > Simulator and check 'Enforce immediate fills' >> then you should not see this splitup happen.BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Waxavi, 04-19-2024, 02:10 AM
|
2 responses
36 views
0 likes
|
Last Post
by poeds
Today, 06:37 AM
|
||
Started by chbruno, Yesterday, 04:10 PM
|
1 response
44 views
0 likes
|
Last Post Today, 06:36 AM | ||
Started by Max238, Today, 01:28 AM
|
1 response
23 views
0 likes
|
Last Post
by CactusMan
Today, 06:18 AM
|
||
Started by giulyko00, Yesterday, 12:03 PM
|
2 responses
10 views
0 likes
|
Last Post
by giulyko00
Today, 06:11 AM
|
||
Started by r68cervera, Today, 05:29 AM
|
0 responses
4 views
0 likes
|
Last Post
by r68cervera
Today, 05:29 AM
|
Comment