NexusFi: Find Your Edge


Home Menu

 





Why do markers stop painting even tho no compile errors


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 482 since Jun 2009
Thanks Given: 232
Thanks Received: 416

1. The attached code shows line 83 encircled. If this is commented out, the code above it (lines 55 through 78) execute correctly... uncommented, they don't. There are no compile errors either way.

2. I am trying to set up variables in order to test whether or not Stochastics(1,20,3).K is rising... while I understand that I can use the "Rising" method directly on the Stochastics data series, what is there about line 83 that can cause the above lines to be in error?

TIA

[also posted in the NT Forum]


Attached Thumbnails
Click image for larger version

Name:	Code stops working when line 83 not commented out 1.png
Views:	306
Size:	36.4 KB
ID:	1223  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Topstep Acquires The Futures Desk -- Prop Firm Consolida …
Funded Trading Evaluation Firms
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
The May 31 Binary: 60% Trump Declares Iran Ops Over, Onl …
Prediction Markets & Event Contracts
February NFP Preview -- Why This Mornings Jobs Number Co …
Traders Hideout
Kharg Island at 6%, Regime Fall at 1.5% -- The Black Swa …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
23 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 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

Because the Index of 1 doesn't exist yet.

You'll see an index error in the Log.

Add:

if (CurrentBar < 1) return;

To the top of the OnBarUpdate() section.

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
  #3 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 482 since Jun 2009
Thanks Given: 232
Thanks Received: 416


ahh.. thanks... forgot all about that pesky "are there enuf bars yet" thing...

what about the Stochastics 540? do I need to do "if (CurrentBar < 540) return;" ?It doesn't seem to be causing any problems although it doesn't have that painted at the beginning of the chart.


Started this thread Reply With Quote
  #4 (permalink)
 
roonius's Avatar
 roonius   is a Vendor
 
Posts: 131 since Jun 2009
Thanks Given: 20
Thanks Received: 298


Saroj View Post
ahh.. thanks... forgot all about that pesky "are there enuf bars yet" thing...

what about the Stochastics 540? do I need to do "if (CurrentBar < 540) return;" ?It doesn't seem to be causing any problems although it doesn't have that painted at the beginning of the chart.

You need to make sure that you have enough bars when you reference bars back
For example:

SMA(200)[0] - ok - you are referencing the last bar


SMA(200)[200] - you are referencing a bar 200 bars back. So you need to add:
if (currentBar < 200) return;

SMA(200) - 200 in parameters is checked inside SMA itself.


Reply With Quote
  #5 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 482 since Jun 2009
Thanks Given: 232
Thanks Received: 416

thanks roonius... appreciate the confirmation... I set it to 541 since I use a BB540 and a stochastic 540... and ... on a personal note... hope you enjoy living in Chicago as much as I did (well... Evanston, but mostly worked in center city)... best city in the U.S.A.!


Started this thread Reply With Quote




Last Updated on August 14, 2009


© 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