Robert Payne offering to help with ThinkScript

Status
Not open for further replies.
Hello,I am looking for some thinkscript help. I'm back testing the Chaikin recommendations, trying to determine whether I renew in December. To accomplish this, I'm having to pull a bunch of historic data from TOS. If I set a value in a Custom field to represent the days offset, is there a way to use that value in the custom values that look for Price, trend, Chaikin MF, RSI etc? Thank you so much.
 

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

Hey folks, I have a study and based on that study I would like to autotrade options positions.. yes I know I can blow my whole account if it makes a mistake... but I would start with only 100$ anyone know who can help with the auto trade options code?
 
I wonder if it is possible to profile thinkscripts. I found following entries in client.log

18.11.19 23:58:44:589 DEBUG util.Histograms - Profiler - Operation.TOTAL - Script: VolumeProfile (ms): 80,220 / 258316 = 0.31 in (0 [0-0-1] 265)
18.11.19 23:58:44:589 DEBUG util.Histograms - Profiler - Operation.TOTAL - Script: VolumeProfile (ns): 80,380,419,000 / 258316 = 311,171 in (1,643 [4,253-8,014-397,704] 266,606,258)
18.11.19 23:58:44:589 DEBUG util.Histograms - Profiler - Operation.TOTAL - Script: _008b0148_37cb_4eb9_ba28_c0347e47cde2 (ms): 135 / 6403 = 0.02 in (0 [0-0-0] 2)
18.11.19 23:58:44:589 DEBUG util.Histograms - Profiler - Operation.TOTAL - Script: _008b0148_37cb_4eb9_ba28_c0347e47cde2 (ns): 171,946,100 / 6

That GUID is likely one of my custom scripts. Is there a way to tell which one it is?
 
I would like to contribute to this forum by offering to answer questions for those of you who are coding your own indicators. If you are stuck on something, perhaps I can help you figure it out.

Hi Robert, I will really appreciate if you can please fix this small script for me. I am trying to put an Arrow when price or candle closes above the TEMA for the first time. With this script it is ploting arrows for each candle. Also, similar for down-cross as well. Here's what I did based on my little understanding:

Code:
input price = close;
input length = 10;

def ema1 = ExpAverage(price, length);
def ema2 = ExpAverage(ema1, length);
def ema3 = ExpAverage(ema2, length);

plot TEMA = 3 * ema1 - 3 * ema2 + ema3;
TEMA.SetDefaultColor(GetColor(0));

def Condition1 = if
close > TEMA
then 1 else Double.NaN;
plot x = Condition1;
x.SetPaintingStrategy(paintingStrategy = PaintingStrategy.BOOLEAN_ARROW_UP);
 
@urvishu See if this is what you're looking for.

Code:
input price = close;
input length = 10;

def ema1 = ExpAverage(price, length);
def ema2 = ExpAverage(ema1, length);
def ema3 = ExpAverage(ema2, length);

plot TEMA = 3 * ema1 - 3 * ema2 + ema3;
TEMA.SetDefaultColor(GetColor(0));

def Condition1 = close crosses above TEMA;
plot x = Condition1;
x.SetPaintingStrategy(paintingStrategy = PaintingStrategy.BOOLEAN_ARROW_UP);
 
Hey @RobertPayne, I found this online by you years ago, hope you can shed some light.

Attached is the code, but I'm wondering how do I assignpricecolor when all bullish signals are lit up, and turn candles green? Vice versa for shorts red.

Code:
#The Edge
#Robert Payne

#Plot 8 period moving average
plot MA8 = Average(close, 8);
MA8.SetDefaultColor(Color.YELLOW);
MA8.SetLineWeight(2);

#Trend Signal
def TrendUp = if close > MA8 then 1 else Double.NaN;
def TrendDn  = if close < MA8 then 1 else Double.NaN;
AddLabel(TrendUp, "UP", Color.GREEN);
AddLabel(TrendDn, "DN", Color.RED);

#Net Signal
def NSup = if close - close(period = "day" )[1] > 0 then 1 else Double.NaN;
def NSdn = if close - close(period = "day" )[1] <= 0 then 1 else Double.NaN;
AddLabel(NSup, "NS", Color.GREEN);
AddLabel(NSdn, "NS", Color.RED);

#Open Signal
def OSup = if close - open(period = "day" ) > 0 then 1 else Double.NaN;
def OSdn = if close - open(period = "day" ) < 0 then 1 else Double.NaN;
AddLabel(OSup, "OS", Color.GREEN);
AddLabel(OSdn, "OS", Color.RED);

#High / Low Signal
def Higher = if close > high(period = "day" )[1] then 1 else Double.NaN;
def Lower = if close < low(period = "day" )[1] then 1 else Double.NaN;
def Neutral = if close <= high(period="day" )[1] and close >= low(period="day" )[1] then 1 else Double.NaN;
AddLabel(Higher, "H/L", Color.GREEN);
AddLabel(Lower, "H/L", Color.RED);
AddLabel(Neutral, "H/L", Color.GRAY);

#Out of Bounds
def sDev = StDev(close, 21);
def MidLine = Average(close, 21);
def UpperBand = MidLine + 2 * sDev;
def LowerBand = MidLine - 2 * sDev;
def CloseAbove = if close > UpperBand then 1 else Double.NaN;
def CloseBelow = if close < LowerBand then 1 else Double.NaN;
AddLabel(CloseAbove, round(close - UpperBand,2), Color.WHITE);
AddLabel(CloseBelow, round(close - LowerBand,2), Color.WHITE);

I tried to add:

Code:
def Bullish = Trendup + OSup + NSup;
def Bearish = Trenddn + OSdn + NSdn;
Assignpricecolor(if Bullish then Color.Green else Bearish then Color.Red else Color.Gray)

But failed miserably hahahah! Hope someone can help a little on this!
 
Last edited by a moderator:
Status
Not open for further replies.

Volatility Trading Range

VTR is a momentum indicator that shows if a stock is overbought or oversold based on its Weekly and Monthly average volatility trading range.

Download the indicator

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
476 Online
Create Post

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