无法使用参数调用 'operator /'
Cannot call 'operator /' with argument
我无法正确输入公式。我有以下错误:
第 28 行:无法使用参数 'expr0'='totalRevenueBySampling' 调用 'operator /'。使用了 'fun_ref[totalRevenueBySampling]' 类型的参数,但需要 'const int'
无法使用参数 'expr1'='totalOperatingExpensesBySampling' 调用 'operator /'。使用了 'fun_ref[totalOperatingExpensesBySampling]' 类型的参数,但需要 'const int';
第 28 行:在范围 'Rs' 中找不到变量 'Rs',无法注册副作用
这是一个脚本看起来:
Kr = Ra / Rs,其中 Ra = Sa / Ea,其中 Rs = Ss / Es
这是我写的脚本:
//@version=5
indicator("Competitiveness")
// Ra (effectiveness from operations)
// Sa - Total Revenue
// Ea - Total Operating Expenses
Ra() =>
Sa = request.financial(syminfo.tickerid, "TOTAL_REVENUE", "FQ")
Ea = request.financial(syminfo.tickerid, "TOTAL_OPER_EXPENSE", "FQ")
Ra = Sa / Ea
// Rs (effectiveness from operations by sampling)
// Ss - Total Revenue by Sampling
// Es - Total Operating Expenses by Sampling
sym1 = input.symbol("", "Ticker")
sym2 = input.symbol("", "Ticker")
Ss() =>
obj1 = request.financial(sym1, "TOTAL_REVENUE", "FQ")
obj2 = request.financial(sym2, "TOTAL_REVENUE", "FQ")
totalRevenueBySampling = math.avg(obj1, obj2)
Es() =>
obj1 = request.financial(sym1, "TOTAL_OPER_EXPENSE", "FQ")
obj2 = request.financial(sym2, "TOTAL_OPER_EXPENSE", "FQ")
totalOperatingExpensesBySampling = math.avg(obj1, obj2)
Rs() =>
Rs = Ss / Es
// Kr (effectiveness from operations ratio)
Kr() =>
Kr = Ra / Rs
plot(Kr(), "Kr", color.aqua, 2)
我哪里错了?
将 ()
添加到您的函数调用中。
Rs() =>
Rs = Ss() / Es()
// Kr (effectiveness from operations ratio)
Kr() =>
Kr = Ra() / Rs()
我无法正确输入公式。我有以下错误:
第 28 行:无法使用参数 'expr0'='totalRevenueBySampling' 调用 'operator /'。使用了 'fun_ref[totalRevenueBySampling]' 类型的参数,但需要 'const int' 无法使用参数 'expr1'='totalOperatingExpensesBySampling' 调用 'operator /'。使用了 'fun_ref[totalOperatingExpensesBySampling]' 类型的参数,但需要 'const int'; 第 28 行:在范围 'Rs' 中找不到变量 'Rs',无法注册副作用
这是一个脚本看起来:
Kr = Ra / Rs,其中 Ra = Sa / Ea,其中 Rs = Ss / Es
这是我写的脚本:
//@version=5
indicator("Competitiveness")
// Ra (effectiveness from operations)
// Sa - Total Revenue
// Ea - Total Operating Expenses
Ra() =>
Sa = request.financial(syminfo.tickerid, "TOTAL_REVENUE", "FQ")
Ea = request.financial(syminfo.tickerid, "TOTAL_OPER_EXPENSE", "FQ")
Ra = Sa / Ea
// Rs (effectiveness from operations by sampling)
// Ss - Total Revenue by Sampling
// Es - Total Operating Expenses by Sampling
sym1 = input.symbol("", "Ticker")
sym2 = input.symbol("", "Ticker")
Ss() =>
obj1 = request.financial(sym1, "TOTAL_REVENUE", "FQ")
obj2 = request.financial(sym2, "TOTAL_REVENUE", "FQ")
totalRevenueBySampling = math.avg(obj1, obj2)
Es() =>
obj1 = request.financial(sym1, "TOTAL_OPER_EXPENSE", "FQ")
obj2 = request.financial(sym2, "TOTAL_OPER_EXPENSE", "FQ")
totalOperatingExpensesBySampling = math.avg(obj1, obj2)
Rs() =>
Rs = Ss / Es
// Kr (effectiveness from operations ratio)
Kr() =>
Kr = Ra / Rs
plot(Kr(), "Kr", color.aqua, 2)
我哪里错了?
将 ()
添加到您的函数调用中。
Rs() =>
Rs = Ss() / Es()
// Kr (effectiveness from operations ratio)
Kr() =>
Kr = Ra() / Rs()