SPEAR_CCI_LABELS for TOS - futures io
futures io futures trading



SPEAR_CCI_LABELS for TOS


Discussion in ThinkOrSwim

Updated by alagrande
    1. trending_up 296 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 0 replies
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

(If you already have an account, login at the top of the page)

 
Thread Tools Search this Thread
 

SPEAR_CCI_LABELS for TOS

  #1 (permalink)
glendale ca usa
 
 
Posts: 83 since Sep 2017
Thanks: 11 given, 65 received

SPEAR_CCI_LABELS for TOS

declare lower;

input price = close;
input length = 10;
input averageLength = 3;
input over_bought = 80;
input over_sold = -80;

assert(length >= 2, "'length' must be greater than or equal to 2: " + length);

def sumSqr = fold i = 0 to length with sum do
sum + Sqr((length - i) - fold j = 0 to length with rank
do rank + if GetValue(price, i, length - 1) > GetValue(price, length - j - 1) or GetValue(price, i) == GetValue(price, length - j - 1) and i <= length - j - 1 then 1 else 0);

plot Spearman = 100 * (1 - 6 * sumSqr / (length * (Sqr(length) - 1)));
plot SpearmanAverage = Average(Spearman, averageLength);
plot OverBought = over_bought;
plot ZeroLine = 0;
plot OverSold = over_sold;

AddLabel( Spearman > Spearman [1], " 1 ", color.green);
AddLabel(Spearman < Spearman [1], " 0 ", color.red);
AddLabel (yes, (("-")), if Spearman > Spearman [1] then Color.dark_green else if SpearmanAverage > SpearmanAverage [1] then Color.green else Color.white );

#AddLabel (yes, (("0-")), if Spearman > Spearman [1]and SpearmanAverage > SpearmanAverage [1] then Color.green else Color.white );
AddLabel( Spearman > Spearman [1]and SpearmanAverage > SpearmanAverage [1], " 1 ", color.green);
AddLabel( Spearman < Spearman [1]and SpearmanAverage < SpearmanAverage [1], " 0 ", color.red);

Spearman.SetDefaultColor(GetColor(9));
SpearmanAverage.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(5));
ZeroLine.SetDefaultColor(GetColor(5));
OverSold.SetDefaultColor(GetColor(5));
#################################################################

input lengthCCI = 14;

def priceCCI = close + low + high;
def linDev = lindev(priceCCI, lengthcci);
DEF CCI = if linDev == 0 then 0 else (priceCCI - Average(priceCCI, lengthcci)) / linDev / 0.015;

AddLabel( CCI > CCI [1], " CCI ", color.green);
AddLabel(CCI < CCI [1], " CCI ", color.red);
AddLabel( priceCCI > priceCCI [1], " pCCI ", color.green);
AddLabel(priceCCI < priceCCI [1], " PCCI ", color.red);
AddLabel( linDev > linDev [1], " LIN ", color.green);
AddLabel(linDev < linDev [1], "LIN", color.red);



#input price = close;
input superfast_length = 3;
input superfast_20 = 3;#20
input fast_length = 13;#50
input slow_length = 11;#200
input displace = 0;
## ## ##
#close(period = AggregationPeriod.FIVE_MIN)
def mov_avg4 = ExpAverage( close, superfast_length);
def mov_avg4_10 = ExpAverage( close(period = AggregationPeriod.five_MIN), superfast_length);
def mov_avg4_20 = ExpAverage( close(period = AggregationPeriod.ten_MIN), superfast_length);
def mov_avg4_1h = ExpAverage( close(period = AggregationPeriod.fifteen_MIN), superfast_length);

def mov_avg13 = ExpAverage(price[-displace], fast_length);

def mov_avg20 = ExpAverage( close[-displace], superfast_20);

def mov_avg21 = .5 * ExpAverage(price[-displace], slow_length);
##@@@@@@@@@@@@@@@@@@@@@@@@@@@
########################################################
plot combot22 = if mov_avg13 >= 0 then 0 else Double.NaN;
#combot2.SetPaintingStrategy (PaintingStrategy.SQUARES);
####combo3.SetDefaultColor(Color.black);
combot22.SetLineWeight (4);

combot22.AssignValueColor(if mov_avg4[1] > mov_avg4 and mov_avg13 > mov_avg13[1] then Color.PINK else if mov_avg20[1] > mov_avg20 then Color.RED else Color.GREEN);
##@@@@@@@@@@@@@

#########
plot combo10 = if mov_avg13 >= 0 then -10 else Double.NaN;
#combo3.SetPaintingStrategy (PaintingStrategy.SQUARES);
####combo3.SetDefaultColor(Color.black);
combo10.SetLineWeight (4);

combo10.AssignValueColor(if mov_avg4_10 > mov_avg4_10[10] and mov_avg4_10[10] < mov_avg13 then Color.GREEN else if mov_avg4_10 > mov_avg4_10[10] then Color.DARK_GREEN else Color.RED);

###################


###################

plot combo20 = if mov_avg13 >= 0 then -20 else Double.NaN;
#combo3.SetPaintingStrategy (PaintingStrategy.SQUARES);
####combo3.SetDefaultColor(Color.black);
combo20.SetLineWeight (4);

combo20.AssignValueColor(if mov_avg4_20 > mov_avg4_20[20] and mov_avg4_20[20] < mov_avg13 then Color.GREEN else if mov_avg4_20 > mov_avg4_20[20] then Color.DARK_GREEN else Color.RED);
###################

plot combo1h = if mov_avg13 >= 0 then -30 else Double.NaN;
#combo3.SetPaintingStrategy (PaintingStrategy.SQUARES);
####combo3.SetDefaultColor(Color.black);
combo1h.SetLineWeight (4);

combo1h.AssignValueColor(if mov_avg4_1h > mov_avg4_1h[60] and mov_avg4_1h[60] < mov_avg13 then Color.GREEN else if mov_avg4_1h > mov_avg4_1h[60] then Color.DARK_GREEN else Color.RED);

#END CODE

Reply With Quote



futures io Trading Community Platforms and Indicators ThinkOrSwim > SPEAR_CCI_LABELS for TOS




Upcoming Webinars and Events
 

Free BloodHound Licenses to everyone!

June
 

Every journal equals ten meals for the hungry

June
     



Copyright © 2020 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