Paint charts based on Line crossovers on an oscillator - NinjaTrader Programming | futures io social day trading
futures io futures trading


Paint charts based on Line crossovers on an oscillator
Updated: Views / Replies:92 / 3
Created: by KillerJukeBox 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 100,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
 

Paint charts based on Line crossovers on an oscillator

  #1 (permalink)
Elite Member
Dublin
 
Trading Experience: Beginner
Platform: Tradestation, Ninjatrader
Favorite Futures: YM, ES
 
KillerJukeBox's Avatar
 
Posts: 28 since Oct 2018
Thanks: 8 given, 10 received

Paint charts based on Line crossovers on an oscillator

I'm trying to incorporate some rules into a CCI indicator so that it paints my charts a particular colour when certain conditions are met.

Here is the psuedo-code for the rules:

if CCI >=100, paint the chart green.
if CCI >=200 , paint the chart dark green.

if CCI <=-100, paint the chart red.
if CCI <=-200, paint the chart dark red.


This bit works fine, as you can see.
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


I'm having problems implementing the rule below:

if CCI crossing above -100, continue painting the chart red until it hits either 0 or +100 (set by a variable).
if CCI crossing below +100, continue painting the chart green until it hits either 0 or -100 (set by a variable).


I want to create a rule so that when CCI travels from -100 to +100 (or from +100 to -100) it will continue to paint whatever it was painting previously when it entered that range.

Here is my current code:

VARIABLES:
 
Code
double CurrentCCI = CCI(14)[0];
double PreviousCCI = CCI(14)[1];
double mean = 0;
double sma0 = sma[0];

 
Code
	//Paint Backgrounds according to CCI.
				if(CurrentCCI >=100)
				{
					//BackBrushesAll[1] = Brushes.White; // Repaint 1 bar when we change direction.
						BackBrushAll = iBrushBackUp;
					 if(CurrentCCI >=200)
					{
						BackBrushAll = iBrushCloseLong;
						//BackBrushesAll[1] = Brushes.Gold; //Repaint 1 bar when we change direction.
					} 
					
					
				}
				
				else if(CurrentCCI <=-100)
				{
					BackBrushAll = iBrushBackDown;
					
					 if(CurrentCCI <=-200)
					{
						BackBrushAll = iBrushCloseShort;
					} 
					
				}
What's the best method to describe this rule?

Ive tried the below using some booleans ("bullish","bearish") , but i'm missing something simple I think.

 
Code
if(CurrentCCI <0){
						
						if(bullish == true){
						BackBrushAll = iBrushBackUp;	
						}
						
						if(bearish == true){
							BackBrushAll = iBrushBackDown;
						}
						
						 if(CurrentCCI <=-100)
							 
							{
								BackBrushAll = iBrushBackDown;
								bullish = false;
								bearish = true;
								
											if (CurrentCCI <=-200)
											{
												BackBrushAll = iBrushCloseShort;
												bearish = false;
											}
							}
					}
 
Code
if(CurrentCCI >0){
					
						if(bullish == true){
						BackBrushAll = iBrushBackUp;	
						}
						
						if(bearish == true){
							BackBrushAll = iBrushBackDown;
						}
						
							if(CurrentCCI >=100){
						
					//BackBrushesAll[1] = Brushes.White; // Repaint 1 bar when we change direction.
						BackBrushAll = iBrushBackUp;
						bullish = true;
						bearish = false;
								
								if(CurrentCCI >=200)
								{
									
									BackBrushAll= iBrushCloseLong;
									bullish = false;
								}		
					}
							
					}
Any thoughts welcome!

Ive exported the current version and attached it.

Attached Files
Register to download File Type: zip CCI_Chart_PAINT.zip (5.2 KB, 5 views)

Last edited by KillerJukeBox; December 23rd, 2018 at 08:21 PM. Reason: attached a copy of the indicator
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
Dublin
 
Trading Experience: Beginner
Platform: Tradestation, Ninjatrader
Favorite Futures: YM, ES
 
KillerJukeBox's Avatar
 
Posts: 28 since Oct 2018
Thanks: 8 given, 10 received


Nevermind. A good night's sleep makes this obvious again.

Happy Xmas peeps!

Reply With Quote
 
  #4 (permalink)
Trading for Fun
Hyderabad,India
 
Trading Experience: Advanced
Platform: R Trader Pro
Favorite Futures: Futures
 
Posts: 85 since Oct 2013
Thanks: 40 given, 16 received

Good looking chart!!! LOVE IT!!!

Happy Christmas.

Reply With Quote

Reply



futures io > > > > > Paint charts based on Line crossovers on an oscillator

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Journal Challenge $1600 in Prizes & Free Journalytix for all participants!

February
 

Trading Resolutions for 2019 - Avoiding Mistakes w/GFF Brokers

Feb 19
 

3 Excellent Entries, and How To Automate Them w/Kevin Davey

Feb 21
 

The Driving Force Behind the Market w/Earn2Trade

Mar 5
 

TBA w/Stage5 & iSystems

Mar 12
 

TBA w/John Grady @ No BS Day Trading

Mar 19
 

Day Trading Oil Futures: Reducing Risk & Increasing Profits w/DTN IQFeed

Mar 26
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone find any edge with activity based charts over time based charts? LaissezFaire Traders Hideout 31 May 20th, 2018 12:15 PM
Moving Average Crossovers With Alerts gunflint NinjaTrader 21 April 26th, 2018 01:24 PM
Converting time based charts to volume and tick based charts SeanKozak Commodities Futures Trading 1 April 1st, 2014 10:05 PM
Two Independent Crossovers / Timing Check zeller4 NinjaTrader Programming 3 June 6th, 2010 08:07 AM
SMA "crossovers" kaywai NinjaTrader Programming 19 December 31st, 2009 10:54 AM


Tags
cci, code, crossovers, indicator, indicators, ninjascript, ninjatrader, oscillator, repainting, sma, variable, white

All times are GMT -4. The time now is 04:16 PM. (this page content is cached, log in for real-time version)

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business, 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 2019-02-16 in 0.17 seconds with 14 queries on phoenix