Pivots Benchmark For Indicators (MA / OSC) This measures the pivot of your source. the peaks and valleys. and, shows ou some neat statistics if you were to use those as your entry/exit points. I consider it a purist MA designers Acid Test. if you can get good numbers on this, (remember to deduct fees), you probably should feel confident in your indicator's quality. it isn't very forgiving.
170 themes Dark/Light
your choice of highlight colour for Best/Worst achievement values.
compare to open/close average, or a 3 length EMA on close.
display solo bench of your source.
help popup for indicator values, (hideable)
show/hide individual pivot distances, which source to measure as pivot
time to measure historical setting
number of pivots to keep in buffer
it does back test and runs live!
Closed Source for now, as it is a demo version i've made with partial capabilities.
it's part of a set of performance benchmarks i hope to have finished soon.
when i release the major components i've been building up to for 2 years,
this and everything else will be open sourced.
Testing
ANTEYA ProfilingThis script allows to compare which code is more efficient by running it inside a loop for a certain time or a certain number of iterations.
Just paste your pieces of code as Option 1 and Option 2 inside the loop (see comments in the script).
[UTILS] Unit Testing FrameworkTL;DR
This script doesn't provide any buy/sell signals.
This script won't make you profitable implicitly.
This script is intended for utility function testing, library testing, custom assertions.
It is free and open-source.
Introduction
About the idea: is not exclusive, programmers tend to use this method a lot and for a long time.
The point is to ensure that parts of a software, "units" (i.e modules, functions, procedures, class methods etc), work as they should, meet they design and behave as intended. That's why we use the term "Unit testing".
In PineScript we don't have a lot of entities mentioned above yet. What we have are functions. For example, a function that sums numbers should return a number, a particular sum. Or a professor wrote a function that calculates something or whatever. He and you want to be sure that the function works as expected and further code changes (refactoring) won't break its behaviour. What the professor needs to do is to write unit tests for his function/library of functions. And what you need to do is to check if the professor wrote tests or not.
No tests = No code
- Total test-driven development
Ok, it is not so serious, but very important in software development. And I created a tool for that.
I tried to follow the APIs of testing tools/libs/frameworks I worked or work with: Jasmine (Javascript), Mocha/Chai (Javascript), Jest (Javascript), RSpec (Ruby), unittest (Python), pytest (Python) and others. Got something workable but it would be much easier to implement (and it would look much better) if PineScript had a higher-order functions feature.
API
_describe(suiteName: string)
A function to declare a test suite. Each suite with tests may have 2 statuses:
✔️ Passed
❌ Failed
A suite is considered to be failed if at least one of the specs in it has failed.
_it(specName: string, actual: any, expected: any)
A function to run a test. Each test may have 3 statuses:
✔️ Passed
❌ Failed
⛔ Skipped
Some examples:
_it("is a falsey value", 1 != 2, true)
_it("is not a number", na(something), true)
_it("should sum two integers", _sum(1, 2), 1)
_it("arrays are equal", _isEqual(array.from(1, 2), array.from(1, 2)), true)
Remember that both the 'actual' and 'expected' arguments must be of the same type.
And a group of _it() functions must be preceded by a _describe() declaration (see in the code).
_test(specName: string, actual: any, expected: any)
An alias for _it . Does the same thing.
_xit(specName: string, actual: any, expected: any)
A function to skip a particular test for a while. Doesn't make any comparisons, but the test will appear in the results as skipped.
This feature is unstable and may be removed in the future releases.
_xtest(specName: string, actual: any, expected: any)
An alias for _xit . Does the same thing.
_isEqual(id_1: array, id_2: array)
A function to compare two arrays for equality. Both arrays must be of the same type.
This function doesn't take into account the order of elements in each array. So arrays like (1, 2, 3) and (3, 2, 1) will be equal.
_isStrictEqual(id_1: array, id_2: array)
A function to compare two arrays for equality. Both arrays must be of the same type.
This function is a stricter version of _isEqual because it takes into account the order of elements in each array. So arrays like (1, 2, 3) and (3, 2, 1) won't be equal.
Usage
To use this script to test your library you need to do the following steps:
1) Copy all the code you see between line #5 and #282 (Unit Testing Framework Core)
2) Place the copied code at the very beginning of your script (but below study())
3) Start to write suites and tests where your code ends. That's it.
NOTE
The current version is 0.0.1 which means that a lot of things may be changed on the way to 1.0.0 - the first stable version.
Cosmic BB SRThis script is based on Bollinger Bands/Bandwidth data and displays support and resistance levels (thick horizontal lines), the direction/volatility of the levels (thin dynamic lines), and the testing of the levels (cross markers).
Formula for Day Trading NSEINDAtesting script. please try at your own risk. don't claim if any damage
Manual Back Test LinesI created this indicator to primarily manually test other indicators in replay mode.
To use this indicator generally you will:
Select trade type: long or short
Enter your ATR (enter the actual ATR). The indicator will then calculate and plot your SL and targets based on your values
Default Stop Loss is ATR * 1.5
Default Target 1 is ATR * 1.5
Default Target 2 is ATR * 3
Using this indicator on Replay mode is great. What you do is go back in time. Hit play and as the indicator(s) you use provide signals pause.
Pull up options:
Select trade type
Update ATR value
Change date to entry date. Typically if you are trading off the daily timeframe you are going to wait for your current day candle to close to provide signal. That would mean your entry would be on the next day.
Click play and watch, track and record how trade unfolds.
Future updates:
I'd like to be able to have some way to click one button and have it fire that enter trade right now on chart. Also I'm working on figuring out how to calculate the ATR on the entry date so that isn't required to be entered.
Finally, I'd like to have some auto calculation on when targets and SL are hit. I have this partially done but it's more important that I use this indicator than spend time or funds to update it to do that. But I do plan on updating.
Binary Options Strategy Testing ScriptThis is a script for testing binary options trading strategies. To test a strategy, modify the 'go_down' or 'go_up' booleans. These SHOULD NOT access any current values (for example, 'ohlc4' or 'close '), or the backtesting will not be an accurate representation of the forward values.
Modify the fraction_return input to be the return rate of the option on success. This is assumed to be a true 100 or 0 option- i.e. if the choice is not correct, there is a 100% loss.
The strategy in place is merely an example, and as you can see, has a very negative rate of return when implemented as a strategy.
Please comment in your code if you use this in any future posts. Thanks!