Drawing dots based on a condition - NinjaTrader Programming | futures io social day trading
futures io futures trading


Drawing dots based on a condition
Updated: Views / Replies:400 / 3
Created: by rdh009 Attachments:0

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
 

Drawing dots based on a condition

  #1 (permalink)
Elite Member
Providenciales Turks and Caicos
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 3 since Apr 2014
Thanks: 0 given, 0 received

Drawing dots based on a condition

Hi,

I am new to coding in NinjaTrader. I have done some coding in EasyLanguage, AmiBroker and Python, but I'm just a trial and error guy, not a 'proper' coder.

As a first foray into Ninja, I am trying to draw a dot beneath bars based on a condition being true.

if I make my condition as simple as possible, like this:

 
Code
if (Close[0] < Open[0])
-- the dots display correctly.

But, if I try to refer to previous bars, like this:

 
Code
if (Close[0] < Open[1])
-- the code does not work. So, I assume it is the condition itself which I am getting wrong.

Can anybody explain why this change would stop the code working, and how I would correctly refer to previous bars?

Any help appreciated.

Here's the rest of the code.

 
Code
protected override void OnBarUpdate()
        {

			{	
				
				if (Close[0] < Open[0]) 
				//if (Close[1] > Open[1])
				//if(Close[1] < Close[0] && Close[1] < Close[2])
					
					{ 
						myBarCloses=1;
					} else {
						myBarCloses=0;
					}
					
					if (myBarCloses==1) 
					{
						DrawDot(CurrentBar.ToString() +"BarCloseDot",true, 0, Low[0]*0.997, Color.Magenta);
					}
					
			}      
			
        }

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
Providenciales Turks and Caicos
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 3 since Apr 2014
Thanks: 0 given, 0 received


In case anybody else has a need for this information, it requires a check for enough bars in the data series you are accessing.

I don't know whether posting external links is permitted, so I'll assume it is not. A Google search should find the info.

I had to amend the code as below.


 
Code
protected override void OnBarUpdate()
{
    if (CurrentBar < 1)
        return;

    if (Close[0] < Open[1])
        // etc
}

Reply With Quote
 
  #4 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,859 since Jun 2009
Thanks: 480 given, 3,254 received

What do you mean "it does not work"? What exactly do you do and then what happens?
Is this for a strategy or an indicator?
Have you checked the "Log" tab in the "Control Center" for any runtime error messages? If so what do they say?

Reply With Quote

Reply



futures io > > > > > Drawing dots based on a condition

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
Color bar based on alert condition(IF) Neo1 Sierra Chart 2 June 23rd, 2015 02:04 PM
Color a Bar BAsed on an ALert Condition on a Study Traderwolf Sierra Chart 1 November 26th, 2014 09:08 PM
link an exit condition to a particular entry condition vegtrip ThinkOrSwim 0 October 12th, 2013 09:49 AM
How To Forcast Market Condition Based On Pre Market & Overnight Session? SeanKozak Elite Automated Trading 2 February 23rd, 2013 12:18 PM
dots on hi lo themako1 NinjaTrader 3 July 18th, 2011 06:26 PM


All times are GMT -4. The time now is 09:25 AM.

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-13 in 0.08 seconds with 19 queries on phoenix via your IP 54.82.56.95