I'm a Ninjascript Newbie and need some help - NinjaTrader Programming | futures io social day trading
futures io futures trading


I'm a Ninjascript Newbie and need some help
Updated: Views / Replies:2,511 / 5
Created: by suprsnipes Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

I'm a Ninjascript Newbie and need some help

  #1 (permalink)
Just starting out...
Melbourne, Australia
 
Futures Experience: Advanced
Platform: Custom
 
suprsnipes's Avatar
 
Posts: 6 since Nov 2009
Thanks: 4 given, 0 received

I'm a Ninjascript Newbie and need some help

Hi Guys,

I have coded a very basic NinjaTrader indicator but I am having some trouble trying to work out how I could move forward with it.

At the moment the indicator draws lines from the open (using the NinjaTrader CurrentDayOHL indicator). It draws horizontal lines 50 and 100 ticks above and below the open price.

What I would like to do is ONLY display the horizontal line that is nearest to the current price as I have found that by displaying the 4 lines mentioned above or any more for that matter it squashes the chart considerably.

So in effect if if the price was still close to the open then I would only want to display two of the horizontal lines the 50 ticks above the open and 50 ticks below the open ... or ... if the price was above the open by say 60 ticks then I would only like to display the horizontal line 100 ticks above the open and 50 ticks below the open.

Also if the price has already been to one of the aforementioned prices then I don't want to display that level again during the session.

I would really, really appreciate the help.

Thanks in advance,
suprsnipes

P.S. I have attached the .zip file

Attached Files
Register to download File Type: zip MyCustomIndicator1.zip (3.9 KB, 8 views)
Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Neubrandenburg, Germany
 
Futures Experience: Advanced
Platform: R
Favorite Futures: Stocks
 
wh's Avatar
 
Posts: 538 since Jun 2009
Thanks: 297 given, 480 received


perhaps you add in onbarupdate()

if(CurrentBar < 2) return;

if intraday calc the bar to daily mean 1 min are 1440 bars for a day ...

Causality is the relationship between an event (the cause) and a second event (the effect), where the second event is a consequence of the first.
Reply With Quote
The following user says Thank You to wh for this post:
 
  #4 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,220 received

To avoid "squashing" the chart, change AutoScale to false in the indicator menu, or add AutoScale = false in #initialize.

If you want to test for what line is closest, use a Math.Min/Math.Max statement compared with Close.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following 2 users say Thank You to Big Mike for this post:
 
  #5 (permalink)
Just starting out...
Melbourne, Australia
 
Futures Experience: Advanced
Platform: Custom
 
suprsnipes's Avatar
 
Posts: 6 since Nov 2009
Thanks: 4 given, 0 received


wh View Post
perhaps you add in onbarupdate()

if(CurrentBar < 2) return;

if intraday calc the bar to daily mean 1 min are 1440 bars for a day ...

Thanks for the reply wh.

As suggested I should place this in onbarupdate() but does it go underneath the existing code? I'm not quite sure what to do here.


Big Mike View Post

Big Mike To avoid "squashing" the chart, change AutoScale to false in the indicator menu, or add AutoScale = false in #initialize.

If you want to test for what line is closest, use a Math.Min/Math.Max statement compared with Close.

Mike

No problem with the suggestion to add AutoScale to false option within the script Big Mike but as per above I am stuck with achieving what I was originally after. If any of you NinjaScript Wizards have some spare time I would really appreciate it if you could perhaps point me in the right direction here.

Regards,
suprsnipes

Reply With Quote
 
  #6 (permalink)
Market Wizard
virginia
 
Futures Experience: Intermediate
Platform: ninja
Favorite Futures: ES
 
cory's Avatar
 
Posts: 5,216 since Jun 2009
Thanks: 628 given, 6,314 received
Forum Reputation: Legendary

the trick is looking at some scripts you think that is close to what you are looking for.

randomly open the first script I see
 
Code
protected override void OnBarUpdate()
        {
			if (CurrentBar == 0) { // first bar initialization
				lasthi = hi[0] = useHiLo ? High[0] : Input[0];
				lastlo = lo[0] = useHiLo ? Low[0] : Input[0];
				lasthibar = lastlobar = 0;
				return;
...
so looks like you just need to add the code right under onbarupdate()


another script;
 
Code
	protected override void Initialize()
		{
			Add(new Plot(new Pen(Color.Lime, 4), PlotStyle.Bar, "MacdUp"));
			Add(new Plot(new Pen(Color.Red, 4), PlotStyle.Bar, "MacdDown"));
			Add(new Plot(new Pen(Color.Yellow, 4), PlotStyle.Bar, "MacdDown"));
			Add(new Plot(new Pen(Color.DarkGray, 1), PlotStyle.Line, "Avg"));

			Add(new Line(Color.DarkGray, 0, "Zero line"));

			macd	= new DataSeries(this);
			fastEma	= new DataSeries(this);
			slowEma	= new DataSeries(this);
			
			DisplayInDataBox = false; 
            CalculateOnBarClose = false;
			PaintPriceMarkers = false; 
		}
...
there is no scale = false but looks like you should put it there in the Initialize()

Reply With Quote
The following user says Thank You to cory for this post:

Reply



futures io > > > > > I'm a Ninjascript Newbie and need some help

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ninjascript errors incometrade NinjaTrader Programming 10 November 6th, 2015 03:29 PM
NinjaScript Coding crazyhorse2393 NinjaTrader Programming 19 August 3rd, 2014 09:11 PM
NinjaScript is beating me jtradr NinjaTrader Programming 11 January 13th, 2011 11:27 PM
Ninjascript Optimizations shodson NinjaTrader Programming 3 June 25th, 2010 04:50 AM
Ninjascript How TO spinnybobo NinjaTrader Programming 2 October 29th, 2009 11:34 AM


All times are GMT -4. The time now is 09:46 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-12 in 0.10 seconds with 20 queries on phoenix via your IP 54.221.93.187