Changing Aggregation Period for ATR Strategy

jrsnell

New member
I am using the ATR Strategy and Donchian Channels on a weekly chart for long-term trading decision help. I would like to Add Labels etc for Account values etc to use for position sizing.

I understand that the highest time frame to use these account values is the daily time frame. I think that either I would like to open a DAILY chart next to my weekly chart to display GetNetLiq values to work into my position sizing calculations.

Displaying the ATR Strategy on a daily chart with the forced AggregationPeriod to WEEK would be another way to tackle the issue.

Can anyone provide some pointers as to what to change on the ATR calculations to make the aggregation period weekly on a daily chart. I understand some of the simpler examples (close, high, etc.), but can't seem to get my head around what to change on the ATR strategy.

Here is my "combined" ATR LE and LX strategy code:

input trailType = {default modified, unmodified};
input ATRPeriod = 50;
input ATRFactor = 3;
input firstTrade = {default long, short};
input averageType = AverageType.SIMPLE;

def buycondition = ATRTrailingStop(trailType, ATRPeriod, ATRFactor, firstTrade, averageType).buySignal;

addOrder(OrderType.BUY_TO_OPEN, buycondition, tickColor = GetColor(0), arrowColor = GetColor(0));

def sellcondition = ATRTrailingStop(trailType, ATRPeriod, ATRFactor, firstTrade, averageType).sellSignal;

addOrder(OrderType.SELL_TO_CLOSE, sellcondition, tickColor = GetColor(1), arrowColor = GetColor(1));

=====

Any help would be greatly appreciated. Thanks, Jeff
 
Solution
I get that... then I think I would simply like to try to open a daily chart next to my weekly chart. In that case, I need to know how far down it is to the weekly ATR stop... but I need that data on the daily chart because of the GetNetLiq call... so, if I could get a little help as to how to change the aggregation period on just the ATR stop, that would be wonderful. Then I can leave the strategy alone on the weekly chart.

... unless there's a way to pull in the GetNetLiq onto a weekly chart?
1.The timeframes which will support the GetNetLiq() function:​
The Portfolio functions can only be used with the following aggregation periods: 1 min, 2 min, 3 min, 4 min, 5 min, 10 min, 15 min, 20 min, 30 min...​
I am using the ATR Strategy and Donchian Channels on a weekly chart for long-term trading decision help. I would like to Add Labels etc for Account values etc to use for position sizing.

I understand that the highest time frame to use these account values is the daily time frame. I think that either I would like to open a DAILY chart next to my weekly chart to display GetNetLiq values to work into my position sizing calculations.

Displaying the ATR Strategy on a daily chart with the forced AggregationPeriod to WEEK would be another way to tackle the issue.

Can anyone provide some pointers as to what to change on the ATR calculations to make the aggregation period weekly on a daily chart. I understand some of the simpler examples (close, high, etc.), but can't seem to get my head around what to change on the ATR strategy.

Here is my "combined" ATR LE and LX strategy code:

input trailType = {default modified, unmodified};
input ATRPeriod = 50;
input ATRFactor = 3;
input firstTrade = {default long, short};
input averageType = AverageType.SIMPLE;

def buycondition = ATRTrailingStop(trailType, ATRPeriod, ATRFactor, firstTrade, averageType).buySignal;

addOrder(OrderType.BUY_TO_OPEN, buycondition, tickColor = GetColor(0), arrowColor = GetColor(0));

def sellcondition = ATRTrailingStop(trailType, ATRPeriod, ATRFactor, firstTrade, averageType).sellSignal;

addOrder(OrderType.SELL_TO_CLOSE, sellcondition, tickColor = GetColor(1), arrowColor = GetColor(1));

=====

Any help would be greatly appreciated. Thanks, Jeff
Putting a weekly overlay on your daily chart would result in the bars repainting until the weekly bar closes.
Repainting strategies containing AddOrder statements are not posted on the forum as it is not possible to get true P&L results

A better approach is to create a grid with a small daily chart with your position sizing study above your weekly chart
 

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

Putting a weekly overlay on your daily chart would result in the bars repainting until the weekly bar closes.
We do not post repainting strategies that contain AddOrder statements on the forum because it isn't possible to get true P&L results
I get that... then I think I would simply like to try to open a daily chart next to my weekly chart. In that case, I need to know how far down it is to the weekly ATR stop... but I need that data on the daily chart because of the GetNetLiq call... so, if I could get a little help as to how to change the aggregation period on just the ATR stop, that would be wonderful. Then I can leave the strategy alone on the weekly chart.

... unless there's a way to pull in the GetNetLiq onto a weekly chart?
 
I get that... then I think I would simply like to try to open a daily chart next to my weekly chart. In that case, I need to know how far down it is to the weekly ATR stop... but I need that data on the daily chart because of the GetNetLiq call... so, if I could get a little help as to how to change the aggregation period on just the ATR stop, that would be wonderful. Then I can leave the strategy alone on the weekly chart.

... unless there's a way to pull in the GetNetLiq onto a weekly chart?
1.The timeframes which will support the GetNetLiq() function:​
The Portfolio functions can only be used with the following aggregation periods: 1 min, 2 min, 3 min, 4 min, 5 min, 10 min, 15 min, 20 min, 30 min, 1h, or 1 day. Time period for the aggregation of 1 day is limited to 1 year.​


2. You realize that the MTF indicator will still repaint?​
Here is a script that you can modify:​
 
Solution
1.The timeframes which will support the GetNetLiq() function:​



2. You realize that the MTF indicator will still repaint?​
Here is a script that you can modify:​
Yes... I got the idea from somewhere else on this forum to open a small chart and then make it thin so that the AddLabel "stacks" on the left of my weekly chart. I don't think repainting will be an issue since I'll be taking my triggers off of the weekly chart and only referencing the AddLabels on the left on "decision day" once a week. I've blacked out the lines and made everything black or transparent so the window is truly only for the Labels. Here's what it looks like at the moment... The position sizing on the right is on the weekly ATR and the position sizing on the left is wrong because it's on the daily... but I do get my GetNetLiq() called properly... now I just want to push a weekly aggregation on the blacked out chart on the left so that those numbers match the numbers on the right on "decision day" (if you will).
1686096153916.png
 
@MerryDay Thanks for the link. I substituted the MTF ATR for my regular weekly study. I can make what mods I need to make to the AddLabel Study to get it to show the weekly data on that daily "blank" chart. Thanks for the help!
 
@MerryDay Thanks for the link. I substituted the MTF ATR for my regular weekly study. I can make what mods I need to make to the AddLabel Study to get it to show the weekly data on that daily "blank" chart. Thanks for the help!
The Portfolio functions can only be used with the following aggregation periods: 1 min, 2 min, 3 min, 4 min, 5 min, 10 min, 15 min, 20 min, 30 min, 1h, or 1 day. Time period for the aggregation of 1 day is limited to 1 year.
https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Portfolio
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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