Choppiness Index Indicator for ThinkorSwim

Is their anyway to use this in conjunction with " SUPERTREND BY MOBIUS AND CCI ATR TREND COMBINED "....? I love using super trend but I am trying to stay out od midways movement.
 
This is actually looking really good. Has anybody else tried it yet? I have tried using ADX in the past but too many good moves were missed, so happy to have this alt.
 
This is actually looking really good. Has anybody else tried it yet? I have tried using ADX in the past but too many good moves were missed, so happy to have this alt.
I use this indicator all the time and just like you had used the ADX to identify trends/ending trends and chop. I still use the ADX but beginning to use the Choppiness Index and other FE variations because it is quicker than the ADX and nowhere near as laggy as the ADX
 
I know its kind of a silly change, but moved the consolidation range to an input so it is able to be changed from the settings

Rich (BB code):
# Sideways Indicator
# Original Code developed by WalkingBallista
# Concept and Idea by BenTen at useThinkScript.com
# Identify choppy market. Can also be used to find consolidation/breakout patterns.
# Version 1.0 (read changelog in the forum)

input length = 14;
input averageType = AverageType.WILDERS;
input price = close;
input consolidation_range = 5;

def hiDiff = high - high[1];
def loDiff = low[1] - low;

def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM =  if loDiff > hiDiff and loDiff > 0 then loDiff else 0;

def ATR = MovingAverage(averageType, TrueRange(high, close, low), length);
def "DI+" = 100 * MovingAverage(averageType, plusDM, length) / ATR;
def "DI-" = 100 * MovingAverage(averageType, minusDM, length) / ATR;

def range = AbsValue(AbsValue("DI+")-AbsValue("DI-"));

AssignPriceColor(if range < consolidation_range then Color.Yellow else Color.Current);
 
@BenTen I posted a question yesterday on the main question forum before I saw this thread. There is a thread from the tc2000 forum that shows a scanner for range bound stocks. I was in the process of converting the small amount of code to build a scanner and ran into some issues. Could you look at it to see if you could mimic it. You are way more efficient in your code writing than I am and probably would be less than 20 lines of code (Maybe 50 for me). The video in the first post goes over everything and is a flash video.

Thanks
Brad
 
I was wondering if this indicator has already been made for TOS somewhere out there, and if not how should I go about converting it?

This is the formula: CMI = ((ABS(Close[0]-Close[n]))/(MaxHigh[n]-MinLow[n]))*100
  • ABS - absolute value
  • Close[0] - last close
  • Close[n] - close N bars ago
  • MaxHigh[n] - maximal value of High for the N bars period
  • MinLow[n] - minimal value of Low for the N bars period
It is plotted as a histogram changing colors from green, yellow, and red with a moving average over top it.

If interested this is the code from mq5:

Code:
#include <MovingAverages.mqh>
#property indicator_buffers 3
#property indicator_plots 2
#property indicator_minimum 0 
#property indicator_maximum 100 
#property indicator_level1 60         
#property indicator_level2 50         
#property indicator_level3 40       
#property indicator_levelcolor clrPurple
//-------------------------------------------------------------------------
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrBlue
#property indicator_width1 2
#property indicator_label1 "Signal"
//-------------------------------------------------------------------------
#property indicator_type2 DRAW_COLOR_HISTOGRAM
#property indicator_color2 clrRed,clrYellow,clrGreen,
#property indicator_width2 2
#property indicator_label2 "Hist"
//------------------------------------------------------------------------
input int                  N_Period = 60;     //CMI Period
input int                  MA_Period = 10;    //MA Period
//-------------------------------------------------------------------------
double HistBuffer[];
double ColorBuffer[];
double MABuffer[];
int    ColorInd=0;
//+-------------------------------------------------------------------------
//| Custom indicator initialization function                                |
//+-------------------------------------------------------------------------
int OnInit()
  {
//---
   SetIndexBuffer(0,MABuffer,INDICATOR_DATA);
   SetIndexBuffer(1,HistBuffer,INDICATOR_DATA);
   SetIndexBuffer(2,ColorBuffer,INDICATOR_COLOR_INDEX);
//---
   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0);
   PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0.0);
//---
   ArraySetAsSeries(HistBuffer,true);
   ArraySetAsSeries(ColorBuffer,true);
   ArraySetAsSeries(MABuffer,true);

   IndicatorSetString(INDICATOR_SHORTNAME,"(CMI"+", Period = "+string(N_Period)+", MA = "+string(MA_Period)+" )");
   IndicatorSetInteger(INDICATOR_DIGITS,_Digits+1);

   return(0);
  }
double Delta_hl,Delta_Close;
//+-------------------------------------------------------------------------+
//| Custom indicator iteration function                                     |
//+-------------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int offset=N_Period+1;
   if(rates_total<offset) return(0);
   ArraySetAsSeries(high,true);
   ArraySetAsSeries(low,true);
   ArraySetAsSeries(close,true);

   int start;
   if(prev_calculated<rates_total || prev_calculated<=0)
     {
      for(int i=rates_total-1; i>=0; i--)
        {
         HistBuffer[I]=0.0;
        }
      start=rates_total-offset;
     }
   else start=rates_total-prev_calculated;
// ---------------------------    
   for(int i=start; i>=0; i--)
     {
      Delta_hl=high[ArrayMaximum(high,i,N_Period)]-low[ArrayMinimum(low,i,N_Period)];;
      Delta_Close=close[I]-close[i+N_Period];
      //----
      if(Delta_hl==0)
         HistBuffer[I]=0;
      else
         HistBuffer[I]=MathAbs(Delta_Close)/Delta_hl*100;

      if(Delta_Close>0)
        {
         if(ColorInd<2) ColorInd++;
         ColorBuffer[I]=ColorInd;
        }
      else if(Delta_Close<0)
        {
         if(ColorInd>0) ColorInd--;
         ColorBuffer[I]=ColorInd;
        }
      else   ColorBuffer[I]=1;
     }
   SimpleMAOnBuffer(rates_total,prev_calculated,N_Period,MA_Period,HistBuffer,MABuffer);

   return(rates_total);
  }[/I][/I][/I][/I][/I][/I][/I]
 
Hi,
I would like to know your ideas on the best way to scan for stocks that had no to very little price movement in the last week/month. Thanks.
 
Hi,
I would like to know your ideas on the best way to scan for stocks that had no to very little price movement in the last week/month. Thanks.

You would need to define "very little"... Is that a percentage or value...??? The scanner has default scans for % Change Gainers and % Change Losers, amongst others...
 
You would need to define "very little"... Is that a percentage or value...??? The scanner has default scans for % Change Gainers and % Change Losers, amongst others...
Let's say that I want to see stocks that traded within 10% of their price in the last week/month. The default scans for % Change Gainers and % Change Losers gives me only stocks that moved today.
 
TradingRush just posted a new video about a "disappearing EMA" that disappears when sideways markets are detected. Problem is, it's not in thinkscript. I believe he utilizes TradStation? Is it possible for someone to decode this? I'd be very curious as to how this could change entries (this was not a paid indicator as he is giving it out for free to everyone):


Code:
//Created by Trading Rush

// © Trading Rush

//@version=4

study(title="Trading Rush Moving Average", shorttitle="TR EMA", overlay=true, resolution="")

len = 200

src = close

ema1 = ema(src, len)

maColor = if(close[5] > ema1[5] and close[10] > ema1[10] and close[15] > ema1[15] and close[20] > ema1[20] and close[30] > ema1[30] and close[40] > ema1[40] and close[50] > ema1[50] and close > ema1)

[URL='http://color.green/']color.green[/URL]

else if(close[5] < ema1[5] and close[10] < ema1[10] and close[15] < ema1[15] and close[20] < ema1[20] and close[30] < ema1[30] and close[40] < ema1[40] and close[50] < ema1[50] and close < ema1)

[URL='http://color.red/']color.red[/URL]

else

[URL='https://color.new/']color.new[/URL](color.white, 100)



plot(ema1, title="TR EMA", color=maColor, linewidth=4)
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
414 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top