NexusFi: Find Your Edge


Home Menu

 





Determining the 'Last' Bar


Discussion in NinjaTrader

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




 
Search this Thread

Determining the 'Last' Bar

  #1 (permalink)
 
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 Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Better Renko Gaps
The Elite Circle
Cheap historycal L1 data for stocks
Stocks and ETFs
Strategy stop orders partially filled
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Funded Trader platforms
32 thanks
Just another trading journal: PA, Wyckoff & Trends
23 thanks
Trading with Intuition
17 thanks
Self sabotage reframed
13 thanks
ApexTraderFunding.com experience and review
10 thanks
  #3 (permalink)
 
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,482 since Jun 2009
Thanks Given: 33,252
Thanks Received: 101,682


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 Reply With Quote
Thanked by:
  #4 (permalink)
 
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 Reply With Quote
  #5 (permalink)
 
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 Reply With Quote




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