Monte Carlo – Randomize SWAP of a whole backtest
A SWAP is the interest fee or credit that is applied to a trader’s account when they hold a position overnight in forex or CFD trading. This fee is determined by the interest rate differential between the two currencies in a forex pair or the cost of maintaining a position in CFDs. It can be either positive (a credit) or negative (a debit) depending on the direction of the trade and the interest rate differential.
If we apply this Monte Carlo test, each backtest will contain swap values that are randomly generated within the range [-Range,Range].Simply said, by doing 500 (or a different number) backtests with randomly generated swaps, you can acquire a Monte Carlo analysis perspective on the altering of the Swaps.
In this particular example, we have run 100 simulations with randomised SWAP for every trade.
This parameter in the snippet is a subject to randomization:
- Range: the range within which the swap is selected.
A random number within the range of -20 to 20 is generated when Range = 20 is selected. The second random number will be negative if the first one is positive. This will ensure that we consistently specify both positive and negative spread.
The following parameters are fixed and not subject to randomization:
- Swap Type – Method of swap calculation ( points, money, percentages)
- Tripple Swap The day when a triple swap is applied
- Hour during which the swap is counted
It is possible to modify each of the parameters that were previously mentioned.
How to import snippets / custom indicators to SQX:
- https://strategyquant.com/doc/programming-for-sq/import-export-custom-indicators-and-other-snippets/
I CANNOT COMPILE IT