Will MC support LIB

Questions about MultiCharts and user contributed studies.
moneymaker
Posts: 33
Joined: 08 May 2006
Location: Germany

Will MC support LIB

Postby moneymaker » 29 Aug 2007

Hello,

will MC support LIB and if yes is there any release date? LIB is very important to my, also I want to share you some information I copied from a forum. So for me LIB is one of the most important features I need.

****---------******

Let's say we have a very simple scalping strategy on the S&P E-mini that implements a profit target and stoploss.
The strategy will always take profit if it can realise 1 point profit
but will cut its loss immediately when a 3 points loss occurs.
Let's say our strategy is running on 60 min bars and the strategy has just entered a new long position at the open of
the current bar.
If the strategy is running in real time right at this moment, then the trading platform does not have any problem
to accurately execute the profit or stoploss,
because it will receive the price feed in the same sequence as it is happening and is being distributed by the exchange.
Thus, should the market within the next hour first move up 2 points, our strategy will trigger its profit target of 1 point
and will exit the long position.
Should the market withing the next hour first move down 4 points, our strategy will trigger its stoploss of 3 points.
Whether the market first moved up or first moved down determined which exit order was triggered.
Thus, it is vital to know what was the exact intrabar price action within the bar, to be able to
do accurately backtesting of the strategy.
Some trading platforms do not support LIB testing. These platforms then usually use the following assumptions when
evaluating a strategy during backtesting:
If the close of the bar is greater than the open of the bar, it is assumed that the low of the bar was made before the high.
If the close of the bar is less than the open of the bar, it is assumed that the high was made before the low.
Unfortunately these assumptions are not very accurate in real life. Especially if the price action during a bar was
sideways such that the
open and close was relatively close to each other.
To come back to our example:
Let's say the price action for the specifc bar we were looking at was as follow:
Open = 1000
High = 1005
Low = 995
Close = 999.75
A trading platform that does not support LIB testing will evaluate our strategy as follow:
While the Close<Open it will assume that the High was made before the Low.
In our example it would result in the 1 point profittarget being triggered first.
However, if in real life the low was made before the high (which on a bar with sideways price action
as this one, is just as likely), then the stop loss would have been triggered first.
A BIG difference in the outcome!
The only way that one can solve this problem and accurately determine the direction of movement within a bar that happened in the past,
is to evaluate the strategy on an intrabar basis e.g. 1 minute bar interval.

Now let's look at an example within TS itself to show the significance of the above:

For illustrative purposes we will use a very simple strategy. We will not specify any slippage or commission
because we only want to look at the effect of applying / not applying LIB testing during optimization.

The following example will take no more than 5 minutes, so you can easily replicate it on your own computer.

I created a very simple strategy with the follwing 5 lines of code:


Inputs: ProfTargetDollar(100), StoplossDollar(200);

If Average(Close,5)>Average(Close,15) then Buy next bar at market;
If Average(Close,5)<Average(Close,15) then Sell Short next bar at market;

SetProfitTarget(ProfTargetDollar);
SetStopLoss(StopLossDollar);


Next I opened a new chart for the @ER2.D using 45 min bars and loaded the last 3 years of data.
I optimized the strategy above (without LIB resolution) using the following ranges:
ProfTargetDollar: 50...250 inc 50
StopLossDollar: 50..250 inc 50
and got the following result:
The most profitable solution was ProfTargetDollar=150 StopLossDollar=200
with a net profit of $40450.
Next I switched on LIB testing with a back testing resolution of 1 min and guess what happened?
The net profit changed to $32230!
The net profit dropped with more than 20% when we applied LIB testing.
Why the difference?
The $40450 was never an accurate figure in the first place. The profit calculated without LIB testing was overstated
because the platform used assumptions (explained above) to determine the direction of movement within bars and
as a result evaluated the strategy incorrectly during backtesting.

Any trading platform that does not support LIB testing will be prone to these errors.
While TS8.x does support LIB testing, TS2000i does not support LIB and thus TS2000i users
should exercise extreme caution in this regard.



Yesterday we tested a very simple strategy that only uses a profit target and stoploss exit.
We proved to ourselves that without LIB, the P&L was overstated with 20% during backtesting.

Today, we are going to increase the complexity of our strategy slightly by adding a trailing stop.
We would like to test if using more different exits would increase the chances of inaccuracies when not using LIB testing.

For my test I took exactly the same code as yesterday and only added a trailing stop.
We are not going to optimize ProfitTargetDollar or StoplossDollar and will use the values
we used yesterday in our comparisons.

{-----------------------------------------------------------}
Inputs: ProfTargetDollar(150), StoplossDollar(200);
Inputs: TrailingDollar(200);

If Average(Close,5)>Average(Close,15) then Buy next bar at market;
If Average(Close,5)<Average(Close,15) then Sell Short next bar at market;

SetProfitTarget(ProfTargetDollar);
SetStopLoss(StopLossDollar);
SetDollarTrailing(TrailingDollar);
{-----------------------------------------------------------}

I again used the @ER2.D 45 min chart and without LIB,
optimized TrailingDollar 50..500 inc 10

TrailingDollar=50 was identified as the most profitable solution giving
a Net Profit of $137 720. WOW, this looks good!!
Much better than yesterday!
But could this be true??

Next I switched on LIB testing with a back testing resolution of 1 min
and recalculated the strategy.
The net profit turned into a LOSS of ($5170) !!

It seems that the trailing stop is even more prone to inaccurate backtesting if the platform uses assumptions to guess the direction of movement within a bar.

The above was still a relatively simple strategy.
The bottom line is that the more different entry/exit signals you have in your strategy,
the greater the chances of overstatement of profits during optimization,
if you are not using Look Inside Bar testing.

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 30 Aug 2007

Hello,

Yes LIB will be supported in future. As for when it is going to be implemented, I can't give any (even rough) estimates at the moment.


Return to “MultiCharts”