View Full Version : CCI Special Indicator Need Help
jmflukeiii
12-15-2011, 06:06 PM
Can anybody help me find the following:
An indicator that is just a solid bar that prints a color when the CCI is above or below a certain threshold...i.e. when it is above 150 print a color or below 150 print a color and then the color goes away once CCI moves back within the 150 value towards 0?
Thank you.
Also, I screwed up my Gann HiLo indicator like an idiot and can't find another one. I thought there would be one on this forum...
Thank you
NinjaTrader_Joydeep
12-16-2011, 03:48 AM
Hello jmflukeiii,
As part of my training I have created a small script for you. The attached indicator draws a blue/red bar depending on the cci threshold parameter. If you need anything more you can get in touch with any of our NinjaScript Consultants http://www.ninjatrader.com/partners#NinjaScript-Consultants
A quick search gave me this link regarding the GannHiLo indicator http://www.ninjatrader.com/support/forum/showthread.php?t=11509
If it is not the one you are looking for then do search the forum or maybe any community member can guide you to the same.
Please let me know if I can be of any further help.
Regards,
Joydeep.
jmflukeiii
12-16-2011, 04:18 AM
Thank you very much, I really appreciate it. I guess my explanation was a little vague however as I didn't meant the color would go away for ever. I meant, during the period where the CCI was over or under a certain threshold, the indicator would paint that color and it would remain. Once the CCI left the threshold, the indicator would stop painting any color (or just paint a color that the user determines to match their background so it doesn't appear anymore). I do really appreciate the help though.
NinjaTrader_Joydeep
12-16-2011, 05:09 AM
Hello jmflukeiii,
I have reconfigured the indicator. Please download the same again from my previous post (http://www.ninjatrader.com/support/forum/attachment.php?attachmentid=20386&d=1324037160).
Please do let me know if its ok or not.
Regards,
Joydeep.
jmflukeiii
12-16-2011, 05:16 AM
That's great! Thank you so much.
The only issue I see is that I changed the color when adding it to a chart, but it still prints blue.
In case you were curious, I use to it to find quick reversal trades on a 5 second forex charts using 375 as the period setting. The bars are much cleaner and much easier to read than looking at a squigly 5 second CCI line graph.
Thanks again
NinjaTrader_Joydeep
12-16-2011, 05:23 AM
Hello jmflukeiii,
The colors are hard coded. If you want further customization you can write to one of our NinjaScript Consultants http://www.ninjatrader.com/partners#NinjaScript-Consultants
Happy trading, and please do let me know if I can be of further help.
Regards,
Joydeep.
jmflukeiii
12-16-2011, 05:35 AM
Thank you, no problem, I just changed it myself.
Again, I appreciate the help!
NinjaTrader_Joydeep
12-16-2011, 05:40 AM
Hello jmflukeiii,
Glad you could do it yourself.
You can refer to this sample code on custom color for further reference
http://www.ninjatrader.com/support/forum/showthread.php?t=4977
Please do let me know if I can be of any further help.
Regards,
Joydeep.
jmflukeiii
12-16-2011, 05:50 AM
Ha, well, pretty much all I know how to do is find a color and change it to a different color unfortunately. But at least I've got that down now....
NinjaTrader_Joydeep
12-16-2011, 05:57 AM
Hello jmflukeiii,
Glad, atleast you have a working indicator as per your requirement.
Please do let me know if I could assist you any further.
Regards,
Joydeep.
jmflukeiii
12-16-2011, 01:01 PM
Maybe you could help me out with this....
How could I create another of the same indicator basically, but adjust the colors for it so I can run too concurrently (in separate panels) for different thresholds with different colors. So for example, I use one panel to distinguish overbought/oversold at a 200 threshold, and then another panel I use a simple red or green to denote whether the CCI is on top of the 0 line or on bottom of the 0 line?
Thank you!
jmflukeiii
12-16-2011, 01:39 PM
Actually nevermind, I figured it out! Thanks for getting me started, this has been a great learning experience on doing a little, albeit very minor, programming.
Now the only thing left to figure out is how to make it so you can have varying colors for different thresholds... for example, above 0, cyan, above 100, green. And also, below 0, magenta, below -100 red. Maybe I'll try to fiddle with it and see if I can figure out.... (don't hold your breath though...)
NinjaTrader_RyanM
12-16-2011, 02:39 PM
Hi jmflukeiii,
You could create multicolored plots by conditionally assigning PlotColors property. This sample can help show a technique:
http://www.ninjatrader.com/support/forum/showthread.php?t=3227
jmflukeiii
12-16-2011, 02:50 PM
Thanks for the response. Is there anyway to easily plug in a Williams %R into this instead of a CCI, and have different colors print when the oscillator is above -20 and below -80, and also a third color when the oscillator is inbetween the extremes?
NinjaTrader_AdamP
12-16-2011, 03:42 PM
jmflukeiii,
Yes, essentially you can replace CCI(period)[0] with WilliamsR(period)[0] in any DataSeries.Set() fields or if statements.
In that CCIBars indicator, the if statements can be changed :
if (CCI(cciPeriod)[0] > cciThreshold)
to
if (WilliamsR(Period)[0] > Threshold)
Please let us know if you require additional assistance.
jmflukeiii
12-16-2011, 04:26 PM
Thank you. I tried doing this, but Williams oscillates around -50, not 0, so the absolute value of a number for the threshold won't work. I tried creating two thresholds, WilliamsRUpper and WilliamsRLower, but ended up getting confused halfway through trying to modify the code. Most places, you can just do the replacement like you are talking about. But there's a couple sections where code needs to be added for the separate thresholds. Some of them I could figure out, some of them not.
When I copied and pasted the CCIBars script into a new indicator script, a whole bunch of stuff came up that I think was condensed or hidden on the original script. In there is where I figured out half the changes, but failed on the other half.
Edit: Would a threshold of 30 work in Williams? Seeing as -50 +30 would be in the overbought zone and -50 minus 30 would put it in the oversold zone?
Thanks.
EDIT 2: I think I get what you're saying now. I think I was making it too difficult.
I'm still not sure about the threshold value as there will be two thresholds, -20 and -80.
EDIT 3: I guess I could just make two new indicators and put them in the same panel, one with a -20 threshold, and one with a -80 threshold. It'd be great if I knew how to make them one though. Negative thresholds won't work, so i'm at a loss..
GOT IT! Just created a new variable "Thresholdlower" and got it to work! Thank you again. Except right when WilliamsR is crossing its mid-line, the bars indicator now just prints a black bar... not sure why... I have the middle period (between -25 and -75 set to orange).
jmflukeiii
12-16-2011, 05:18 PM
CCI bars top indi shows the extremes (exits or reversals)
WilliamsRbar middle indi confirms direction (still working on best settings)
CCI bars bottom shows the overall direction
Thanks for the help!
One last question, how do I make ninjatrader not display the indicator values, for example all the WMAs up on the top, or the $EURUSD(second)... after the indicator name in the lower panels?
Prov1322
12-17-2011, 06:44 AM
CCI bars top indi shows the extremes (exits or reversals)
WilliamsRbar middle indi confirms direction (still working on best settings)
CCI bars bottom shows the overall direction
Thanks for the help!
One last question, how do I make ninjatrader not display the indicator values, for example all the WMAs up on the top, or the $EURUSD(second)... after the indicator name in the lower panels?
jmflukeiii...
To "no show" the indicators/values you simply delete the data in the "Label" field under "Visual" when you have your Indicators open.
Hope that helps.
Prov1322
jmflukeiii
12-17-2011, 02:12 PM
Hey great, thank you.
Actually I was looking for the thing after... so say I have a CCI open.... and it says CCI($EURUSD(Second),60), I just want to get rid of the ($EURUSD(Second),60) part
I think its probably in the actual script and I get the feeling that they aren't going to tell me how to modify that.