Topic: wrong entry/exits with LTF


i have a problem with the LTF-feature.
I created a simple strategy.

At M15 the long position is closed correctly below the MA.
But when i switched to M1 (slots are locked at M15), the position is closed too early. There is no price below M15-MA.

I can see that in every M1-bar during the M15-closingBar, the long entry is allowed and at the same time the 'close out long position' is set. So i will get multiple entry/exit points.
What do i wrong?

Re: wrong entry/exits with LTF

Hi Mek325,

Two possible issues...

1) I'm not sure whether it is the indicator issues that you are facing, though it sounds like one, i.e. the price didn't occur (didn't reached Min 15 conditions, yet EA went ahead to open and close).  I seem to encounter similar issues with MA indicators...conditions met but EA didn't open any trades.

2) It is a common challenge when you use 1min time chart, you will face issues such as multiple entries due to "false signal, as a results of having sensitive parameters, side way trending, whereby the curves keeps crossing up and down.

Hence, it takes a lot of skill to learn how to develop profitable 1 min EA.  It's like driving in the fast lane, driver need to be skillful to maneuvor and handle fast traffics, as a results, it is rarely possible to have good profitable EA with just 1 to 3 opening conditions in a 1 min time chart.

Re: wrong entry/exits with LTF

Seems to be tracking actual m15 bar, weird. And this result I'm getting is not realistic either, I thought this was fixed.

Re: wrong entry/exits with LTF

Footon, can you post the actual strategy?


Never mind, I reproduce the result and will search for a solution.

Re: wrong entry/exits with LTF

I think I figured out the source of the problem and it is more complex that looks like.

1. The indicators logical rules rules determine the indicator behaviour according to its underling data. In that case "Bar closes below MA" means that the the indicator rises close signals when M15 bar closes below MA. An indicator is an independent unit. It have for input its parameters and an underlying data set and returns signals. An indicator doesn't receive info for the strategy and for the the other indicators.

In our case we have M15 indicator that gives signals for M1 chart. Think for it as a multi-chart EA. We have one chart on M1 period and another chart on M15 period. We trade on the first chart but we receives signals from the second chart. In such case the second chart will rise a close signal when its bar closes below its MA. The second chart have no access to our main chart. You may find it weird because you see the M15 MA plotted on the main chart, but it is only because FSB is more powerful than the other platforms. Lets take MT for example:

We cannot set other than the original chart's period for the MA. FSB allows you to to do that and it looks strange for you because you approach to it with your expectations from other platforms. So we have two solution here: either to hide (ignore) the LTF lines or to tray to understand how they work.   

1. a) There is an  exception to the above principle. When we use some of the following logical rules, the indicator uses the main strategy time frame:

"The position opens above Moving Average",
"The position opens below Moving Average"

In such a case FSB compares the indicator value (MA in the example) with the entry price of the strategy provided in the "Opening Point of the Position" slot.

2. The problem with the backtest is because of issue with the UPBV settings for that specific case. This case shows how complex are the UPBV rules and how difficult is to make a reliable EA manually.

I think Hannahis requires a manual set of UPBV. Can you Hanna tell us do we need UPBV in that case or not?

Re: wrong entry/exits with LTF

Popov wrote:

The problem with the backtest is because of issue with the UPBV settings for that specific case. This case shows how complex are the UPBV rules and how difficult is to make a reliable EA manually.

I think Hannahis requires a manual set of UPBV. Can you Hanna tell us do we need UPBV in that case or not?

Hi Popov,

1) Do we need "Use Previous Bar Value" (UPBV) in the example "Position opens above/below moving average"?

In my limited personal opinion, I think we don't need UPBV for "position opens above/below ma" because, position opens mean Bar opening, hence to me, it is already a confirmed position that the price is already above/below ma, unlike the case, whereby the price is still fluctuating within bar open and close and the position cannot be confirmed yet cos we still didn't know whether the price "pressure" going move the price in which direction.

2) Do we need "Use Previous Bar Value" (UPBV) for 1 min time frame?
I think, in the case of most users, it is better to have UPBV "enabled" in 1 min time frame cos already with 1 min time frame, some find it hard to manage the multiple entries and can't handle the tons of tick data and information and without the use of PBV, I'm afraid it would be a disaster for some new/inexperience users (for 1 min time frame).

3) Do we need "Use Previous Bar Value" in higher time frame?
I personally don't think so...the time period between Bar opening and Bar closing, for eg in a H4 is already very long...4 hours of wait, it is too long a wait for me and an impossibility to ever achieve high entry/exit accuracy with such limitation, I think to develop a highly profitable EA (not a marginally profitable EA) with UPBV is very tough.

4) Do we need "Use Previous Bar Value"?
I would prefer to have the choice to "disable" it (in certain conditions and enable it in other conditions, eg determine factor entry/exit point H1 indicator, in 1 min time frame), as you know Popov, I have "fought" over this issue so much and so long without any success that I've decided to rest my case in your hand, out of respect for you and Footon. 

But since you are willing to open this issue up again (which I'm very grateful), I would still very much like to request for a "manual" setting, whereby users can have the choice/decision to "enable/disable" the PBV function.  Let us decide, what's best for our trading style, and choose when to use the PBV function, in which opening/closing conditions and when to turn off (disable), a choice you have once given (in the past) in your previous FSB version, but now removed.

I think, this is a win/win situation.  You have done your part to provide as stable and as reliable FSB platform for us but give other "experienced" traders the extra room to utilize every tick data to the highest possible potential where their level of trading skill could enable them to handle it (tick data).  It is not going to be easy, (when PBV is turned off, with greater power, comes with greater responsi(a)bility) but if we know how to use extra conditions carefully to handle tick data, I believe some traders can truly maximize FSB's prowess and let FSB bring their trading results to greater heights and achievements.  I'm game to try...give me this chance to experiment and maximize every tick data to my fullest advantage.  Don't clip my wings.  Let me fly...and in the process, I may fall many times but I know I will ended up even more skillful as a result of learning to maneuver/manipulate the opening conditions to make my trade more precise (the use of FSB's 1 min time frame platform, has provided me the training ground that helped me developed my trading skills to where it is now, I've you to thank for providing such excellent trading platform for me to hone my trading skills).

Re: wrong entry/exits with LTF

Hi Popov,

Have you also taken a look at my all my EA that I've uploaded under "Hannah's Trading Tips"?  I too have trouble with the MA indicators...You asked me where is the problem...all EA didn't open any trades at all, despite opening conditions met.  I can't specify any examples because no trades opened, no examples to show.

Does the issue you found here, also reflect the same problem related to my EA? (in Hannah's trading tips EA).

Re: wrong entry/exits with LTF

Hannah, your understanding for UPBV is not correct. I'll probably write an explanation article about this topic some day.

I figured out the problem, but my current fix is not perfect. I'll think for it one two, days more and will try to fix some other issues by meantime. I'll upload an update on Wednesday.

For now, you can easily check if UPBV is correct by setting Signal shift = 1. If it makes a huge performance change, it means that there is a problem.

Re: wrong entry/exits with LTF

Please find fix here: FSB Pro v 3.5.2 and MQL Code v34

Test it carefully and report eventual issues.

Trade Safe!

Re: wrong entry/exits with LTF

Hi all,
at first, thanks for take a look at this issue and
Hello Mr. Popov,
wow - what a unbeliveable fast fix!
It looks much better, but a little deviation between LTF and non-LTF i´ve found yet. When the backtester uses LTF, the close action  in the shorter timeframes comes 1 bar to late. You can see it in the picture below. If i compare the close price of Bars and price of transaction, the execution only starts in the next M15 bar.

I´ve tried different timeframes - same result.

11 (edited by GD 2016-02-29 20:33:15)

Re: wrong entry/exits with LTF

I think the reason for which all this happen in the corrected version is the behavior of the MA LTF shape itself. Sometimes it can be and more than 1 bar t he difference in M1 (until next LTF Closing Bar).  This behavior is correct and is expected. So a well selected Strategy is important.

Re: wrong entry/exits with LTF

I know that problem. When we use LTF for closing filter, the close is one small bar (strategy time frame) late.

I'll try to explain the problem.

Let's have closing at Bar Closing M5 when the bar closes below MA (M15).

If now is 09:05, can we us the MA (M15) for 09:00? No we cannot, this MA will have a final value at 09:15. If we use it now, it will be like looking in the future and it may produce wrong result. We solve that by using UPBV (Use previous bar value). So we use MA (M15) from 08:45. It has it's final value at 09:00 and it is already fixed and safe.

Lets go to 09:10. Can we close now? We have to use again the MA (M15) from 08:45 as above.

Lets go to 09:14.99  We can safely use now the MA(M15) from 09:00, because it receives it's value just now, but the problem is that FSB uses it's previous bar value because the current LTF period is not passed. This is a discrepancy at the moment. FSB will use the MA (M15) value from 09:00 after 09:15.

Lets see another example, If we have a main time frame M1 and a MA on H1.  FSB will use MA (H1) from 08:00 for the period 09:00 until 10:00. However, as we saw above, the best solution would be to use UPBV from 09:00 - 09:59 and to use the MA (H1) for the closing at 09:59.99 . However, the current model of FSB will use the MA (H1) from ) 09:00 from 10:01. So we actually have one little bar delay.

Up to now, this is the best and safest solution. However, I'll work on fixing it.

That was the reason I mention before that the current solution is not perfect, but it at least cannot produce a false backtest.

I want from you to be careful and to try to examine all possible case and issue. This is the way to make the software better.

- FSB uses UPBV for all LTF indicators (there is exceptions).
- this leads to one small bar delay

The perfect solution:
- Use UPBV for all small bars except the last one. (currently not possible because FSB shifts the LTF signal with one big bar.) FSB should shift the signals with LTF / TF - 1 bars. Or for M1 main time frame and H1 indicator, the shift must be 60 / 1 - 1 = 59 M1 bars.
For M5 and H1, the shift must be 60 / 5 - 1 = 11 M5 bars.

I'm just wondering if you have ever seen a MT EA that applies such safety rules !?

Re: wrong entry/exits with LTF

That's a plausible explanation. As this behaviour is known - everything is fine. With the little delay, i can live.
I was just wondering, why i get different results, when i switched to shorter timeframes. And for sure - there is no comparable EA, which i would be replicated with this. ;)
By the way, i'm very exited about the easy usage of LTF with FSB. In MT it´s not possible in this way, other than you are a coder.
Great work!


Re: wrong entry/exits with LTF

It looks like I'll manage to provide LTF indicators with no delay.

I'll make more tests and will publish an update.

Stay tuned!

Re: wrong entry/exits with LTF

It´s unbelievable how quickly you are generating solutions and give support.
Thanks a lot for the new update. smile