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.

《secondary aggregation period cannot be less than the primary aggregation period in thinkscript》有5条评论
  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);

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理