简体   繁体   English

Pine Script 中的 Function 带中断

[英]Function in Pine Script with break

I have a function in pine script:我在 pine 脚本中有一个 function:

fun_check(Sell_Signal) =>
    Base_Sell1 = Sell_Signal[0]
    for i=0 to 150
        if (Sell_Signal[i] == 1)
            Base_Sell1 = 5
            break
    Base_Sell1

B_Sell = fun_check(Sell_Signal)

My function always returns the value as 1, but it should return a value as 5我的 function 总是返回值 1,但它应该返回值5

You are missing : while assigning values to Base_Sell1 in the loop as Base_Sell1 is mutable variable您错过了:在循环中为 Base_Sell1 赋值时,因为 Base_Sell1 是可变变量

It should be:它应该是:

Base_Sell1 := 5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM