Been at it for hours...Definitely something simple!!! AHHHHH - NinjaTrader Programming | futures io social day trading
futures io futures trading


Been at it for hours...Definitely something simple!!! AHHHHH
Updated: Views / Replies:1,559 / 23
Created: by Tanju23 Attachments:4

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
 4  
 
Thread Tools Search this Thread
 

Been at it for hours...Definitely something simple!!! AHHHHH

  #1 (permalink)
Elite Member
Riverview Fl
 
Futures Experience: Intermediate
Platform: Ninja Trader
Broker/Data: Mirus Futures
Favorite Futures: ES, TF
 
Tanju23's Avatar
 
Posts: 37 since Dec 2009
Thanks: 24 given, 4 received

Been at it for hours...Definitely something simple!!! AHHHHH



I literally have been at this for hours. I have managed to get the line to be 2 solid colors no matter what I try and the fact that I know its something simple is killing me.
I trying to get the average to change colors when one of two conditions are met, then change if the opposite first or second condition is met.
Please help if its something simple, if its not let me know and ill keep trying. Maybe just some insight to get me in the right direction.

on a side note, I didn't know how to get the code on my post in the little code window that I see all over the forum. How do you do that?

{
if (High[0] > Swing(swings).SwingHigh[0]);
else if (Low[0] >= EMA(keltner)[0] + Spread * TickSize);

{
PlotColors[0][0] = sMAUp;
}
}

{
if (Low[0] < Swing(swings).SwingLow[0]);
else if (High[0] <= EMA(keltner)[0] - Spread * TickSize);

{
PlotColors[0][0] = sMADn;
}
}

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
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received


@Tanju23,

To fix your code remove the semicolon ";" from your if/else if lines:

 
Code
if (High[0] > Swing(swings).SwingHigh[0])
{
    // something
}
else if (Low[0] >= EMA(keltner)[0] + Spread * TickSize)
{
    PlotColors[0][0] = sMAUp;
}
if (Low[0] < Swing(swings).SwingLow[0])
{
    // something
}
else if (High[0] <= EMA(keltner)[0] - Spread * TickSize)
{
    PlotColors[0][0] = sMADn;
}
to put the code in the code box - there is a hash "#" button in the toolbar (that's where you change the fonts) - this will give you the right tags for code.

Reply With Quote
 
  #4 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received

If you are rather new to programming then I would also recommend to ALWAYS use curly braces with conditions ie: never leave the if, else if and else without accompanying curly braces. So that after closing bracket there are always curly braces (even if empty!):

 
Code
if (someCondition == true)
{
}
else 
{
}
This will help you to avoid many problems at the start.

Reply With Quote
 
  #5 (permalink)
Elite Member
Riverview Fl
 
Futures Experience: Intermediate
Platform: Ninja Trader
Broker/Data: Mirus Futures
Favorite Futures: ES, TF
 
Tanju23's Avatar
 
Posts: 37 since Dec 2009
Thanks: 24 given, 4 received

Thanks for the response. When I try what you say....
 
Code
{
				// If high breaks a swing high
				if (High[0] > Swing(swings).SwingHigh[0])
				// If low is greater than Keltner MB a certain # of ticks
				else if (Low[0] >= EMA(keltner)[0] + Spread * TickSize)
				
				{
					PlotColors[0][0] = sMAUp;
				}
			}
			
			{
				// If low breaks a swing low
				if (Low[0] < Swing(swings).SwingLow[0])
				// If high is less than Keltner MB a certain # of ticks
				else if (High[0] <= EMA(keltner)[0] - Spread * TickSize)
				
				{
					PlotColors[0][0] = sMADn;
				}
			}

It displays these errors. Am i not using the else if in the proper function for a comparison of the 2 conditions?
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
 
  #6 (permalink)
Elite Member
Riverview Fl
 
Futures Experience: Intermediate
Platform: Ninja Trader
Broker/Data: Mirus Futures
Favorite Futures: ES, TF
 
Tanju23's Avatar
 
Posts: 37 since Dec 2009
Thanks: 24 given, 4 received

just saw your most recent response, i will try that.

Reply With Quote
 
  #7 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received

It is not clear from your code but it seems to me that this is what you were trying to achieve:
 
Code
// If high breaks a swing high
if (High[0] > Swing(swings).SwingHigh[0])
{
    // If low is greater than Keltner MB a certain # of ticks
    if (Low[0] >= EMA(keltner)[0] + Spread * TickSize)
    {
        PlotColors[0][0] = sMAUp;
     }
}		
// If low breaks a swing low
if (Low[0] < Swing(swings).SwingLow[0])
{
    // If high is less than Keltner MB a certain # of ticks
    if (High[0] <= EMA(keltner)[0] - Spread * TickSize)
    {
        PlotColors[0][0] = sMADn;
    }
}
Also, you have some superfluous braces used for separation of the code (eg. before your if statement) - this is not a good practice either for a beginner - use the braces after a condition/method etc. not before:

 
Code
//Bad:
{
if(something)
}

//Good:
if(something)
{
}


Last edited by gregid; March 31st, 2015 at 08:56 AM. Reason: Lost one brace
Reply With Quote
The following user says Thank You to gregid for this post:
 
  #8 (permalink)
Elite Member
Riverview Fl
 
Futures Experience: Intermediate
Platform: Ninja Trader
Broker/Data: Mirus Futures
Favorite Futures: ES, TF
 
Tanju23's Avatar
 
Posts: 37 since Dec 2009
Thanks: 24 given, 4 received

After separating with brackets like you said I am actually making progress.

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


It initially changes to magenta and should stay until one of the"up" conditions are met. Is there something that i am missing that would keep the 2 sets of conditions separate? And you guessed it, I am new to programming. Just starting to get my feet wet.


Reply With Quote
 
  #9 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received

If you want the condition to trigger to either of the 2 - you need to use or: "||"

 
Code
if (condition1 || condition2)
{
    //change color
}

Reply With Quote
The following user says Thank You to gregid for this post:
 
  #10 (permalink)
Elite Member
Riverview Fl
 
Futures Experience: Intermediate
Platform: Ninja Trader
Broker/Data: Mirus Futures
Favorite Futures: ES, TF
 
Tanju23's Avatar
 
Posts: 37 since Dec 2009
Thanks: 24 given, 4 received


Thank you, gonna give that a try now.

Reply With Quote

Reply



futures io > > > > > Been at it for hours...Definitely something simple!!! AHHHHH

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ahhhhh the wisdom of the ages. kbit Jokes 0 April 1st, 2014 09:08 PM
Trading After Hours ligfing The Elite Circle 4 November 2nd, 2012 04:03 PM
After-hours Trading benharrell Traders Hideout 12 August 20th, 2010 11:24 AM
A few points in first one to 1.5 hours? Nimble The Elite Circle 4 July 28th, 2010 08:58 PM
Market Hours LukeGeniol Help, Tutorials, and How-Tos 0 July 8th, 2010 08:09 PM


All times are GMT -4. The time now is 02:11 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-15 in 0.12 seconds with 20 queries on phoenix via your IP 54.82.56.95