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 Balage0922, Today, 07:38 AM
|
0 responses
2 views
0 likes
|
Last Post
by Balage0922
Today, 07:38 AM
|
||
Started by JoMoon2024, Today, 06:56 AM
|
0 responses
6 views
0 likes
|
Last Post
by JoMoon2024
Today, 06:56 AM
|
||
Started by Haiasi, 04-25-2024, 06:53 PM
|
2 responses
19 views
0 likes
|
Last Post
by Massinisa
Today, 05:32 AM
|
||
Started by Creamers, Today, 05:32 AM
|
0 responses
6 views
0 likes
|
Last Post
by Creamers
Today, 05:32 AM
|
||
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
12 responses
1,786 views
0 likes
|
Last Post
by Leafcutter
Today, 05:30 AM
|
Comment