NexusFi: Find Your Edge


Home Menu

 





Indicator - Thinkscript question...


Discussion in ThinkOrSwim

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




 
Search this Thread

Indicator - Thinkscript question...

  #1 (permalink)
netarchitech
NY, NY
 
Posts: 68 since Dec 2011
Thanks Given: 27
Thanks Received: 19

I'm having trouble trying to programmatically change a default color setting to the desired custom setting for the
ElderImpulse indicator as highlighted below. I even tried changing the color in the "Edit Properties" GUI interface
with no luck...

Any help/assistance would be greatly appreciated. Thanks in advance...

# Indicator name: ElderImpulse

input length = 13;
input paintBars = yes;

def EMA = ExpAverage(close, length);
def MACD = ExpAverage(close, 12) - ExpAverage(close, 26);
def MACDHist = MACD - ExpAverage(MACD, 9);
def GreenPrice = EMA > EMA[1] and MACDHist > MACDHist[1];
def RedPrice = EMA < EMA[1] and MACDHist < MACDHist[1];

plot Bullish = GreenPrice;
plot Neutral = !GreenPrice and !RedPrice;
plot Bearish = RedPrice;

Bullish.SetDefaultColor(Color.UPTICK);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Bullish.SetLineWeight(3);
Bullish.Hide();
Neutral.SetDefaultColor(Color.BLUE);
#Neutral.SetDefaultColor(CreateColor(204, 204, 0));

Neutral.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Neutral.SetLineWeight(3);
Neutral.Hide();
Bearish.SetDefaultColor(Color.DOWNTICK);
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Bearish.SetLineWeight(3);
Bearish.Hide();

DefineGlobalColor("Bullish", Color.UPTICK);
DefineGlobalColor("Neutral", Color.BLUE);
#DefineGlobalColor("Neutral", CreateColor(204, 204, 0));

DefineGlobalColor("Bearish", Color.DOWNTICK);

AssignPriceColor(if !paintBars then Color.CURRENT
else
if GreenPrice then GlobalColor("Bullish")
else
if RedPrice then GlobalColor("Bearish")
else GlobalColor("Neutral"));

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Cheap historycal L1 data for stocks
Stocks and ETFs
Trade idea based off three indicators.
Traders Hideout
What broker to use for trading palladium futures
Commodities
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #2 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441

You want to change from Blue to 204,204,0 ?

Reply With Quote
  #3 (permalink)
netarchitech
NY, NY
 
Posts: 68 since Dec 2011
Thanks Given: 27
Thanks Received: 19


Thanks for your inquiry, rmejia. The reason why I wanted to change the candles from blue to (204, 204, 0) a/k/a Yellow is because the blue candles were hard to see against the TOS dark blue background...

In any event, I worked it out with a little help from a ThinkScripter. Below are the pertinent old and new code snippets for any/all interested parties to review...

Old code:
 
Code
Bullish.SetDefaultColor(Color.UPTICK);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Bullish.SetLineWeight(3);
Bullish.Hide();
Neutral.SetDefaultColor(Color.BLUE);
#Neutral.SetDefaultColor(CreateColor(204, 204, 0));
Neutral.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Neutral.SetLineWeight(3);
Neutral.Hide();
Bearish.SetDefaultColor(Color.DOWNTICK);
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Bearish.SetLineWeight(3);
Bearish.Hide();

DefineGlobalColor("Bullish", Color.UPTICK);
DefineGlobalColor("Neutral", Color.BLUE);
#DefineGlobalColor("Neutral", CreateColor(204, 204, 0));
DefineGlobalColor("Bearish", Color.DOWNTICK);

AssignPriceColor(if !paintBars then Color.CURRENT
else
if GreenPrice then GlobalColor("Bullish")
else
if RedPrice then GlobalColor("Bearish")
else GlobalColor("Neutral"));

New Code:
 
Code
Bullish.SetDefaultColor(Color.UPTICK);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Bullish.SetLineWeight(3);
Bullish.Hide();
Neutral.SetDefaultColor(CreateColor(204, 204, 0));
Neutral.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Neutral.SetLineWeight(3);
Neutral.Hide();
Bearish.SetDefaultColor(Color.DOWNTICK);
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Bearish.SetLineWeight(3);
Bearish.Hide();

# Deleted the unnecessary DefineGlobalColor cruft

AssignPriceColor(if !paintBars then Color.CURRENT 
else 
if GreenPrice then Color.UPTICK 
else 
if RedPrice then Color.DOWNTICK 
else CreateColor(204, 204, 0));

Hope this helps someone in someway...

Wishing you and the futures.io (formerly BMT)F community a very Healthy, Happy and Prosperous New Year

Reply With Quote
Thanked by:




Last Updated on December 26, 2014


© 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