NexusFi: Find Your Edge


Home Menu

 





Label color. I don't undestand.


Discussion in ThinkOrSwim

Updated
    1. trending_up 1,461 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

Label color. I don't undestand.

  #1 (permalink)
Vale Zaragoza
16400 SPAIN
 
Posts: 14 since Jun 2019
Thanks Given: 30
Thanks Received: 8

Hello!
Could someone explain me how the color coding works in the labels of this script?

# ADVANCE-DECLINE LABEL
def ADSPD = close ("$ADSPD");
def percentAD = Round(100 * ((ADSPD) / 500), 1);

# LABEL COLOR
def Red_w1 = slope > 0 and percentAD < percentAD[1];
def Red_s1 = slope < 0 and percentAD < percentAD[1];
def Green_w1 = slope < 0 and percentAD > percentAD[1];
def Green_s1 = slope > 0 and percentAD > percentAD[1];
def gray1 = slope == 0 or percentAD == percentAD[1];

AddLabel(yes, "AD: " + percentAD + "%", if Red_w1 then CreateColor(222, 81, 93) else if
Red_s1 then Color.RED else if Green_w1 then CreateColor(0, 139, 139) else if Green_s1 then
CreateColor(2, 217, 218) else if gray1 then Color.GRAY else Color.BLACK);

Thanks!!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
What is Markets Chat (markets.chat) real-time trading ro …
75 thanks
Spoo-nalysis ES e-mini futures S&P 500
55 thanks
Just another trading journal: PA, Wyckoff & Trends
36 thanks
Bigger Wins or Fewer Losses?
24 thanks
The Program
16 thanks
  #2 (permalink)
 JayC 
San Diego, CA
 
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
Posts: 55 since Mar 2019
Thanks Given: 9
Thanks Received: 43

What part don't you understand? The conditions? Or the custom colors?

Reply With Quote
Thanked by:
  #3 (permalink)
Vale Zaragoza
16400 SPAIN
 
Posts: 14 since Jun 2019
Thanks Given: 30
Thanks Received: 8



JayC View Post
What part don't you understand? The conditions? Or the custom colors?

The conditions. I don't understand the conditions for choosing one color or another... I don't understand the conditional structure.
Could you explain it in colloquial language?

Reply With Quote
  #4 (permalink)
 JayC 
San Diego, CA
 
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
Posts: 55 since Mar 2019
Thanks Given: 9
Thanks Received: 43

The slope seems to be defined out of scope somewhere else, and the conditions are just looking for positive/negative slope values. But you are probably more interested in the percentAD part. The percentAD[1] is referencing the previous value by one bar and comparing it to the current value (eg is the current value less than the previous value).

Red_w1 - positive slope and decreasing AD percentage
Red_s1 - negative slope and decreasing AD percentage
Green_w1 - negative slope and increasing AD percentage
Green_s1 - positive slope and increasing AD percentage
gray1 - flat slope and flat AD percentage

Let me know if you need more,
Jay

Reply With Quote
Thanked by:
  #5 (permalink)
Vale Zaragoza
16400 SPAIN
 
Posts: 14 since Jun 2019
Thanks Given: 30
Thanks Received: 8


JayC View Post
The slope seems to be defined out of scope somewhere else, and the conditions are just looking for positive/negative slope values. But you are probably more interested in the percentAD part. The percentAD[1] is referencing the previous value by one bar and comparing it to the current value (eg is the current value less than the previous value).

Red_w1 - positive slope and decreasing AD percentage
Red_s1 - negative slope and decreasing AD percentage
Green_w1 - negative slope and increasing AD percentage
Green_s1 - positive slope and increasing AD percentage
gray1 - flat slope and flat AD percentage

Let me know if you need more,
Jay

Perfect, JayC!!
Thanks!!

Reply With Quote




Last Updated on March 11, 2021


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts