Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
The method works for all indicators, but you can only access Close[20] for bars > 20. You need to add the following line in the beginning of OnBarUpdate()
Abbott: You throw the ball to first base.
Costello: Then who gets it?
Abbott: Naturally.
Costello: Naturally.
Abbott: Now you've got it.
Costello: I throw the ball to Naturally.
Abbott: You don't! You throw it to Who!
Costello: Naturally.
Abbott: Well, that's it—say it that way.
Costello: That's what I said.
Abbott: You did not.
Costello: I said I throw the ball to Naturally.
Abbott: You don't! You throw it to Who!
Costello: Naturally.
Be yourself; everyone else is already taken. Oscar Wilde
There are TWO types of ninjascripts: INDICATORS and STRATEGIES.
The BARS AGO function *ONLY* works for STRATEGIES.
So I need to write
Close[0]-Close[30]
in an alternate way WITHOUT using the [30]. That is all. No need to debate if this is true or not, since confusion on that part is irrelevant, since I've confirmed the issue with NT staff.
Also tried doing them in separate Ninjascript files... no go...
I confirmed with NT help, that bars ago does not work in indicators, only strategies.
patbateman
Not sure how much more clear I can get.
There are TWO types of ninjascripts: INDICATORS and STRATEGIES.
The BARS AGO function *ONLY* works for STRATEGIES.
So I need to write
Close[0]-Close[30]
in an alternate way WITHOUT using the [30]. That is all. No need to debate if this is true or not, since confusion on that part is irrelevant, since I've confirmed the issue with NT staff.
Again,
How can I write
Close[0]-Close[10]
in a way that does not use the [10]?
Sorry, but everyone who is trying to help you writes indicators and uses the [bars ago] routinely in their indicators.
Close[0] - Close[10] works just fine in indicators; we all do this all the time. You just need to have the statement @Fat Tails mentioned to check that you have enough bars available to make the subtraction.
There may be a misunderstanding between you and NT support about what you are trying to accomplish, but, believe me, everyone who writes indicators uses the Close[bars ago] expression successfully. I do it and it works fine.
If you post the full code that is having a problem, I'm sure someone will help you fix it.
Bob.
When one door closes, another opens.
-- Cervantes, Don Quixote
@patbateman: You can use barsAgo without limitations in indicators. The problem is that you do not disclose the information necessary to solve your problem. We cannot fix your bug, if you do not show us the code.
Please export the indicator with NinjaTrader and post it here. In a few minutes the bug will be identified and the discussion will be over.