CCI Cross Zero Line Indicator - NinjaTrader Programming | futures io social day trading
futures io futures trading


CCI Cross Zero Line Indicator
Updated: Views / Replies:7,323 / 13
Created: by Senna Attachments:6

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

CCI Cross Zero Line Indicator

  #1 (permalink)
Elite Member
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: AMP/CQG
Favorite Futures: ES, 6E, TF
 
Posts: 8 since Feb 2010
Thanks: 2 given, 4 received

CCI Cross Zero Line Indicator

Hi guys,

I was trying to develop an indicator that draws an up arrow under the price bar or a down arrow above the bar for when the CCI crosses above or below the 0 line. I came up with the code below so far but me not being a programmer I'm really struggling to move forward. Can anyone help me complete the indicator. I'm getting error CS1513 line 58 but I don't know how to fix it.

Thank you,

#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Draw Arrow when 50 and 14 CCI cross the zero line together
/// </summary>
[Description("Draw Arrow when 50 and 14 CCI cross the zero line together")]
public class MyCCICross : Indicator
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion

/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
Overlay = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(CCI(14), 0, 1)
&& CrossAbove(CCI(50), 0, 1))
{
DrawArrowUp("My up arrow" + CurrentBar, false, 0, 0, Color.Lime);
}

// Condition set 2
if (CrossBelow(CCI(14), 0, 1)
&& CrossBelow(CCI(50), 0, 1))
{
DrawArrowDown("My down arrow" + CurrentBar, false, 0, 0, Color.Red);
}

#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Plot0
{
get { return Values[0]; }
}

[Description("")]
[GridCategory("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}

#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private MyCCICross[] cacheMyCCICross = null;

private static MyCCICross checkMyCCICross = new MyCCICross();

/// <summary>
/// Draw Arrow when 45 and 6 CCI cross the zero line together
/// </summary>
/// <returns></returns>
public MyCCICross MyCCICross(int myInput0)
{
return MyCCICross(Input, myInput0);
}

/// <summary>
/// Draw Arrow when 50 and 14 CCI cross the zero line together
/// </summary>
/// <returns></returns>
public MyCCICross MyCCICross(Data.IDataSeries input, int myInput0)
{
if (cacheMyCCICross != null)
for (int idx = 0; idx < cacheMyCCICross.Length; idx++)
if (cacheMyCCICross[idx].MyInput0 == myInput0 && cacheMyCCICross[idx].EqualsInput(input))
return cacheMyCCICross[idx];

lock (checkMyCCICross)
{
checkMyCCICross.MyInput0 = myInput0;
myInput0 = checkMyCCICross.MyInput0;

if (cacheMyCCICross != null)
for (int idx = 0; idx < cacheMyCCICross.Length; idx++)
if (cacheMyCCICross[idx].MyInput0 == myInput0 && cacheMyCCICross[idx].EqualsInput(input))
return cacheMyCCICross[idx];

MyCCICross indicator = new MyCCICross();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
indicator.MyInput0 = myInput0;
Indicators.Add(indicator);
indicator.SetUp();

MyCCICross[] tmp = new MyCCICross[cacheMyCCICross == null ? 1 : cacheMyCCICross.Length + 1];
if (cacheMyCCICross != null)
cacheMyCCICross.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheMyCCICross = tmp;
return indicator;
}
}
}
}

// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// Draw Arrow when 50 and 14 CCI cross the zero line together
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.MyCCICross MyCCICross(int myInput0)
{
return _indicator.MyCCICross(Input, myInput0);
}

/// <summary>
/// Draw Arrow when 50 and 14 CCI cross the zero line together
/// </summary>
/// <returns></returns>
public Indicator.MyCCICross MyCCICross(Data.IDataSeries input, int myInput0)
{
return _indicator.MyCCICross(input, myInput0);
}
}
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Draw Arrow when 50 and 14 CCI cross the zero line together
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.MyCCICross MyCCICross(int myInput0)
{
return _indicator.MyCCICross(Input, myInput0);
}

/// <summary>
/// Draw Arrow when 45 and 6 CCI cross the zero line together
/// </summary>
/// <returns></returns>
public Indicator.MyCCICross MyCCICross(Data.IDataSeries input, int myInput0)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

return _indicator.MyCCICross(input, myInput0);
}
}
}
#endregion

Reply With Quote
The following user says Thank You to Senna for this post:
 
  #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
Houston,Tx
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: TF
 
ThatManFromTexas's Avatar
 
Posts: 2,302 since Feb 2010
Thanks: 1,208 given, 4,293 received


@NickFaria
... ask and yea shall receive ...


TMFTCCIwArrows.zip

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

I'm just a simple man trading a simple plan.

My daddy always said, "Every day above ground is a good day!"
Reply With Quote
The following 8 users say Thank You to ThatManFromTexas for this post:
 
  #4 (permalink)
Elite Member
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: AMP/CQG
Favorite Futures: ES, 6E, TF
 
Posts: 8 since Feb 2010
Thanks: 2 given, 4 received

That's it. Thank you Mr Texas.

Reply With Quote
 
  #5 (permalink)
Elite Member
Los Angeles, CA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: AMP/CQG
Favorite Futures: ES, 6E, TF
 
Posts: 8 since Feb 2010
Thanks: 2 given, 4 received

Actually Mr. Texas it is almost what I was looking for. Sorry for my poor explanation on my first trial. I wanted the Arrow to be drawn when both the 50 and 14 CCI (or 45 and 6 CCI as attached chart) crossed the 0 line at the same time. So 2 different speed CCIs cross the zero line together. It would also be nice to have the ability to change the period for both CCIs so I can try different combinations. Also nice would be to have it calculating as it happens and not only in the close of the bar. If it's possible I'd appreciate it.

Attached is a chart with a blue arrow indicating where the double cross I'm looking for is happening.

Thank you again,

Nick Faria

Attached Thumbnails
CCI Cross Zero Line Indicator-double-cci-cross.jpg  
Reply With Quote
 
  #6 (permalink)
Elite Member
Houston,Tx
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: TF
 
ThatManFromTexas's Avatar
 
Posts: 2,302 since Feb 2010
Thanks: 1,208 given, 4,293 received


NickFaria View Post
Actually Mr. Texas it is almost what I was looking for. Sorry for my poor explanation on my first trial. I wanted the Arrow to be drawn when both the 50 and 14 CCI (or 45 and 6 CCI as attached chart) crossed the 0 line at the same time. So 2 different speed CCIs cross the zero line together. It would also be nice to have the ability to change the period for both CCIs so I can try different combinations. Also nice would be to have it calculating as it happens and not only in the close of the bar. If it's possible I'd appreciate it.

Attached is a chart with a blue arrow indicating where the double cross I'm looking for is happening.

Thank you again,

Nick Faria

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


TMFTCCIwArrowsv2.zip

Updated 11:19 Central

I'm just a simple man trading a simple plan.

My daddy always said, "Every day above ground is a good day!"

Last edited by ThatManFromTexas; May 31st, 2011 at 01:19 AM.
Reply With Quote
The following 5 users say Thank You to ThatManFromTexas for this post:
 
  #7 (permalink)
Elite Member
Holland, Michigan
 
Futures Experience: None
Platform: ninjatrader
Broker/Data: CQG
Favorite Futures: Acoustic Guitar
 
trs3042's Avatar
 
Posts: 1,802 since Jun 2009
Thanks: 23,771 given, 5,600 received


ThatManFromTexas View Post
Attachment 39638

Attachment 39640

Updated 11:19 Central

Hello @TMFT,

Wondering if you could add a color selectable zero line to this indicator. Never realized how accustomed my eyes have gotten to viewing that zero line on other indies.

TIA,

Rick

Attached Files
Register to download File Type: zip TMFTCCIwArrowsv2.zip (7.6 KB, 149 views)
Reply With Quote
 
  #8 (permalink)
Elite Member
Houston,Tx
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: TF
 
ThatManFromTexas's Avatar
 
Posts: 2,302 since Feb 2010
Thanks: 1,208 given, 4,293 received


trs3042 View Post
Hello @TMFT,

Wondering if you could add a color selectable zero line to this indicator. Never realized how accustomed my eyes have gotten to viewing that zero line on other indies.

TIA,

Rick

Do you want it to do anything besides show color? In the past I wrote different versions that would show EMA Slope, Moving average Cross overs, etc.

Look through Jeff Castille's thread on the CCI. There are lots of examples there.

Let me know.

Regards,
TMFT

I'm just a simple man trading a simple plan.

My daddy always said, "Every day above ground is a good day!"
Reply With Quote
The following user says Thank You to ThatManFromTexas for this post:
 
  #9 (permalink)
Elite Member
Holland, Michigan
 
Futures Experience: None
Platform: ninjatrader
Broker/Data: CQG
Favorite Futures: Acoustic Guitar
 
trs3042's Avatar
 
Posts: 1,802 since Jun 2009
Thanks: 23,771 given, 5,600 received


ThatManFromTexas View Post
Do you want it to do anything besides show color? In the past I wrote different versions that would show EMA Slope, Moving average Cross overs, etc.

Look through Jeff Castille's thread on the CCI. There are lots of examples there.

Let me know.

Regards,
TMFT

Just color would be fine.

Thanks,

Rick

Reply With Quote
 
  #10 (permalink)
Elite Member
London
 
Futures Experience: Intermediate
Platform: ninjatrader, multicharts, MT4
Broker/Data: IB, PFG Best
Favorite Futures: 6E, EMD, TF
 
Posts: 256 since Jul 2009
Thanks: 109 given, 145 received



ThatManFromTexas View Post
@NickFaria
... ask and yea shall receive ...


Attachment 39617

Attachment 39618

Thanks TMFT just what i was looking for

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

Reply



futures io > > > > > CCI Cross Zero Line Indicator

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
macd cross indicator wanted trdr NinjaTrader Programming 8 October 27th, 2012 04:40 PM
Stochastics Cross Indicator DennisA NinjaTrader 1 March 30th, 2011 07:30 PM
When Do Tweets Cross the Line? A Subcontractor's Case Quick Summary News and Current Events 0 March 9th, 2011 12:50 PM
simple strategy to enter CCI cross +45/-45 emini_Holy_Grail NinjaTrader Programming 5 January 8th, 2011 10:48 AM
Exit using CCI Indicator kian123 NinjaTrader Programming 4 November 17th, 2010 09:23 AM


All times are GMT -4. The time now is 02:35 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-14 in 0.16 seconds with 20 queries on phoenix via your IP 54.221.76.68