Support and resistance levels are quite popular among traders. Although they are implemented in many apps and services, an open source implementation of the algorithm is hardly available. We try to close the gap.
Continue reading "R code to detect support and resistance levels"
A very important question, which every trader or investor encounters is how many trades to commit or how many stocks to hold in portfolio. Whereas the law of the large numbers readily gives a [naive] answer "the more the better", in practice the answer is often better less but better. Continue reading "Optimal Number of Trades: better less but better"
Even if you are not a Forex trader, it is often necessarily to get currency exchange rates, e.g. if you trade [the options on] foreign stocks. Fixer.io provides daily FX-rates from European Central Bank for 31 currencies via JSON API. We present a script to get data in R.
Continue reading "R-script for Fixer.io – get FX rates in R for 31 currencies"
Remarkably, many market players in energy market still cannot calculate the fair value of a gas storage. In particular, many of them rely on perfect foresight. We put online a simple but correct model from QuantLib. Confidence intervals are estimated as well.
NB! This time not for retail investors but for the colleagues from energy industry. Have a look at short introductory video.
Gas Storage is a relatively complex option to evaluate, esp. if there are non-trivial constraints. Remarkably, many energy companies cannot correctly evaluate even the simplest storage contracts. Moreover, they often resort to a so-called perfect foresight: the price paths are considered random but once the price path is known, it is assumed to be known completely (like at the left-hand sketch).
|Prefect foresight (unrealistic)
||One-step foresight (realistic)
Continue reading "Gas Storage Fair Price | online Calculator"
Some of QuantLib functionality is ported to R in RQuantLib. In particular the pricing of Barrier options. Unfortunately, only European. But we need American in order to price and simulate future scenarios for the so-called KO-Zertifikate (Knock-Out Warrants), which are quite popular among German retail traders. We show how to quickly adopt the code from QuantLib testsuite, compile it under Linux and integrate with R and web.
Continue reading "Integrating QuantLib with R and Web – Barrier Options Pricer"
Our simulator allows you to simulate 100 future scenarios of your portfolios, estimate the expected risk, return and correlations, helping you to improve the diversification of your portfolios. The simulator projects the historical returns in future and is completely model-free (in particular, we don't make an unrealistic assumption of Normally-distributed returns). Though the past doesn't capture all possible future scenarios, it provides a good idea of possible outcomes.
Continue reading "Portfolio Simulator – estimate the expected risk and return of your investments"
We continue developing letYourMoneyGrow.com and soon will make the first tool from the promised portfolio optimization toolset publicly available. And so far a small technical report. We implement the core business logic in R and wrap-up it with PHP. Calling Rscript from PHP via exec("Rscript ...") seems to be easy ... as far as you don't use any libraries. And if you do, you will get an error message like Error in library(RMySQL) : there is no package called 'RMySQL'. Fortunately, there is a solution. However, note that a loaded package may depend on other packages. For instance, RMySQL depends on DBI. Thus you should explicitly resolve this dependency in your R-code like this:
library(DBI, lib.loc = c("/home/<yourUsername>/R/x86_64-pc-linux-gnu-library/<yourRVersion>", "/usr/local/lib/R/site-library", "/usr/lib/R/library"))
library(RMySQL, lib.loc = c("/home/<yourUsername>/R/x86_64-pc-linux-gnu-library/<yourRVersion>", "/usr/local/lib/R/site-library", "/usr/lib/R/library"))
- Sometimes (esp. to fool inexperienced retail investors) the diversification is claimed to be a silver bullet (even in a financial crisis). I show that in crises the diversification effect weakens significantly but still persists (esp. for "defensive" stocks).
- I argue that in a normal (non-turbulent) market the diversification is very helpful in theory but also critically consider its applicability in practice.
- The results that we obtained for the DAX / German stock market should be extrapolated with caution for other markets. You will also see why it is better to watch and know the market (rather than to blindly rely on quantitative analysis and common sense).
Continue reading "The power of diversification and its limits by the example of DAX"
- The martingale strategy asymptotically implies infinite capital or infinitely divisible stake. In reality you have a limited capital and there is a lower (in casino also an upper) bound of the stake.
- In a fair game (with 50/50 chance of profit and loss) the probability of profit after a series of losses is still 50% (because the outcomes of bets or trades are independent from each other).
- Typically, if you win then your profits are moderate but if you lose, the losses are severe (you can lose your capital just after a small series of unlucky bets).
- If you make pretty many bets, you might make a good profit but the probability to make profit at all decreases with the number of bets. Losses stays severe.
Continue reading "Mystery and misery of the martingale betting system: why it will not make you rich"
- Gambling with binary options you either lose 100% or earn about 90% of your stake. The win lose/ratio of 90/100 = 0.9 is worse than by the European roulette (36/37 = 0.973) and even by American roulette (36/38 = 0.947).
- A trade takes just a couple of minutes, which allows (and implicitly encourages) you to commit a lot of trades. Due to the law of large numbers and negative odds, the more you trade, the more you lose.
- Don't trust numerous "success stories" in Internet. Virtually all of them are fake and they are just a marketing trick of brokers or those who earn with brokers' affiliate programs.
Continue reading "Binary Options: you may earn in a short term but eventually you WILL lose"