NexusFi: Find Your Edge


Home Menu

 





Why do markers stop painting even tho no compile errors


Discussion in NinjaTrader

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




 
Search this Thread

Why do markers stop painting even tho no compile errors

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

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:	218
Size:	36.4 KB
ID:	1223  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
41 thanks
Just another trading journal: PA, Wyckoff & Trends
30 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
21 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,446 since Jun 2009
Thanks Given: 33,217
Thanks Received: 101,608

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 Twitter 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: 485 since Jun 2009
Thanks Given: 232
Thanks Received: 415


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: 295


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: 485 since Jun 2009
Thanks Given: 232
Thanks Received: 415

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


© 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