NexusFi: Find Your Edge


Home Menu

 





indicator will not plot


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one MilfordT with 2 posts (0 thanks)
    2. looks_two Big Mike with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 cory with 1 posts (0 thanks)
    1. trending_up 2,347 views
    2. thumb_up 1 thanks given
    3. group 4 followers
    1. forum 5 posts
    2. attach_file 3 attachments




 
Search this Thread
  #1 (permalink)
MilfordT
Dallas, Texas
 
Posts: 2 since Aug 2012
Thanks Given: 0
Thanks Received: 0

Hi I'm fairly new to NT and so am not good at it as you may have surmised from the title.

I made an indicator starting with the wizard to plot a dot at the High of Up bars or the Low of Down bars when the percentage of a bars body is <= 49%

I have wasted a few hours trying different things to get it to work.

Attached is a picture of my code and of the Settings.
Please ignore the NumCdls input as that is not being used.

Any help will be greatly appreciated.

Milford.


Attached Thumbnails
Click image for larger version

Name:	code pic.png
Views:	296
Size:	135.4 KB
ID:	160267   Click image for larger version

Name:	indicator settings.png
Views:	254
Size:	28.6 KB
ID:	160268   Click image for larger version

Name:	Data Series.png
Views:	218
Size:	34.8 KB
ID:	160269  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Warsh Confirmed 54-45 on PPI Day -- 97% Say He Holds in …
Prediction Markets & Event Contracts
Day 96 Missiles Hit Kuwait and Bahrain: June 15 Peace at …
Prediction Markets & Event Contracts
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
Roland Garros Final Day: $3M on Zverev at 80.5% -- Leban …
Prediction Markets & Event Contracts
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 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,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,577


You aren't testing for CurrentBar > 1 first. If you check the Log, it will tell you as much.

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
  #4 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,117

I think you will run into 3 problems:


(1) For the first bar of your chart, which is CurrentBar = 0, you cannot access Close[1] or Open[1], because it does not exist. Therefore, you need insert a line in the beginning of OnBarUpdate()


 
Code
if(CurrentBar < 1) 
   return;

(2) There are bars that have a zero range when high = low. In that case you will run into a division by zero problem, which you need to exclude.

(3) Rather than using the Plot method to place a dot above or below the current bar, I would use the NinjaScript method DrawDot(), which allows you draw a margin above the high or below the low. If you use the Plot method, you may get unwanted dots, even if you have set no values to the plot.


Reply With Quote
Thanked by:
  #5 (permalink)
MilfordT
Dallas, Texas
 
Posts: 2 since Aug 2012
Thanks Given: 0
Thanks Received: 0


Fat Tails View Post
I think you will run into 3 problems:


(1) For the first bar of your chart, which is CurrentBar = 0, you cannot access Close[1] or Open[1], because it does not exist. Therefore, you need insert a line in the beginning of OnBarUpdate()


 
Code
if(CurrentBar < 1) 
   return;

(2) There are bars that have a zero range when high = low. In that case you will run into a division by zero problem, which you need to exclude.

(3) Rather than using the Plot method to place a dot above or below the current bar, I would use the NinjaScript method DrawDot(), which allows you draw a margin above the high or below the low. If you use the Plot method, you may get unwanted dots, even if you have set no values to the plot.

Thank you so much for this quick reply.
I am now doing the CurrentBar check, making sure I don't divide by zero, and am using DrawDot.
It is now working like champ!

Also discovered where log is! Guess I was pretty much flying blind

Should of come around sooner and saved a few hours

thanks again.

Milford


Reply With Quote
  #6 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,099 since Jun 2009
Thanks Given: 877
Thanks Received: 8,098


MilfordT View Post
Thank you so much for this quick reply.
I am now doing the CurrentBar check, making sure I don't divide by zero, and am using DrawDot.
It is now working like champ!

Also discovered where log is! Guess I was pretty much flying blind

Should of come around sooner and saved a few hours

thanks again.

Milford

use plot but if you dont want to see it you can plot Plot0.Reset.


Reply With Quote




Last Updated on October 6, 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