NexusFi: Find Your Edge


Home Menu

 





Determining the 'Last' Bar


Discussion in NinjaTrader

Updated
    1. trending_up 7,046 views
    2. thumb_up 1 thanks given
    3. group 0 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
 

Determining the 'Last' Bar

 
 
srgtroy's Avatar
 srgtroy 
Los Angeles, California Republic
Legendary  R.I.P. 1965-2023 
 
Experience: None
Platform: Sierra Chart
Broker: CQG
Trading: ES
Posts: 1,928 since Jan 2011
Thanks Given: 1,375
Thanks Received: 3,722

In ThinkScript, you can use the following statement:

If IsNan(Close[-1]) then 1 else 0;

to determine if the bar being 'processed' is the last one or if there are more bars ahead of it.

I tried to do this in NinjaScript using Double.IsNan(Close[-1]) but it doesn't work. Is there another way to accomplish this objective?

Thanks!

Started this thread

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Quantum physics & Trading dynamics
The Elite Circle
What broker to use for trading palladium futures
Commodities
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
use extra computer for optimisation
NinjaTrader
 
 
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,469 since Jun 2009
Thanks Given: 33,249
Thanks Received: 101,669


if (Historical)

I think is what you want.

Mike



Join the free Markets Chat beta: one platform, all the trade rooms!

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal
Thanked by:
 
 
srgtroy's Avatar
 srgtroy 
Los Angeles, California Republic
Legendary  R.I.P. 1965-2023 
 
Experience: None
Platform: Sierra Chart
Broker: CQG
Trading: ES
Posts: 1,928 since Jan 2011
Thanks Given: 1,375
Thanks Received: 3,722

Actually, it was my bad.

The statement does work in NinjaScript, but you have to make sure that you use the if (CurrentBar < n) return;
statement properly first. I'm not used to doing this as it is generally not required in ThinkScript.

Started this thread
 
 
srgtroy's Avatar
 srgtroy 
Los Angeles, California Republic
Legendary  R.I.P. 1965-2023 
 
Experience: None
Platform: Sierra Chart
Broker: CQG
Trading: ES
Posts: 1,928 since Jan 2011
Thanks Given: 1,375
Thanks Received: 3,722

For the record,

You were 100% correct Big Mike.

At first, I was only testing the indicator containing the statement on daily charts with Kinetick EOD data. Essentially, those are historical only charts. Once I moved to smaller timeframes with real-time bar updates, my charts started going nuts. I added the historical condition and everything suddenly worked nicely.

Thanks again for your reply!

Started this thread

 



Last Updated on July 11, 2011


© 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