How does Forex Derivative Pro determine support/resistance levels?

Forex Derivative Pro calculates the data for multiple time frame periods, determines price histogram, finds the local minimums of price histogram, adds max & min values, adds round numbers and average over all of the levels.

Sounds complicated? It actually is. You can find more about it in the user manual. And luckily you don't need to understand any of this.

Forex Derivative Pro is the only EA that is able to constantly recalculate support and resistance levels and show them on the screen to the user. In order to see the S/R levels when you are using Forex Derivative Pro software just make sure that you have DisplaySRLevelsOnChart variable set as true in your Inputs Tab.

Once the entry signal is confirmed with nearby support and resistance levels it needs to be confirmed against higher time scale. Basically, the EA will not open a position which is against a clearly defined higher time scale trend. For that purpose the EA uses ΔEMA/ΔT formula. The reason for doing so is that by using the slope information one can recognize changes in the trend much faster than by using usual methods.

Ok. Lets go back to our trade. Lets assume that our bearish entry signal was confirmed with nearby S/R levels as well as with the long term trend. The EA has taken a position on a SELL side.

First the EA needs to determine the Stop Loss level. Stop loss is calculated by using the next resistance level. Since the entry signal is bearish we expect the price to move downwards. The price may also move upwards but we do not expect such movement going far beyond the next resistance level.



The final stop loss level is increased by an offset value defined by the external variable SL_LevelOffset. The offset has the following purpose. The probability that the price moves clearly through the resistance level by for example 50 pips is much lower than the probability that it just touches the resistance level. The stop loss should not be too close to the entry price. Because of that minumum stop loss (SL_MinValue) is defined.



Take profit in this example is is calculated by using the next support level. Since the EA entered the trade on the bearish side it expects the price to move downward. At least until it encounters the next support level.




The final take profit level is reduced by a minus offset value (TP_LevelOffset). It has the following purpose. A support level can not be determined with a 100 percent accuracy. So a bounce off a support level does not have to occur exactly at the support level.





That is why the EA will place a take profit level above the support level by a predetermined offset value.

Profit Protection.

Once the trade has come into certain profit the profit protection variable is activated. On one hand we want to let the trade have some space in order to reach the take profit level. On the ohter hand we want to ensure that part of our profit is locked in. Forex Derivative Pro is using the following formula when calculating Profit Protection.

ProtectedPips = HighestCurrentProfit x Factor
Factor = Start factor + (x – xo)/(x_TP –  x0) ^ n  x (1 - Start factor)

with

Start factor   =            ProfitProtection_Factor
n              =            ProfitProtection_Exponent
x_0            =            ProfitProtection_StartAtPips
x_TP           =            Take Profit Level

Here is a snapshot of how the stop loss may be readjusted in order to protect part of the already achieved profit.



Money Management


How to reach decent profits and at the same time protect your capital?

The task is to find the proper lot size for reaching decent profits, but at the same time protecting your capital from suffering a painful setback. One can describe this task mathematically as finding the lot size which maximizes the profit subject to the constraint that we do not want to experience a capital setback greater than a predefined value.

In mathematics such problem is known as “constrained optimization” and can be solved by using the method of Lagrange multipliers. See the picture below:



Without any constraint for a strategy with a profit factor greater than 1, the solution for optimal lot problem is as follows:



That means the bigger the lot size, the greater the profit we will have. However, if constraints come into play the solution is as follows:



The difficulty here is to determine MaxDradown. The reason is that the maximum drawdown is not just the maximum loss you may phase in a single trade, or the loss you may suffer in the case you get maximum number of losses in a row. The maximum setback can also occur in the case you get losing trades within winning trades.

Clearly speaking there are millions of combinations and you can only determine the maximum drawdown in terms of probability. We will use a 3sigma-probability level which means that with 99.75% probability - almost 100% - we won’t reach the predefined drawdown.For doing so we use the so-called Monte Carlo method.

Monte Carlo methods are a class of computational algorithms that rely on repeated random sampling to compute their results.Monte Carlo methods are often used when simulating physical and mathematical systems. Because of their reliance on repeated computation and random or pseudo-random numbers, Monte Carlo methods are most suited for calculation by a computer.

Following steps are done:

A) For 1 lot do the following calculation

1) First we calculate the probability distribution for the outcome of a single trade
2) Then we simulate 10,000 samples, each one with 1,000 trades, based on the previously determined probability distribution for the outcome of a single trade
3) Calculate the probability distribution that a Max Drawdown occurs
4) Calculate the cumulative distribution function and determine the 3s point
5) We get the maximum drawdown value for trading 1 lot

=> now we need to adjust the lot size so that we get the maximum desired drawdown

B) As the maximum drawdown is proportional to the lot size, we can use the following trick. We calculate the needed factor for multiplying the max drawdown axis in order that the 3 sigma point falls as desired. With the same factor we multiply the 1 lot size and obtain the desired value.

We could go on and on about the logic behind the software however we are not sure that you are all that interested in such technical aspects.