MA Filter max distance

Avatar
  • updated
  • Completed

In MA Filter, we only have a condition for the minimum distance between the price and MA.

I propose to make a condition for the maximum price distance to the MA. Such a filter will allow you to refine the entry point for some trend strategies. Or more accurately identify important levels (proximity to MA) 

To illustrate (abstract strategy): 

buying above MA200 

stochastic inside the lower zone 

maximum distance to MA - X 

red arrow - filtered entrance by maximum distance condition
green - triggered entrance

Example 1:

Image 4525

Example 2:

Image 4526

How would you rate the customer service you received?

Satisfaction mark by Kirill El 9 months ago

Add a comment about quality of support you received (optional):

Avatar
0
Sai Pratap

Can u please clarify what exactly are u referring to?

I could not find any option as minimum distance in the MA filter.

Image 4527

Avatar
0
Andrey Khatimlianskyi

Try to use negative distance with Reverse mode

Avatar
0
Sai Pratap
Quote from Andrey Khatimlianskyi

Try to use negative distance with Reverse mode

That's exactly has come up to my mind. But I could not find the option at all.

Avatar
1
ferdinand tampubolon

there is no option buy above MA.. 

Avatar
0
Kirill El
Quote from Andrey Khatimlianskyi

Try to use negative distance with Reverse mode

It seems "negative distance" is not suitable for this task. Or I configured something incorrectly.

I am attaching a file with simple settings that I use.

max MA distance test.set

According to it, buy are made above MA 200 + stochastic inside the lower zone / sell under MA 200 + stochastic inside the high zone. But it was not possible to set a condition for the maximum distance to MA (BUYs are allowed if "Ask - MA <= distance" / SELLs are allowed if "MA - Bid <= distance")

On my screen, the period is 2022.06.27-2022.07.07

green zone - where buy entries should be

red zone - where the sell entries should be

But as you can see, entries occur outside these zones, even with a negative value of the distance

Image 4552

Avatar
0
Andrey Khatimlianskyi
  • Under review
Quote from Kirill El

It seems "negative distance" is not suitable for this task. Or I configured something incorrectly.

I am attaching a file with simple settings that I use.

max MA distance test.set

According to it, buy are made above MA 200 + stochastic inside the lower zone / sell under MA 200 + stochastic inside the high zone. But it was not possible to set a condition for the maximum distance to MA (BUYs are allowed if "Ask - MA <= distance" / SELLs are allowed if "MA - Bid <= distance")

On my screen, the period is 2022.06.27-2022.07.07

green zone - where buy entries should be

red zone - where the sell entries should be

But as you can see, entries occur outside these zones, even with a negative value of the distance

Image 4552

Thanks for the detailed report!

For your case Reverse = false and negative Distance will work.


It will also allow buys below the MA / sells above the MA, but for this strategy it seems ok.

If it is not exactly what you want, let me know. We can add 'Max distance' as  well

Avatar
0
Kirill El
Quote from Andrey Khatimlianskyi

Thanks for the detailed report!

For your case Reverse = false and negative Distance will work.


It will also allow buys below the MA / sells above the MA, but for this strategy it seems ok.

If it is not exactly what you want, let me know. We can add 'Max distance' as  well

Andrey, thanks. It turned out what I wanted.

It was necessary to separate the conditions by two MA filters:


MA filter #1
Type = Buy below MA / sell above MA
Reverse mode = false
distance = negative distance

MA filter #2
Type = Buy below MA / sell above MA
Reverse mode = true

Image 4554

But, in order to achieve this effect, 2 MA filters were used. In this regard, is it possible to expand to 4 MA filters?
Or is it easier to make the maximum distance parameter?

Avatar
0
Andrey Khatimlianskyi
Quote from Kirill El

Andrey, thanks. It turned out what I wanted.

It was necessary to separate the conditions by two MA filters:


MA filter #1
Type = Buy below MA / sell above MA
Reverse mode = false
distance = negative distance

MA filter #2
Type = Buy below MA / sell above MA
Reverse mode = true

Image 4554

But, in order to achieve this effect, 2 MA filters were used. In this regard, is it possible to expand to 4 MA filters?
Or is it easier to make the maximum distance parameter?

Good trick! )

Of course, it's easier to add a new parameter. I'll try to add it in the near future.

Avatar
0
Ulises Cune

Today this code was published. I think it's the same as "Eliseev Kirill" is needing. Maybe it will be useful to both

https://www.mql5.com/en/code/45552

Avatar
0
Andrey Khatimlianskyi
Quote from Ulises Cune

Today this code was published. I think it's the same as "Eliseev Kirill" is needing. Maybe it will be useful to both

https://www.mql5.com/en/code/45552

I don't think so, it is just a MA cross signal with predefined distance.