WebthinkScript® is a built-in programming language that gives you the capability of creating your own analysis tools such as studies, strategies, watchlist columns, etc. In thinkScript®, you decide which kind of data to analyze with which methods. WebMar 28, 2024 · Click to expand... maybe this will help when you want to try using a fold loop. here is a study that looks at x previous bars and finds how many consecutive bars are …
thinkscript - How to use fold statement index in function …
The foldoperator allows you to perform iterated calculations. The list below explains the operator's logic (variable names are taken from the sample syntax above): 1. The purpose of the fold operator is to perform an iterated calculation and assign the final value to the resultvariable. 2. The indexvariable serves as a loop … See more def = fold = to [ with [ = ] ] [ while ] do ; See more This example script calculates the factorial of a number. Here, the factorial variable stores the result value of the calculation; index is the counter and its values are … See more WebOct 12, 2024 · The Fold function in thinkScript can be used to iterate over a list of data points and perform a calculation on each point. ... The index variable operates as a loop counter. thinkScript Fold Function Explained. Several knowledgeable developers in the thinkScript community have written about the Fold function. debenture accounting entry
Help with fold statements - useThinkScript Community
WebOct 25, 2024 · If you need the look back to be a dynamic length using an input you'd need to use fold to loop. If a static length is fine then the code is simpler. I think this is equivalent but definitely review/proofread this and test it thoroughly. It should at least get you close to … WebMar 25, 2024 · I was playing with this tonight. I noticed 2 issues. The first was a counter issue. Let's say you have CCI values of 54 45 35 37 the counter would from 54 would go like this 45:1 35:2 then 37 is above 35 it becomes the new 2. 35 is now not included in the count. Second when the CCI breaks the +- 45 the counter should still count. I modified the … WebGo to ThinkScript r/ThinkScript ... # Loop through all the options in the option chain for (int i = 0; i < optionclass.CALL(); i++) { # Get the option contract at the current index def optionContract = optionClass.CALL(i); # Get the bid and … debenture and bond