thinkscript

Understanding & Converting ThinkScripts CompoundValue Function

不问归期 提交于 2020-01-06 05:06:15
问题 I'm currently converting a ThinkScript indicator to C#, however, I've run into this CompoundValue function and I'm unsure how to covert it. The documents reads : Calculates a compound value according to following rule: if a bar number is greater than length then the visible data value is returned, otherwise the historical data value is returned. This function is used to initialize studies with recursion. Example Use: declare lower; def x = CompoundValue(2, x[1] + x[2], 1); plot

thinkscript if function useless in important case

房东的猫 提交于 2019-12-25 01:24:22
问题 The thinkscript if function fails to branch as expected in an important case. The following test case can be used to reproduce this severe bug / defect. In a nutshell, an if statement may normally be used to prevent a function call from being executed if one of its function parameters is invalid. We show that this is not the case. In fact, both branches are executed, including the branch not meeting the if condition. This absolutely defeats the purpose of the test of the if condition, the

thinkscript if statement failure

送分小仙女□ 提交于 2019-12-11 16:14:05
问题 The thinkscript if statement fails to branch as expected in some cases. The following test case can be used to reproduce this bug / defect. To cut the long story short, a possible workaround in some cases is to use the if-expression which is a function, which may be slower, potentially leading to Script execution timeout in scans. This fairly nasty bug in thinkscript prevents me from writing some scans and studies the way I need to. Following is some sample code that shows the problem on a