Is it possible to have different Aggregation Period on the same chart display?

B

british43

New member
Is it possible to add a different chart Aggregation Period as a lower study? I'm using the code below but it is not changing the aggregation. I trade on the 4h chart.

declare lower;
input agg = AggregationPeriod.hour;

def o = open(getUnderlyingSymbol());

def h = high(getUnderlyingSymbol());

def l = low(getUnderlyingSymbol());

def c = close(getUnderlyingSymbol());

AddChart(h,l,c,o,ChartType.candle,color.white);

AddChart(h,l,o,c,ChartType.candle,color.white);
 
Last edited:
C

cos251

Member
It should look like this:

Code:
input symbol = "EUR/USD";
input period = AggregationPeriod.MONTH;
input price_type = {default "LAST", "BID", "ASK", "MARK"};
plot Data = open(symbol, period, price_type);
 
B

british43

New member
Thank you. This awesome. Is there a way instead of inputting symbol to get it automatically change when selecting from a watchlist?
 
C

cos251

Member
Thank you. This awesome. Is there a way instead of inputting symbol to get it automatically change when selecting from a watchlist?
If you don't specify the symbol it will use whichever stock your watching on the current chart. Alternatively you could use an input variable that lists as many stocks as you want (just like the first line of code above) and choose which one you want for that chart. There are many options.
 

Similar threads

Top