NexusFi: Find Your Edge


Home Menu

 





No results in NT indicator if "close[>1]" close larger than [1]


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
hallou1
Leipzig
 
Posts: 2 since Feb 2014
Thanks Given: 0
Thanks Received: 0

I want to write an indicator (EOD base used) with the following content:

if (Close[0] < Close[5]
&& Close[0] > SMA(50)[0])

Plot0.Set(1);

My problem is the "close[5]". I get permanent no result. If I change the "close[5]" into "close[1]" can I see correct results. I think anywhere is a problem with the loaded day data. Anybody out there who knows a solution?

Thanks Mike


Reply With Quote

 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #2 (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,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


hallou1 View Post
I want to write an indicator (EOD base used) with the following content:

if (Close[0] < Close[5]
&& Close[0] > SMA(50)[0])

Plot0.Set(1);

My problem is the "close[5]". I get permanent no result. If I change the "close[5]" into "close[1]" can I see correct results. I think anywhere is a problem with the loaded day data. Anybody out there who knows a solution?

Thanks Mike

Most likely you are missing something like:

if (CurrentBar < 5) return;

at the top of your OnBarUpdate.

This would be more obvious if you examined the log error tab.

Mike




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 X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
 
Zondor's Avatar
 Zondor 
Portland Oregon, United States
 
Experience: Beginner
Platform: Ninjatrader®
Broker: CQG, Kinetick
Trading: Gameplay Klownbine® Trading of Globex
Posts: 1,333 since Jul 2009
Thanks Given: 1,246
Thanks Received: 2,734


With current bar <5 you would have been getting an Index Out of Range error that would have crashed the indicator since for those bars, Close[5] does not exist. That's why rejecting bars prior to bar number 5 fixed the problem.


"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.”
Prof. Albert Bartlett
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
hallou1
Leipzig
 
Posts: 2 since Feb 2014
Thanks Given: 0
Thanks Received: 0


Big Mike View Post
Most likely you are missing something like:

if (CurrentBar < 5) return;

at the top of your OnBarUpdate.

This would be more obvious if you examined the log error tab.

Mike

Hallo Big Mike,

thanks for your quick reply. I wrote a short code that display me the closeprice 5 days ago. The result was correct. Tomorrow will I update my screencode and test. One last question: Where can I open the "log error tab"?

Good evening from Germany


Reply With Quote




Last Updated on February 3, 2014


© 2026 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 - Downloads - Top
no new posts