x = if close > open close // If current close > current open, then x = close. // Otherwise the x = na. plot(x) 可以使用多个“else if”块或根本不使用。“then”、“else if”、“else”的块被移动四个空格: 例子 // if x = if open > cl
// If/else statement if close > open // Bull candle else // Bear candle // For loop for i=0 to 10 // Do something // While loop while close > open // Uptrend That covers some of the key concepts. Don't worry if the syntax seems strange - it will start to feel natural with...
In the first statement we’re asking for the opening price of the candle with the array index (position) of “1”. In programming, arrays and lists typically always start at 0 (zero) instead of 1. This means that close[0] will give us the current candle closing price, and close[100]...
The question mark here is a short form for an if/else statement. What follows the question mark is the important part. There are two numbers here separated by a colon. The number before the colon, 1 in this case, is what should be returned in the event the if statement is true. The...
<version> <declaration_statement> <code> 注释FMZ的Pine语言支持的注释符号:单行注释//、多行注释/* */,例如以下例子中的注释写法:[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9) // 计算MACD指标 /* plot函数在图表上画出指标线 */ plot(macdLine, color = color.blue, title='...