Please add code that would add 30 min arrows on 5 min time frame and other MTF

robopro

New member
VIP
This is the script for ToS TTM_LRC
...Thank You in advance...Love this site

declare upper;

input price = close;
input length = 70;
input beginDate = 0;
input beginTime = 0;
input numDevDn1 = -1.8;
input numDevDn2 = -2.7;
input numDevUp1 = 1.8;
input numDevUp2 = 2.7;
input extLeft = No;
input extRight = Yes;

plot UB2 = reference TTM_LRC(price, length, beginDate, beginTime, numDevDn1, numDevDn2, numDevUp1, numDevUp2, extLeft, extRight).UB2;
UB2.SetStyle(Curve.FIRM);
UB2.HideBubble();
UB2.SetDefaultColor(Color.RED);
UB2.SetLineWeight(1);
UB2.Hide();

plot UB1 = reference TTM_LRC(price, length, beginDate, beginTime, numDevDn1, numDevDn2, numDevUp1, numDevUp2, extLeft, extRight).UB1;
UB1.SetStyle(Curve.FIRM);
UB1.HideBubble();
UB1.SetDefaultColor(Color.CYAN);
UB1.SetLineWeight(1);
UB1.Hide();

plot LR = reference TTM_LRC(price, length, beginDate, beginTime, numDevDn1, numDevDn2, numDevUp1, numDevUp2, extLeft, extRight).LR;
LR.Hide();

plot LB1 = reference TTM_LRC(price, length, beginDate, beginTime, numDevDn1, numDevDn2, numDevUp1, numDevUp2, extLeft, extRight).LB1;
LB1.SetStyle(Curve.FIRM);
LB1.HideBubble();
LB1.SetDefaultColor(Color.CYAN);
LB1.SetLineWeight(1);
LB1.Hide();

plot LB2 = reference TTM_LRC(price, length, beginDate, beginTime, numDevDn1, numDevDn2, numDevUp1, numDevUp2, extLeft, extRight).LB2;
LB2.SetStyle(Curve.FIRM);
LB2.HideBubble();
LB2.SetDefaultColor(Color.RED);
LB2.SetLineWeight(1);
LB2.Hide();

def down2 = if high >= UB2 then 1 else 0;
plot DownArrowLB2 = if down2 and !down2[1] then high else Double.NaN;
DownArrowLB2.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
DownArrowLB2.SetLineWeight(3);
DownArrowLB2.SetDefaultColor(GetColor(5));

def down1 = if high >= UB1 then 1 else 0;
plot DownArrowLB1 = if down1 and !down1[1] then high else Double.NaN;
DownArrowLB1.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
DownArrowLB1.SetLineWeight(3);
DownArrowLB1.SetDefaultColor(GetColor(1));

def up2 = if low <= LB2 then 1 else 0;
plot UpArrowLB2 = if up2 and !up2[1] then low else Double.NaN;
UpArrowLB2.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
UpArrowLB2.SetLineWeight(3);
UpArrowLB2.SetDefaultColor(GetColor(5));

def up1 = if low <= LB1 then 1 else 0;
plot UpArrowLB1 = if up1 and !up1[1] then low else Double.NaN;
UpArrowLB1.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
UpArrowLB1.SetLineWeight(3);
UpArrowLB1.SetDefaultColor(GetColor(1));
 
Last edited by a moderator:
Solution
Conversion to MTF for your indicator code:
Code:
declare upper;

input agg = AggregationPeriod.THIRTY_MIN; 
def price = close(period = agg);
def agg_high = high(period = agg);
def agg_low = low(period = agg);

input length = 70;
input beginDate = 0;
input beginTime = 0;
input numDevDn1 = -1.8;
input numDevDn2 = -2.7;
input numDevUp1 = 1.8;
input numDevUp2 = 2.7;
input extLeft = No;
input extRight = Yes;

plot UB2 = reference TTM_LRC(price, length, beginDate, beginTime, numDevDn1, numDevDn2, numDevUp1, numDevUp2, extLeft, extRight).UB2;
UB2.SetStyle(Curve.FIRM);
UB2.HideBubble();
UB2.SetDefaultColor(Color.RED);
UB2.SetLineWeight(1);
UB2.Hide();

plot UB1 = reference TTM_LRC(price, length, beginDate, beginTime, numDevDn1, numDevDn2...
Conversion to MTF for your indicator code:
Code:
declare upper;

input agg = AggregationPeriod.THIRTY_MIN; 
def price = close(period = agg);
def agg_high = high(period = agg);
def agg_low = low(period = agg);

input length = 70;
input beginDate = 0;
input beginTime = 0;
input numDevDn1 = -1.8;
input numDevDn2 = -2.7;
input numDevUp1 = 1.8;
input numDevUp2 = 2.7;
input extLeft = No;
input extRight = Yes;

plot UB2 = reference TTM_LRC(price, length, beginDate, beginTime, numDevDn1, numDevDn2, numDevUp1, numDevUp2, extLeft, extRight).UB2;
UB2.SetStyle(Curve.FIRM);
UB2.HideBubble();
UB2.SetDefaultColor(Color.RED);
UB2.SetLineWeight(1);
UB2.Hide();

plot UB1 = reference TTM_LRC(price, length, beginDate, beginTime, numDevDn1, numDevDn2, numDevUp1, numDevUp2, extLeft, extRight).UB1;
UB1.SetStyle(Curve.FIRM);
UB1.HideBubble();
UB1.SetDefaultColor(Color.CYAN);
UB1.SetLineWeight(1);
UB1.Hide();

plot LR = reference TTM_LRC(price, length, beginDate, beginTime, numDevDn1, numDevDn2, numDevUp1, numDevUp2, extLeft, extRight).LR;
LR.Hide();

plot LB1 = reference TTM_LRC(price, length, beginDate, beginTime, numDevDn1, numDevDn2, numDevUp1, numDevUp2, extLeft, extRight).LB1;
LB1.SetStyle(Curve.FIRM);
LB1.HideBubble();
LB1.SetDefaultColor(Color.CYAN);
LB1.SetLineWeight(1);
LB1.Hide();

plot LB2 = reference TTM_LRC(price, length, beginDate, beginTime, numDevDn1, numDevDn2, numDevUp1, numDevUp2, extLeft, extRight).LB2;
LB2.SetStyle(Curve.FIRM);
LB2.HideBubble();
LB2.SetDefaultColor(Color.RED);
LB2.SetLineWeight(1);
LB2.Hide();

def down2 = if agg_high >= UB2 then 1 else 0;
plot DownArrowLB2 = if down2 and !down2[1] then high else Double.NaN;
DownArrowLB2.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
DownArrowLB2.SetLineWeight(3);
DownArrowLB2.SetDefaultColor(GetColor(5));

def down1 = if agg_high >= UB1 then 1 else 0;
plot DownArrowLB1 = if down1 and !down1[1] then high else Double.NaN;
DownArrowLB1.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
DownArrowLB1.SetLineWeight(3);
DownArrowLB1.SetDefaultColor(GetColor(1));

def up2 = if agg_low <= LB2 then 1 else 0;
plot UpArrowLB2 = if up2 and !up2[1] then low else Double.NaN;
UpArrowLB2.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
UpArrowLB2.SetLineWeight(3);
UpArrowLB2.SetDefaultColor(GetColor(5));

def up1 = if agg_low <= LB1 then 1 else 0;
plot UpArrowLB1 = if up1 and !up1[1] then low else Double.NaN;
UpArrowLB1.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
UpArrowLB1.SetLineWeight(3);
UpArrowLB1.SetDefaultColor(GetColor(1));

I have not tested this, and I think I got all the references converted... but if it doesn't work as expected, come back and tell us what it did (or didn't) do.

I included an input for the desired aggregation period, and then defined the price, agg_low, and agg_high variables to use that aggregation period.

-mashume
 
Solution
the only place i see some signals on is on the 30 min chart and those signals do belong to the 30 min chart...it's not aggregating on lower time frames...I appreciate your help
 
Well, it does plot on different time frames, and it will generate signals (as long as they are within the length of the plots (they are hidden in your code, but I turned them on to see what was going on). Turning on left extension makes them plot an extra signal or two at times... depends on the signals. I can see signals on 30, 20, occasionally15 and infrequently 10 minute charts.

HOWEVER
The source code for the TTM_LRC indicator is hidden -- we can't actually get at the source code for this indicator in ToS and therefore I have no idea what it is doing with data it is fed... except that it looks like it is ignoring aggregation periods in some way, which is nothing we can do anything about at all.

All I can recommend is to keep a 30 minute chart open in a flexible workspace and deal with having to watch two charts.

-mashume
 
Well, it does plot on different time frames, and it will generate signals (as long as they are within the length of the plots (they are hidden in your code, but I turned them on to see what was going on). Turning on left extension makes them plot an extra signal or two at times... depends on the signals. I can see signals on 30, 20, occasionally15 and infrequently 10 minute charts.

HOWEVER
The source code for the TTM_LRC indicator is hidden -- we can't actually get at the source code for this indicator in ToS and therefore I have no idea what it is doing with data it is fed... except that it looks like it is ignoring aggregation periods in some way, which is nothing we can do anything about at all.

All I can recommend is to keep a 30 minute chart open in a flexible workspace and deal with having to watch two charts.

-mashume
Thank You Mashume
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
597 Online
Create Post

Similar threads

Similar threads

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