23.11.2012 г.

Trading strategies: using computing simulation to maximize profits and to control risk

Download link: 

This is a free e-book from Larry C. Sanders from his website tradelabstrategies.com. On this discussion forum you can read an interesting discussion about it.

Larry C. Sanders addresses the topics of probability, marble game and MonteCarlo simulation. He has also designed a software program TradeSim which he sells at his website. The book can be downloaded at this site for free (this is the bookmark link). This book also talks about the Monte Carlo analysis of trades.

19.11.2012 г.

Monte Carlo simulation for trading system's risk control for real newbies

"What is the last thing you do before you climb on a ladder? You shake it. And that is a Monte Carlo simulation" 
Sam Savage, Stanford University

So if we make an analogy the ladder is the result of the trading system's back tests.

Have a look at the picture. Here we have 10 trades of our imaginary trading system, they are numbered from 1 to 10. Each trade is either good or bad, what is important is that we have an equity curve that is formed by those trades.



Here you can imagine we have a result consisting of 10 trades. What we do is that we shaken those results randomly, however no trade is added or deleted. What we do is that we just replace their position randomly. This is called selection without replacement. In other words we change the positions of the trade sequence of the system. 


By doing selection without replacement we duplicate the probability distribution of the initial trade sequence.

If we apply this many times on an initial trading sequence we will get something that looks like that, check the screen shot.

The beginning and the end is at the same point because it is the same trading sequence, but the paths are different.

However the next questions arise, how many permutations we can do? 10, 100, 10000 or 100000.

The practical limits are given by the statistics.

Imagine we have 1000 trades. By calculating the permutations that will give us:

1000*999*998*997*...3*2*1

The number we get is unbelievably big. The number of permutations of 200 is bigger than the number of all atoms that exist in the whole universe. So it if obvious we are not going to do all those permutations.
Hopefully there is a simple algorithm that will help us:


If the probability p is close to 0.5 So the 95 % confidence interval reduces to the following formula:

If we have a flipping coin of 1000 times and we want a confidence level of 95 %. The confidence level will explain how likely the 500 heads is placed within the confidence interval around the estimation.


For the Gaussian distribution we can be 95 % sure that the value is accurate within 3.1 %. With 95 % probability the coin will will fall between 469 and 531 times a head from the 1000 trials you can do.


If we use the formula we get

0.5+1/sqrt(1000)= 0.5+ 0.3162277

0.5-1/sqrt(1000)=0.5- 0.3162277


So we can share that the value is 95 % sure that is accurate within 3.1%.

Practical use of Monte Carlo simulation for traders

So what does it means in practice. In fact the most important aspect of this kind of Monte Carlo analysis is the analysis of the drawdowns. For example with a given confidence level you can say what that worse drowdown can be.

Look again at the shot where are the equity curves. We are going to be interested at the worse case scenario.

Imagine the original system has 500 USD drow down an 1500 USD average profit per year. In our hypothetic example that would be the system with the blue line.

So now we are going to look at the hypothetical equity line with the worst drow down.

If your Monte Carlo analysis show you for example 1000 USD as the worse drowdawn at 95 % confidence level that means that there is 5 % chance of facing 1000 USD drow downs before making any profits. Well if you look at even lower confidence levels the expected drowdown can be lower.


However the worst drow down is not more than the average profit of the system. According to Urban Jaeckle and Emilio Tomasini it is unacceptable to have a drowdown lower than the average profit per year.


The main limitation of the Monte Carlo analysis are that if your initial results are curve – fitted your results will be a nonsense. The Monte Carlo analysis is good only when it is applied for a sound trading system and not to an over-fitted one.

If your trading system is sound or not that is just another thing. The Monte Carlo simulation need to be applied with care but it is a valuable tool for risk control of a sound trading system.


Recommended readings 


Urban Jaeckle, Emilio Tomasini, 'Trading Systems A new approach to system development and portoflio optimization' Hariman house, p.101-108

Farell, Christopher, 'Monte Carlo models simulate all kinds of scenarios' Business Week 2001

Discrete Event Simulation a First course at this link



14.11.2012 г.

Range and timing: John Last's Forex Jokers

John Last's Jokers are useful in three games on the market ;) (market states).

For each game (phase) we have one joker.

You can play three games and they come over and over again. Range, Breakout, Trend, Range, Breakout, Trend and so on.

For each game you have one joker ;)

This is a tactic for range daytrading

Here look at this screen shot below.

Here I try to make an accurate timing of the range.

The idea is as follows. Range can be played but we need it to be fairly broad. This is clearly visible on the fractal bands, but also the common Bollinger is also useful.

In the narrow range (from the perspective of fractal technical analysis) is difficult to be played. Why? Because then orders accumulate  on both sides and it is a matter of chance where will break, and the fake break - outs are pretty nasty. We have to wait patiently for a breakthrough, not to bet which way will break. Well the general technical analysis bet for the continuation of the previous trend but on the 5 m time frame this is ... hard.




OK loot at the screen shot again. We have a christmass tree here but if you wait for Santa Claus this is a good thing to do.

1. Brain trend setting 14 (You can optimize the smoothing visually or run the Brain Trend EA in order to get the best performing set on the current market state)

2. Bollinger bands with 20. This is the fast Bollinger.

3. Bollinger bands with 60 period. This is the slow Bollinger.

The idea is to match roughly with Bollinger of 20 on  15 m time grame. So I multiply the period of three (According to Bollinger should do 2.1 standard deviation increase in the period but you need a special indicator to do that).

4. Oscillator-based digital filter and here a simple smoothed stochastic works (on this chart I use a commercial product but nowadays you can find good indicators easily)


Watch for signals from reaching the two borders of Bollingers the fast and the slow. You can use only the slow if you want.

Then use your price action skills, or use oscillators or wait for convirmation from Brain trend.

Even better you can have your individual oscillator based range system.

Or look for overbought or oversold  levels of your favourite oscillator.

What makes this different is that we do not identify a fractal break - out from the FGDI, or iVAR indicator. And not peak in the indicator: variation of the Hurst exponent.

A can add many confirmations of stochastic on the 15 m time frame but it is useless.

The idea here is that we have two independant statistical tools that come together with pattern recognition.

The Bollinger bands are giving a deviation from the central tendancy.
The Fractal indicators need to detect an anti-persistent situation.

Then you can bet for the reversal.


About Money Management seems reasonable following system:

When signal meets the criteria found three items:

1 Close for a small profit to cover the transaction costs
2 Close at the reaching the midline of the 60 period Bollinger
3 When you reach the opposite levels of resistance and support levels of the channel opposite Bollinger.

Position 2 and 3 can have dynamic stf opso Brain The line.



-Be careful with the News



Trend Joker

Never  counter the trend by having  fractal dimension in the RED of FGDI and the fractal bands have to be wildly apart there. Again a brutal reversals are possible but to catch them you should not suppose it but to react ASCTrend or Brain trend are a good choice.



Range Joker 2

Rage divide it into two types. Narrow and wide. Narrow is risky.


Break-out Joker 3

We have a valid break when fractal dimension crosses 1.5. If this is accompanied by a large variation of the Hurst exponent is morethan- a strong signal.

Again Joker # 1.

26.10.2012 г.

Entropy Scalper EA with AI

You can download the Entropy scalper with chaotic kernel.

The download is available only for registered and logged users.

The performance can be compared.

The idea:

The idea is to detect as for the fractal spcalper a pocket of predictability. Within this pocket of predictability we are taking a directionnal signal based on the current volatility.

So there are thre main components:

a. The pocket of predictability.

The pocket of predictability is a situation when we have an increased predictability. We do not know why this occurs, we are interested in the fact. And this pocket can be discovered using different tools. In metatrader we have fractal dimension indicators family: FDI,FGDI, iVAR, Hurst exponent, and the fractal scalpers are using then.

Here the entropy scalper is using an entropy indicator. The entropy is another way to measure those mystical pockets of predictability. Here we look for a drop of entropy below certain levels. The default levels are 0.6.

b. Directionnal signal

The directionnal signal is using a special set of indicators. The indicator used is the Entropy math indicator. The Entropy math indicator is a whole story by itsels. This is not a traditional indicator but and it comes from the work of John Conover, you can visit his site for more details. The entropy math is a Metatrader version of his work, the article is called quantitative analysis of high entropy systems.

However we use a set of four Entropymath indicators as inputs and we use a Chaotic kernel in order to optimize the values with the genetic optimizer. Se keeping it simple the Entropy math is an input that is used by a "neural network" (The chaotic kernel with the genetic algorythms is different but let keep it simple.)

c. Market State:

The market state is used trough the stop loss, take profit and live hours settings.

It is obvious that this is a critical component. We use the genetic algorythm to find those values. However it si advised to use your own view of the market and additional tools as the Lyapunov exponent.

And of course take care of the news releases.



Installation:

In the archive there is an EA files and two indicators. If you do not have those indicators you need to install them in order to run the EA

Some idea:

As you can see there are many parameters that are common among all the fractal scalper indicators.

You can check the fractal scalper description.

One of the most important parameters concern the stop loss the take profit and the live hours parameters.

Those parameters are specific for the current market conditions. As I recommend that you use open prices only for optimization (otherwise it will takes a lot of time), you can't use stops below 15 pips.

There are the paprameters if the two chaotic kernels.

You can optimize both or one of them.

x from 0 to 1 with step size 0.01, 0.001 or 0.0001

limit map from 1 to 1000 with step size 1

r from 1 to 4 with step size 0.01, 0.001


7.10.2012 г.

EA Gann High Low Activator


The work of Gann is indeed very interesting it is the result of someone who has dedicated his entire life to the markets.

Howevever what we know about him today is not everything he has created. Some of his works never quited the manuscript stage.

I think that he was using everything he can, all the available technology of his day in order to read the markets. I think he was a visionary. Many can't understand but the simple bar charts of today were at the time something completely astonishing.

Yes today we have the summum of all the technical analysis available on internet, most of the readers here have gigabites of technical books and works in their hard - drives.

But on the other hand if Gann had an odge during his lifespan markets over the others the same is not true for us.

The market is something very specific, not all markets are the some and the markets evolve during time. I mean that the most computarized markets of today are fundamentally different from the markets in which Gann has practices his methods.



So there are two difficulties.

1. The Gann works and methods are incomplete (many of his works are not available).

2. Even if they were they were created for markets totally different from the market of today. That means that authomatic implementation is not going to work.



And yes, what can be done is to be fimiliriased with his methods and to have a creative approach.

Some even say that Gann was one of the first guys who actually used algorythmic approach. It is about the Gann high - low activator (now by the way entirely coded in mql and freely available to everybody, in its time that was the edge of the research).

Have a loot at: Krausz: W.D. Gann Treasure discovered



I made my own EA Gann High Low Activator. It is based on the indicator Gann High Low activator SSL from the code base.

You can download the indicator with the EA from here, just click on the download button. You need to install the indicator in order to make it work the EA.

And here the good news are over. Yes I made some testing but I did not find this EA strategy reliable on the recent market of Euro/Dollar. You can make your own tests and share.

Parameters:

The EA is based on the moving average generic EA, that means it shares the generic money management module. However in order to make it work I changed the trading rules a little bit (I do not pretend that I got it right).

So there is only one parameter and it comes from the High Low activator it is the Lb parameter and that is simply the number of bars you use for the computation of the indicator.

The rules can be interpreted as the basic single average system towards the price. Check the picture and you will understand.

If the Close is < the Gann High Low Activator indicator we Sell

If the Close is > the Gann High Low Activator indicator we Buy

DOWNLOAD the EA from here



26.09.2012 г.

A typical scam system

Here I will put some citations and codes from a scam system presentation. The idea of those presentations is to manipulate the way you feel about it and not at all to give any arguments or proofs. Even it selects people who actually deserve to be scamed. Why? Because it it stated that the system is being stolen. And they are offered a low price stolen system. No really I think I would have no particular compassion towards their $299. What really is dangerous is to actually trade this system.

But here it is the SYSTEM.

Omni system platinum

I will put an end to all the scams (Nice huh). It is time somebody who has the guts and the strength to tell you the truth.

I have a trading system that for nine consecutive years was profitable. (On the backtest of course).

I was a chief programmer for a hedge fund (believe me please). We were tasked for a mission that has never been accomplished before (lol). The owner of fund was Dr. Cameron Heinz.

This guy (the best guy) was a pioneer in the field of Heuristics and its application in indirecto Problem Solving (that sound great). He is extremely rich. He has built some truly amazing unbeatable system that can accureately predict the market.

Here is how it works:

Parallel hybrid heuristics and parallel optimization. (Anybody knows what is that lol)

At the heart of the system is a database of chart patterns encrypted within the system (who the fuck is going to encrypt pennants and triangles LOL). These patterns are guarded heavily (oh please).

You can get extremely safe trades (everybody says so ;) ). And you will use winning price patterns.

The man who created that is Jonas Kaiser (nice name), one of the worlds most successful day traders (a kind of trading batman). He created 39 specific videos but only his friends are allowed to watch them. The techniques siphon money from the market with almost no risk (nice metaphore nothing more).

We turned each video technique into an algorithm within the database that the system could read. Each algorithm was then encrypted with KG-245A Fifth – generation of encryption (now the newbies are impressed for sure).

The system is so advanced that it actually learns more and more about the market as it is used.

We let it start with an account of &10 000 And within 3 days it had turned that $10 000 into just under $17 000. (Anyway this does not look like extremely safe trades ;))

A HUGE success. (;) I think they have been telling the same for the kamikazes).

It was so successful for the Hedge fund that I was fired. The senior managers do not require the programmers who develop the system (bool shit). I felt cheated and used (now this addresses the personal feeling of the potential scammed buyers, they are good compassionate souls). Now I cannot find a similar job with the same pay grade.

So as I had the 39 secret videos …After six months we made a home based system trading smaller accounts. We call it OMNI.

It was consistently profiting by 20 – 50 pips each day. (Daytraders love those numbers).

I found the system to make $1000 than to travel to the close ATM to take the money. (Well my ATM is just next door).

Now you will get your own copy of OMNI.

I make no apologies it costs $2000 an annual license.

The system makes $5000 even $6000 each day so why not. (well what about the small account and the extremely safe trades, some inconsistency there).

I have 5 people using the system (extremely privileged circle of traders and even two high-profile Wall Street traders (what?!), the idea of this is there is a privileged circle).

Now I am offering a way to profit from the system (Oh I really want it badly now ;) )

I will extend the opportunity to take it to the next level (this is a clear nlp language inducing into hypnosis).

If you had been an owner of OMNI since 2002 you can turn $2000 into $130 000. (of course in the back test I can achieve that on daily basis with almost every free EA).

And $10 000 will end as 1.3 million dollars. (Now the millionaire dream comes into play).

You have seen the inarguable truth (what please say it again I really like it).

You would have done a 2, 3 hours amount of work (hahaha).

And you can remove the profits and play with the house money (a typical gambler’s dream).

Now let see the core components.

Make money without significant effort and time commitment!

We use the brand new parallel hybrid heuristics technology: capable to see the Immediate future with Uncanny accuracy.

You get 3 add-on computational cores:

You have database encryption computational core
Parallel hybrid heuristics computational core
Stringent Purifying computational core (I am truly amazed by the name)


The price is $2 470 for activation fee and the annual subscription is $1 997.
So it makes $4 467.
Now we eat the activation fee + unlimited license. (wow)
You are going to pay not even $1497
You are going to pay not even $997
You are going to pay not even $997
You are going to pay not even $497
You are going to pay not even $297

If you act today it is $197 (Come on give it for free)

The value if the HUGE BONUS PACKAGE is valued at $8637
(I wonder how he gets to those numbers).

1.09.2012 г.

Trading NLP

Trading NLP! Does it exist? Definitely trading nlp exists and there are even books dedicated to NLP and trading.

The first question is what is NLP? According to Wikipedia

Neuro-linguistic programming (NLP) is defined as an approach to communication, personal development, and psychotherapy created in the 1970s. The title refers to a stated connection between the neurological processes ("neuro"), language ("linguistic"), and behavioral patterns that have been learned through experience ("programming") and can be organized to achieve specific goals in life.

The leading book for trading application of NLP is "NLP for Traders and investors: Personal Strategies to Give You the Edge Over Those Using Just Fundamental and Technical Analysis" by Terry Carroll.

From historical perspective NLP come with several books having more scientific perspective. The Structure of Magic I: A Book About Language and Therapy v. 1 (Structure of Magic): A Book About Language and Therapy.

Later its creators opted for more pragmatic and commercial evolution. The NLP has been simplifed and dedicated towards to ordinary public.

I think that this was partially (or mainly) the reason for the critical attitude from the scientific community. As you can read the main Wikipedia article this is the main thing that comes "According to certain neuroscientists,[3] psychologists,[4][5] and linguists,[6][7]NLP is unsupported by current scientific evidence, and uses incorrect and misleading terms and concepts."

Even more "Criticisms go beyond the lack of empirical evidence for effectiveness; critics say that NLP exhibits pseudoscientific characteristics,[14] title,[3] concepts and terminology.[6][15] NLP is used as an example of pseudoscience for facilitating the teaching of scientific literacy at the professional and university level.[7][16][17] NLP also appears on peer reviewed expert-consensus based lists of discredited interventions."[5]

OK you can read here as "discredited interventions","pseudoscience" and my favorite "lack of empirical evidence for effectiveness".

So you can ask WHY BOTHER with nlp.

I can structure my opinion as follows:


-I think that when NLP was created it was ahead of its time. As NLP is multidisciplinary (and scientists hate the multidisciplinary approach because that makes them work much harder). I think that pose a real problem of fair statistical evaluation. The reason is that it is too complex and a lot of bias can be achieved mainly by not understanding it.

-The second thing is that NLP is not science, it was developped as a technology. And NLP is technology. So NLP is not a unified scientific hypothesis as for example the Standard model in physics and if you disprove one part of the model the whole thing collapses. NLP is a set of techniques (I prefer the term psycho technology).

So my opinion is that NLP can and should be used pragmatically. That means to focus on a specific technique and approach and to see if it works or not and not to bother with the whole thing (being mostly not proved and criticisezed).

The NLP modelling

The NLP modelling for traders is probably the most central implications in practice. The reason is that trading is difficult and very psychologically demanding. And that may crack psychically even the most brilliant minds.

The ideas is to select the appropriate mind programs used by traders, to analyse them, to copy them and finally to use them.


That is the NLP perspective, in other words the most deep thaughts spoken by the masters are just words, unless you have the knowledge to implement that in practice.'

I really I am not sure but it is completely normal not to understand me for the moment.

The ideas is how to protect your self and to have a clear methodology for that.

That is why I am mostly interested in the modelling and the use of internal ressources part of NLP. The use of anchors and anchoring and conditionning is a valid scientific and psychological process. (Here again I am concerned about the most immediate scientific support and not the scientific validity of NLP in general).


Example of NLP modelling target strategy

So I would give an immediate example, otherwize it may remain totally unclear.

I was asking one trader what is his psychological attitude towards the EA optimization.

His answers is that for him that is a way to compute an optimum strategy. In that strategy the losses are a part of the strategy.

And here comes immediately a psychological strategy for dealing with the losses.

The next question was how he considers psychologically the losses?

The losses are a part of the strategy they are computed in the strategy and they are inevitable.

(So here this is not about reasonning it is about how psychologically you deal with the situation).



The next psychological test is if the losses are within the risk limits of the strategy or not and that need to be computed beforehands.



Then using the NLP you could program to follow that strategy using the typical methods that may be unique for every human being.

So here that is not the truth, that is just a technology to deal with the stress that comes from trading a EA. With the tools of NLP it is possible to incorporate that strategy without the NLP technology those are just words.



15.08.2012 г.

Performance booster for Metatrader


I was thinking if I can boost the performance of my Metatrader during optimization of trading strategies.

I found an interesting program for boosting PC performance for enhanced gaming experience. So why not.

Look at this screen shot it looks like there is 42 % increased performance after shutting down unnecessary services.

There is a paid program too by avgm that allows to do such kind of things. It looks like a lot can be achieved just by shutting down unnecessary services.

In the shot I just added the metatrader as a game in order to boost the performance when it is launched.


AVG PC tune up versus Game Booster

The game booster is a free software and it boosts the Windows only when the application is launched. When you close the application the Windows gets back to normal, and that is the feature I like.

AVG PC tune up is a paid service.

My friends who tried it recognized a noticeable performance change.



19.07.2012 г.

Sample Code to Export C# DLL to Metatrader

C# developers who want to get their DLL to link to Metatrader now have a means to that end. Using Robert Giesecke's Unmanaged C# DLL Exports template, it is possible to create a DLL that may be referenced from non-Com enabled languages, like Metatrader's MQL4 or other scripting languages available in many trading packages, such as EasyLanguage (TradeStation).

Sample code and a downloadable sample project are available here.

8.07.2012 г.

EA performance and fundamental analysis

Is there a relationship betwen the EA performance and the fundamental analysis?

http://www.zerohedge.com/news/ecbs-balance-sheet-hits-new-record-highs-fair-eurusd-value-900-pips-lower




As you can see there is a very interesting correlation Fed/ECB and EUR/USD.

The author says make your bets.

I was thinking if it is possible to do something else. I will write more on that later. For the moment I am making some assumptions.

The idea is that there is a relationship between a fundamental situation and EA. The best example was the EUR/CHF system by vgc.

Here on this correlation there may lie another relationship between a fundamental situation and EA.

We see that there is a big disbalance between a fundamental relationship and the current market situation.

We could hypothetize that we have a disbalance between a fundamentals and the market.

So whenever the market goes back to balance, it will make it in a movement that would be related with volatility. And even more we can hypothetize that we could have a particular market state that has at least short term predictability.

If you follow me, the idea is that whenever we see a special break - out we can turn our EAs on and they will deal with the situation. As the movement would have at least short term predictability and high volatility we can use EA systems that do work in those kind of situations:

-Spinal implant

-Brain Trend

-Asctrend EA

They would work very good in those market conditions when the market goes with a strong movement towards its fundamental balance.



So to summarize:

1.Fundamental disbalance

2. Looking for a shift of the market towards the balance

3. We swith on the impulse following EAs hypothetizing that the movement would be more or less predictable.

4. We swith of the EA when the market gets into balance again (or at least lower the market exposure).