## A generic polynomial time based SL/TP mechanism for our PA mining

If you have been following my blog for a while you might remember that I am a big fan of functionally adjusted exit mechanisms. I have discussed them at length in the past and even wrote an article in FX Trader magazine to talk about some general aspects of these functions. In pKantu – our GPU based system mining software –  we have implemented 7 different function-based dynamic SL/TP mechanisms but we have now implemented an eight mechanism that basically allows us to have a virtually endless variability in the way in which we vary our SL/TP values. Today I want to talk about this new generic polynomial mechanism and why it’s so important to expand our mining frontiers.

The idea of these function based exit mechanisms is simply to adjust the SL/TP of a position as a function of time – not price – in order to account for the natural decay in the expectation of profitability after a trade is entered. Basically we assume that when we enter a trade we have the maximum expectation to make money and after that time we reduce our acceptable loss (SL), our expected profit (TP) or simply both. Since we mine systems that fit a particular type of functional exit mechanism we tend to find whichever entries are best adjusted to give this type of evolution as a function of time. Since basically any differentiable function can be used to implement this concept it’s important to pick functions that realistically mirror an expected price curve progression.

Polynomial functions are especially well fitted for this since they can be used to create curves that offer variations like the ones showed in the first image above. In this image you can see the SL/TP evolution curves you would expect for various polynomial functions for an initial SL/TP of 50 pips with a BE point of 20 bars. All of these functions reach a value of zero after 20 bars but as you can see behave very differently before and after the BE point is reached. The idea is that by simply varying the exponent of the polynomial function we can get various different kinds of price evolution graphs. A system that uses an SL function with the X^0.25 function expects price to move very rapidly in its favor and then expects price to move very slowly after that while the X^4 function expects the exact opposite behavior to happen, price to remain relatively calm in the beginning and then move swiftly in its favor after sometime. There are entry logic sets that would favor either one of these functions.

A generic polynomial SL/TP mechanism simply implements the above in a way where the exponent of the function is a variable, allowing us to get basically any range of behavior we desire in terms of the speed with which we expect price to move in our favor. The second graph – showing the derivatives of these functions – allows us to see how the slope of the functions changes through time. For the X^0.25 function for example the initial SL is reduced by 23 pips after 1 bar while for the X^4 function this reduction is only 0.0003 pips, or basically zero in real trading terms. However after reaching BE – in bar 20 – the variation of the X^0.25 function is now only 0.63 pips while the X^4 function now has a much larger variation of 9.27 pips. We can therefore obtain a very nice range of initial to final pip changes in SL/TP values by adjusting the exponent of our generic polynomial SL/TP functions which also varies the types and diversity of systems we can mine. Since we can use any floating number to adjust the exponent so we can obtain virtually any initial or final variations in the evolution of the SL/TP we desire.

Of course there are even more functions that can be used and there are even more complex functional based mechanisms that can be implemented, for example combining several polynomial functions. However the simple generic polynomial mechanism with a single exponent parameter allows us to keep mining bias substantially reduced while increases in complexity in the selection of the parameters used for these functions would undoubtedly increase our mining bias to levels that would make system mining more difficult. If you would like to learn more about pKantu and how we mine trading strategies using GPU technology please consider joining Asirikuy.com, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading.strategies.