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 cory with 1 posts (0 thanks)
    3. looks_3 Fat Tails with 1 posts (1 thanks)
    4. looks_4 Big Mike with 1 posts (0 thanks)
    1. trending_up 1,730 views
    2. thumb_up 1 thanks given
    3. group 4 followers
    1. forum 5 posts
    2. attach_file 3 attachments




 
Search this Thread

indicator will not plot

  #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:	194
Size:	135.4 KB
ID:	160267   Click image for larger version

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

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

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
Quant vue
Trading Reviews and Vendors
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
How to apply profiles
Traders Hideout
 
  #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,463 since Jun 2009
Thanks Given: 33,236
Thanks Received: 101,661


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 Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103

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,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


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


© 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