LibraryStopwatchLibrary "LibraryStopwatch"
Provides functions to time the execution of a script.
When timing scripts, keep in mind that the runtime environment is fluid on TradingView. Different servers or server loads will impact execution time.
Look first. Then leap.
stopwatchStats() Times the execution of a script.
Returns: A tuple of four values: timePerBarInMs, totalTimeInMs, barsTimed, barsNotTimed
stopwatch() Times the execution of a script.
Returns: A single value: The time elapsed since the beginning of the script, in ms.
Debugging
DebugConsoleLibrary "DebugConsole"
Methods for debuging/output into a table, console like style.
init(size) initiate property variables.
Parameters:
size : int, console line size.
Returns: tuple, table and string array.
queue(console_id, new_line) Regular Queue, will be called once every bar its called.
Parameters:
console_id : string array, console configuration array.
new_line : string, with contents for new line.
Returns: void.
queue_one(console_id, new_line) Queue only one time, will not repeat itself.
Parameters:
console_id : string array, console configuration array.
new_line : string, with contents for new line.
Returns: void.
update(table_id, console_id) Update method for the console screen.
Parameters:
table_id : table, table to update console text.
console_id : string array, console configuration array.
Returns: void.
Simple debug functionSimple method I used to debug problem in my script.
For loop generates 5 numbers from the given depth. At present, depth is 9
Rules for generating the combinations are as follows:
First number is always 1
Two even numbers should not be adjacent to each other and two odd numbers should not be adjacent to each other
Numbers should be ordered in incremental order.
Print all possible combinations
While the logic above is just a random one. Debug method can be reused for any program.