Plot 15 minute Candlestick Signal on 30 minute chart

JJSPX

New member
I have this simple Candlestick indicator... Basically just plots an arrow once the conditions are met. I can't seem to have any success in getting the code right in order to plot these simple arrow signals from a 15min chart, but on a 30min chart. I've tried a few different aggregation.period ways and can't get it to stick. Ultimately, I just want to see these arrows on a 30min chart, but off of 15min data.

Any thoughts?

Thanks so much.

Jon

------------------------------------------------------------------------------
Code:
def total = high - low;
def upper_candle = high - Max(open, close);
def lower_candle = Min(open, close) - low;
def trend_mult = if close >= open then 1 else -1;

def Upper_Sentiment = if total != 0 then 100 - ((upper_candle / total) * 100) else 0;
def Lower_Sentiment = if total != 0 then -100 + (( lower_candle / total) * 100) else 0;

plot UpperWickReversal = if Upper_Sentiment <= 33 and Upper_Sentiment != 0 then Upper_Sentiment else Double.NaN;
UpperWickReversal.SetPaintingStrategy(PaintingStrategy.aRROW_DOWN);
UpperWickReversal.SetLineWeight(4);
UpperWickReversal.AssignValueColor(Color.RED);

plot LowerWickReversal = if Lower_Sentiment >= -33 and Lower_Sentiment != 0 then Lower_Sentiment else Double.NaN;
LowerWickReversal.SetPaintingStrategy(PaintingStrategy.arrow_up);
LowerWickReversal.SetLineWeight(4);
LowerWickReversal.AssignValueColor(Color.Green);
 
Last edited by a moderator:
If you could get this right, this would save us the hassle of flipping back and forth between charts. Could you make something similar like if im looking at the 1m chart, I get a notification that price has broken above the 20ma on the 5m,15m,30m, etc charts without constantly creating alerts and switching between charts.
 
That's because you didn't call for data from the higher timeframe. Here is the updated script. The default timeframe is set to Daily. You can change it via the indicator's settings. I have also updated the plot as well, so the arrows are being displayed correctly.

Code:
# Input name of script
# Modified by BenTen at useThinkScript.com to include MTF option

input Period = aggregationPeriod.DAY;
def close = close(period = Period);
def high = high(period = Period);
def open = open(period = Period);
def low = low(period = Period);

def total = high - low;
def upper_candle = high - Max(open, close);
def lower_candle = Min(open, close) - low;
def trend_mult = if close >= open then 1 else -1;

def Upper_Sentiment = if total != 0 then 100 - ((upper_candle / total) * 100) else 0;
def Lower_Sentiment = if total != 0 then -100 + (( lower_candle / total) * 100) else 0;

plot UpperWickReversal = if Upper_Sentiment <= 33 and Upper_Sentiment != 0 then Upper_Sentiment else Double.NaN;
UpperWickReversal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
UpperWickReversal.SetLineWeight(4);
UpperWickReversal.AssignValueColor(Color.RED);

plot LowerWickReversal = if Lower_Sentiment >= -33 and Lower_Sentiment != 0 then Lower_Sentiment else Double.NaN;
LowerWickReversal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
LowerWickReversal.SetLineWeight(4);
LowerWickReversal.AssignValueColor(Color.Green);
 
@horserider Thanks for pointing that out. I was reading the reverse of his request (plotting something from higher agg on lower agg). @JJSPX The code I provided will do that. It will not be able to plot something from 15m on a 30m (or higher timeframe), should be the other way around.
 
@BenTen - Do you have a guide or short explanation as to why items such as "input" or "def" matter when calling the higher time frame? In the example above, it seemed very simple to include the input period calling to the higher time frame. I have a different set of code below, and can't get it to call to a higher time frame. This essentially just plots the Kijun/Tenkan cloud and then assigns a color to the Kijun line based on trend. This is used on a 30 minute chart, but I am also trying to plot the Daily information on the 30M chart.

Code:
input price = close;
input tenkan_period = 9;
input kijun_period = 26;
input displace = 0;

plot Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
plot Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;
Kijun.DefineColor("Up", Color.GREEN);
Kijun.DefineColor("Down", Color.RED);
Kijun.DefineColor("Even", Color.WHITE);
Kijun.AssignValueColor(if Kijun > Tenkan then Kijun.Color("Down") else (if Kijun == Tenkan then Kijun.Color("Even") else Kijun.Color("Up")));
Kijun.SetLineWeight(3);
 
@JJSPX Without calling for higher timeframe data, ThinkorSwim will use the current timeframe that you’re on as the default value. Looking at the script you just posted above, you are not calling for the 30m timeframe. That’s why it doesn’t work.
 
@BenTen - The code I had posted was the original code (sorry)... Here's what I am having an issue with... This below is still plotting 30M information....

Code:
input period = aggregationperiod.day;
def price = close(period = period);

input tenkan_period = 9;
input kijun_period = 26;
input displace = 0;

plot Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
plot Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;
Kijun.DefineColor("Up", Color.GREEN);
Kijun.DefineColor("Down", Color.RED);
Kijun.DefineColor("Even", Color.WHITE);
Kijun.AssignValueColor(if Kijun > Tenkan then Kijun.Color("Down") else (if Kijun == Tenkan then Kijun.Color("Even") else Kijun.Color("Up")));
Kijun.SetLineWeight(3);
 
@JJSPX Take a look at the code I posted from Feb. Make note of the following snippet and apply that to your script:

Code:
input Period = aggregationPeriod.DAY;
def close = close(period = Period);
def high = high(period = Period);
def open = open(period = Period);
def low = low(period = Period);
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
337 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