Code:
plot weeklyClose = close("IBM", period = AggregationPeriod.WEEK);

This code plots weekly Close price for IBM. Interesting thing is that the IBM chart does not have to be opened to plot the Close price: it will be plotted on chart of any symbol you specified in chart settings. There is, however, a restriction in terms of time aggregation: secondary aggregation period cannot be less than the primary aggregation period defined by chart settings:

Code:
plot yesterdayHigh = High(period = AggregationPeriod.DAY)[1];

Designed to plot the High price reached on the previous day, this script will not work on weekly charts.

By admin

5 thoughts on “secondary aggregation period cannot be less than the primary aggregation period in thinkscript”
  1. about: Parameter already defined: period

    when using:

    def outMacD = close(period = res, macd);
    def outSignal = close(period = res, signal);
    def outHist = close(period = res, hist);

    Thanks.

  2. can someone explain why i get an error message that says “parameter already defined: period:

    input period1 = AggregationPeriod.FIFTEEN_MIN;
    input offsetbar = 1;
    period1o = (open(period = period1) + close(period = period1, offsetbar)) / 2;
    period1h = Max(high(period = period1), close(period = period1, offsetbar));
    period1l = Min(low(period = period1), close(period = period1, offsetbar));
    period1c = (period1o + period1h + period1l + close(period = period1)) / 4;
    plot gamma_1 = Log(Sum((Max(high(period = period1), close(period = period1, offsetbar)) – Min(low(period = period1), close(period = period1, offsetbar))), nFE) / (Highest(high(period = period1), nFE) – Lowest(low(period = period1), nFE))) / Log(nFE);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.