Topic: Swap rates - strange things happen

Hello!

I need your help to figure out what's happening. Backtest was made for SP500.

Figure 1: swap rate long = 1,00
Figure 2: swap rate long = 1,01 (check next post for figure 2)

Now look at the graphs! Even with interpolation = optimistic, check out the difference! How can one justify this? I'm a bit concerned in fact, I think this doesn't really make any sense...

Cheers
Nuno

Post's attachments

1.JPG
1.JPG 62.73 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

2 (edited by nquental 2014-03-09 14:12:45)

Re: Swap rates - strange things happen

Figure 2 here

Post's attachments

2.JPG
2.JPG 60.6 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Swap rates - strange things happen

I clearly see what you mean

We will have to see if Popov will have a chance to examine it..

Interesting that on the same data, ambiguous bars have a different count.

I can understand your frustration...... for sure.

Re: Swap rates - strange things happen

Thanks a lot, any help is indeed needed!
The strategy is working fine in fact, so I think that the nice graphic is the right one. I have shared the strategy before.

Re: Swap rates - strange things happen

Dear Popov
I know you're probably very busy with Pro, but when you have a few minutes to check this smile)
Maybe, if there's a problem, it will also affect the pro version.
Thanks!

Re: Swap rates - strange things happen

I will be interested to see how this is resolved, I am glad you brought it up.

I am sure he will have a look at it very soon as it will affect Pro and the original.

Re: Swap rates - strange things happen

This is very strange. So you change only a fraction of the long swap and chart changes dramatically?
Can you post this strategy, configs.xml and instruments.xml (put them in a folder and zip).

I tried it now, but for me the chart changes with 1-2$ on changing the long swap from 1.00 to 1.01.

8 (edited by Popov 2014-03-29 07:06:00)

Re: Swap rates - strange things happen

Popov wrote:

This is very strange. So you change only a fraction of the long swap and chart changes dramatically?
Can you post this strategy, configs.xml and instruments.xml (put them in a folder and zip).

I tried it now, but for me the chart changes with 1-2$ on changing the long swap from 1.00 to 1.01.


Might be due to the data?
I attach the files, thanks.

Re: Swap rates - strange things happen

Dear Popov
Did you have the time to check this?
Thanks again
N.

Re: Swap rates - strange things happen

Hello Nuno,

I have two news:
- the bad one - this is really strange
- the good one - the result is exactly same in FSB and in FSB Pro

I'll check what happens and will respond today.

Thank you for the report!

Re: Swap rates - strange things happen

I spent all day today to find the error. Finally it was found in Break Even algorithm. The problem appears in some specific cases.

I'll update FSB Pro today and FSB Free next week.

Re: Swap rates - strange things happen

The bug is fixed in Forex Strategy Builder v3.1

13 (edited by nquental 2014-03-31 20:01:55)

Re: Swap rates - strange things happen

Excellent, thanks.
I've downloaded and now, with the BE set at 25, I have lots of ambiguous bars (before, in some circumstances, I had only a few ambiguous bars and a very good strategy). Even with BE = 100 I get 34 ambiguous bars. So it seems that something is still not correct. I have 1 minute data.

By the way, until when can we buy the PRO version with 50% discount?

Re: Swap rates - strange things happen

By the way, until when can we buy the PRO version with 50% discount?

I plan to publish FSB Pro Release Candidate on 24th of May.
The RC version will be distributed with a discount of 25%.

...

In Bulgaria 24 May is known as the "Bulgarian Education and Culture, and Slavonic Literature Day" and  it's a national holiday. It's also known as Saints Cyril and Methodius Day.

Re: Swap rates - strange things happen

Interesting! I heard about it but I didn't know much.

What about the rest of my paragraph: I've downloaded and now, with the BE set at 25, I have lots of ambiguous bars (before, in some circumstances, I had only a few ambiguous bars and a very good strategy). Even with BE = 100 I get 34 ambiguous bars. So it seems that something is still not correct. I have 1 minute data.

Perhaps there's still something wrong, I don't think such a large amount of ambiguous bars is normal, and that's why an excellent strategy seems bad.

Re: Swap rates - strange things happen

Break Even of 100 points is not too much. It most probably fits in the bar range even for 1 min bars. That's why the backtest shows ambiguous bars.
- Use the Explorer to check the interpolation (I suggest you using FSB Pro)
- Use the Comparator to see the average performance for all interpolation methods.

Re: Swap rates - strange things happen

Not at all, 100 points means 10 USD, about 0,5% of the price of SP500. SP500 does not change 0,5% every minute, not even close to that.

Still, with my strategy, I cannot understand why so many ambiguous bars because a bar is ambiguous if one does not know the right trajectory of a bar and if this trajectory has an impact on closing the position.

I'm pretty sure there's something wrong, but I'll check in PRO.

Re: Swap rates - strange things happen

Dear Popov

I confirm that FSB and FSB Pro show the same results. I cannot understand the reason why a BE of 100 (equals 10 USD, or 0,5% of the price of SP500) can justify more than 80 ambiguous bars. Before, in FSB (under certain conditions), there were no ambiguous bars.

So I am sure something is wrong with the BE. Something is wrong there, there is no reason why the BE can create so many ambiguous bars (also because the TP and the SL are far away!). Given that the BE is very important, I believe this correction is very important for the program (which by the way I will buy soon).

Best wishes
Nuno

Re: Swap rates - strange things happen

Nuno,
the backtester is too mistrustful some times and always tries to find the most pessimistic scenario.
The purpose of this behaviour is to prevent the user of making logical errors.

Please post a screenshot of an ambiguous bar interpolation and I'll try to figure out what happens.

A picture like this may help:
http://s9.postimg.org/eyyveyyfv/screenshot_221.jpg

Re: Swap rates - strange things happen

Dear Popov

I attach a screen-shot. It could be in fact that the new backtest is the right one, and the strategy is not as good as I thought. However, I think it would be important to understand two things, if you can help:
- why so many ambiguous bars (I really see no reason for them)
- what was the problem you found with the BE? This could explain the problem.

In the beginning I had none ambiguous bars and a very good strategy. Then I found that results changed dramatically when one changed slightly the swap rate. Then, when you fixed the program, the number of ambiguous bars increased and the strategy became crap...

So I'm really curious to understand what can explain this. Can you post a description of the problem you found with the BE and how it works now?

Thanks again
Nuno

Post's attachments

Capture.JPG 173.8 kb, 1 downloads since 2014-04-13 

You don't have the permssions to download the attachments of this post.

Re: Swap rates - strange things happen

Nuno, the new result is correct. The old version DOESN'T place Break Even at all. The mistake was due to specific interpretation of the comparison of floating numbers in the computer languages.

For example, a normal person know that two numbers are equal when A = B. It works in the computer for integer numbers, but it is wrong for float or double numbers.
Computer cannot represent such numbers exactly. Lats say 19.25 can be represented as 19.25000001
So A=B doesn't work. It must be ABS(A - B) < Sigma, where sigma is a small number like 0.00001

My change sin the code was:

Old code:

if (posDir == PosDirection.Long && price >= posPrice + targetBreakEven

New Code:

if (posDir == PosDirection.Long && price >= posPrice + targetBreakEven - micron

Where micron = Point/2;

...

Your real question must be "Why Pessimistic method shows low strategy performance?".

It's because it check if break even can be activated and closes the position on zero.  Backtester prefers to close on zero, because it doesn't look forward and doesn't know what will happen with the position. It may go on profit or it also may close on BE later. Since it's a Pessimistic method, it closes the position on BE. It may look bad, but it actually protects you from false expectations.

You can always go to the Comparator to see a more realistic performance of a strategy with ambiguous bars. I thing that the comparator is one of the best tools in FSB Pro and even in the Forex analyzing tools worldwide.  Other even do not show you ambiguous bars!! Probably they don't have!?!

Re: Swap rates - strange things happen

I still find it strange. Now you're in practice removing half a point in order to determine when to enact the break even. This shouldn't make a big difference and cannot explain the huge change in the strategy. Are you sure there were no other modifications?

You say that before "The old version DOESN'T place Break Even at all". It did place something because when I turned on or off the BE there was a huge modification in the balance line of the strategy. So something was happening. And now, when I remove the BE, I cannot replicate what I had. How can you explain excellent results before and terrible results now? I really don't understand this mystery!

Re: Swap rates - strange things happen

About your screenshot:

http://s7.postimg.org/e1i97054r/screenshot_296.png


- Backtester starts from Open (way point 1)
Later it has two choices:
   1. To go down to Low and upwards to WP 5.
   2. To activate BE trigger WP 2 and to BE stop at WP 3.
That's the reason this bar is ambiguous.

Since this is the Random method, Backtester randomly went to WP 2 first.

If it was Pessimistic, Backtester would make the same, since this interpolation closes the position at Zero.
Other interpolation would close the position at WP 5 at profit.

If it was Optimistic method, it would chose the 2nd interpolation route since it goes to profit.

Re: Swap rates - strange things happen

Are you sure there were no other modifications?

I added +- micron and also extracted some variables for cleaner code.

The old code was:

price >= session[bar].Summary.PosPrice + targetBreakEven

The new one is:

double posPrice = session[bar].Summary.PosPrice;
...
price >= posPrice + targetBreakEven - micron

See the full change here: https://github.com/PopovMP/Forex-Strate … 4061f5935a

Re: Swap rates - strange things happen

You say that before "The old version DOESN'T place Break Even at all". It did place something because when I turned on or off the BE there was a huge modification in the balance line of the strategy.

You right, "at all" was not the correct wording. The correct is in 90% of the cases. If you still have the old version, you'll see that there is no BE where should exist.