资源加载中... loading...

TA.Lowest

The TA.Lowest() function is used to calculate the period lowest price.

The TA.Lowest() function returns the minimum value of an attribute in the last certain period, excluding the current Bar. number

TA.Lowest(inReal) TA.Lowest(inReal, period, attr)

The inReal parameter is used to specify the K-line data. inReal true {@struct/Record Record} structure arrays, numeric arrays The period parameter is used to set the period. period false number The attr parameter is used to set the attributes, optionally: Open, Close, Low, High, Volume, OpenInterest. attr false string

function main() {
    var records = exchange.GetRecords()
    var lowestForOpen = TA.Lowest(records, 10, "Open")
    Log(lowestForOpen)
}
def main():
    records = exchange.GetRecords()
    lowestForOpen = TA.Lowest(records, 10, "Open")
    Log(lowestForOpen)
void main() {
    auto records = exchange.GetRecords();
    auto lowestForOpen = TA.Lowest(records.Open(), 10);
    Log(lowestForOpen);
}

For example, if the TA.Lowest(records, 30, "Low") function is called, if the period parameter period is set to 0, it means to calculate all Bars of the K-line data passed in by the inReal parameter; if the attribute parameter attr is not specified, the K-line data passed in by the inReal parameter is considered to be an ordinary array. The use of the TA.Highest() and TA.Lowest() functions in the C++ strategy needs to be noted that the Highest() and Lowest() functions each have only 2 parameters. And the first parameter passed in is not the K-line data r obtained when the function auto r = exchange.GetRecords() was called. You need to call the r method and pass in the specific attribute data. For example, pass in the r.Close() closing price data. Close, High, Low, Open, Volume as in the r.Close() call method.

Example test of C++ language strategy:

void main() { 
    Records r;
    r.Valid = true;
    for (auto i = 0; i < 10; i++) {
        Record ele;
        ele.Time = i * 100000;
        ele.High = i * 10000;
        ele.Low = i * 1000;
        ele.Close = i * 100;
        ele.Open = i * 10;
        ele.Volume = i * 1;
        r.push_back(ele);
    }            

    for(int j = 0; j < r.size(); j++){
        Log(r[j]);
    }            

    // Note: the first parameter passed is not r, you need to call r.Close()
    auto highest = TA.Highest(r.Close(), 8);   
    Log(highest);                     
}

{@fun/TA/TA.MACD TA.MACD}, {@fun/TA/TA.KDJ TA.KDJ}, {@fun/TA/TA.RSI TA.RSI}, {@fun/TA/TA.ATR TA.ATR}, {@fun/TA/TA.OBV TA.OBV}, {@fun/TA/TA.MA TA.MA}, {@fun/TA/TA.EMA TA.EMA}, {@fun/TA/TA.BOLL TA.BOLL}, {@fun/TA/TA.Alligator TA.Alligator}, {@fun/TA/TA.CMF TA.CMF}, {@fun/TA/TA.Highest TA.Highest}

TA.Highest TA.SMA