NexusFi: Find Your Edge


Home Menu

 





Bars Ago in an indicator


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one patbateman with 8 posts (1 thanks)
    2. looks_two Tasker_182 with 7 posts (8 thanks)
    3. looks_3 Fat Tails with 3 posts (3 thanks)
    4. looks_4 cory with 1 posts (3 thanks)
      Best Posters
    1. looks_one cory with 3 thanks per post
    2. looks_two bobwest with 2 thanks per post
    3. looks_3 Tasker_182 with 1.1 thanks per post
    4. looks_4 Fat Tails with 1 thanks per post
    1. trending_up 10,918 views
    2. thumb_up 19 thanks given
    3. group 7 followers
    1. forum 22 posts
    2. attach_file 1 attachments




 
Search this Thread

Bars Ago in an indicator

  #1 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 200

So the Bars Ago function only works in strategies...


How can I get bars ago in an indicator? Example, Close[0] - Close[90] would plot the difference between the current bar and the bar from 90 bars ago.

I'm sure this has been answered somewhere, but I've searched and can't find, so my apologies in advance!

"A Jedi's strength flows from the force."
-Yoda
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Exit Strategy
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
NexusFi Journal Challenge - April 2024
Feedback and Announcements
ZombieSqueeze
Platforms and Indicators
 
  #3 (permalink)
 
Tasker_182's Avatar
 Tasker_182 
Cedar Rapids, iowa
Legendary Market Wizard
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Ninjatrader - Continuum
Posts: 716 since Aug 2009
Thanks Given: 476
Thanks Received: 1,401



patbateman View Post
So the Bars Ago function only works in strategies...


How can I get bars ago in an indicator? Example, Close[0] - Close[90] would plot the difference between the current bar and the bar from 90 bars ago.

I'm sure this has been answered somewhere, but I've searched and can't find, so my apologies in advance!

Not sure I understand what you are asking for, your example seems to answer your question. Can you restate you needs in another way?

Be yourself; everyone else is already taken. Oscar Wilde
Reply With Quote
  #4 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 200


Tasker_182 View Post
Not sure I understand what you are asking for, your example seems to answer your question. Can you restate you needs in another way?

Yes, my poalogies...


The bars ago function does not work in NT indicators. Only NT Strategies. I verified this with NT.

So I'm looking for another way to model a lookback (or a displacement, as its called in the indicator window).

So I want to do an alternative for the bars ago function... Close[0] - Close[x] I'll be working it into something more complex, but I can go from here if any kind souls want to help my stump!

"A Jedi's strength flows from the force."
-Yoda
Started this thread Reply With Quote
  #5 (permalink)
 
Tasker_182's Avatar
 Tasker_182 
Cedar Rapids, iowa
Legendary Market Wizard
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Ninjatrader - Continuum
Posts: 716 since Aug 2009
Thanks Given: 476
Thanks Received: 1,401


patbateman View Post
Yes, my poalogies...


The bars ago function does not work in NT indicators. Only NT Strategies. I verified this with NT.

So I'm looking for another way to model a lookback (or a displacement, as its called in the indicator window).

So I want to do an alternative for the bars ago function... Close[0] - Close[x] I'll be working it into something more complex, but I can go from here if any kind souls want to help my stump!

Some days I can't see the forest for the trees and today is one of those days, sorry.

In this lookback, are you trying to go back X number of bars to see something or are you trying to scan for a value that may have occurred over the last x bars? Hey if you have strategy code that does what you need or if you had a picture of your needs I may be able to see something to help with.

Be yourself; everyone else is already taken. Oscar Wilde
Reply With Quote
  #6 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 200

I'm just looking for an alternate to bars ago, besides using close[3] for example. The bars ago function does NOT work in indicators. I don't want a strategy, just an indicator.

"A Jedi's strength flows from the force."
-Yoda
Started this thread Reply With Quote
  #7 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090

I don't understand this at all!

Reply With Quote
Thanked by:
  #8 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 200

The bars ago function does NOT work when creating ninjascript for indicators. It ONLY works for creating indicators for strategies.

In other words, if you make an indicator that is simply Close[10], it will not function. It will compile, but the compiler will not read it.

So, I'm trying to figure out a way to use something like bars ago that does not involve the traditional approach.

If I can get just Close[0] - Close[20] to work, I can go from there.

Hope this helps!

"A Jedi's strength flows from the force."
-Yoda
Started this thread Reply With Quote
  #9 (permalink)
 
Tasker_182's Avatar
 Tasker_182 
Cedar Rapids, iowa
Legendary Market Wizard
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Ninjatrader - Continuum
Posts: 716 since Aug 2009
Thanks Given: 476
Thanks Received: 1,401


patbateman View Post
The bars ago function does NOT work when creating ninjascript for indicators. It ONLY works for creating indicators for strategies.

In other words, if you make an indicator that is simply Close[10], it will not function. It will compile, but the compiler will not read it.

So, I'm trying to figure out a way to use something like bars ago that does not involve the traditional approach.

If I can get just Close[0] - Close[20] to work, I can go from there.

Hope this helps!

Maybe I'm overthinking this. Lets use your example as an example, Close[0] - Close[20]

if you create a variable to put the results in, will that not meet your needs?

IE:

double diff = Close[0] - Close[20] ;

So the above code statement declares a variable called "diff" that is a double type. Next (on the other side of equals) the difference between Close[0] and Close[20] is put into diff. The ";" ends the C# statement.

Is that what you want?

Be yourself; everyone else is already taken. Oscar Wilde
Reply With Quote
Thanked by:
  #10 (permalink)
 
Silvester17's Avatar
 Silvester17 
Columbus, OH
Market Wizard
 
Experience: None
Platform: NT 8, TOS
Trading: ES
Posts: 3,603 since Aug 2009
Thanks Given: 5,139
Thanks Received: 11,527



patbateman View Post
So the Bars Ago function only works in strategies...



I might not understand either, but bars ago should be working in an indicator:


Reply With Quote
Thanked by:




Last Updated on January 13, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts