Topic: Linear Regression MA cross MA Envelope

Hi,

I am hoping that I am not overlooking another way to accomplish this but it seems as though to complete my strategy it will require a new indicator made.

I would like an indicator that generates a signal when a linear regression moving average interacts with an envelopes upper or lower bands.

It would be beneficial to be able to adjust the following
Moving Average Envelope: (very similar to existing envelope indicator with added individual band deviations)
MA Smoothing Method
Base Price
MA Period
Upper Band Deviation %
Lower Band Deviation %

Linear Regression Moving Average: (very similar to Moving Average indicator but utilizing least square values)
MA Smoothing Method
Base Price
MA Period
Shift

Trigger Points:
LRMA crosses the upper envelope from the outside to the inside
LRMA crosses the upper envelope from the inside to the outside
LRMA crosses the lower envelope from the outside to the inside
LRMA crosses the lower envelope from the inside to the outside

Thank you in advance for you help please advise if any further information is required.

Lee

Re: Linear Regression MA cross MA Envelope

Hey Lee,

Do you have the LRMA already available for FSB? There are a few linear regression using indis in the repo, but I don't know whether those are suitable for your cause or not. If you have specific LRMA in mind (maybe a MT indi, for example), you should provide the source code for it. Then it can be ported to FSB, and then the real work can begin. Mqh version is necessary also?

OK, now the basic questions are covered, all other info is already wonderfully there in the post above. Let us know then, and I'll quote you a price.

Thanks!

Re: Linear Regression MA cross MA Envelope

Thanks for the reply Footon,

There is a couple of items I can provide/suggest that are similar in function:

The LSMA_Channel v2 indicator without the deviation would have the correct equation for determining the LSMA indicator, if this was used would it be possible to add smoothing method selection?

At the moment I use a LRMA indicator found on the MQL5 website, but once again it does not have the smoothing method option. I can either attach it or link to it as long as that is not breaking any rules?

I have very limited knowledge of creating an indicator but I was thinking possibly you could use the existing MA indicator and effectively add the Least Square calculation before the smoothing?

Thanks,
Lee

Re: Linear Regression MA cross MA Envelope

Go ahead and attach the MQL5. no problem with doing that.

My 'secret' goal is to push EA Studio until I can net 3000 pips per day....

Great, attached.

Re: Linear Regression MA cross MA Envelope

I planned to have a quick update, but I'm fighting with some FSB issues at the moment. I'll contact you as soon as they are fixed.

Re: Linear Regression MA cross MA Envelope

Ok sounds good, thanks.

Re: Linear Regression MA cross MA Envelope

I've got everything working, lets get back to business.

I've 2 versions of LRMA below, just for visual testing purposes! As you will see, if same parameters are selected they have slight differences. I want you to take a pick between the 2 I uploaded and your mq5 version, the chosen one will be in your indicator.

Regarding smoothing - LR doesn't use smoothing in its calculation, what I can do is to introduce smoothing to the output, meaning the line you see on the chart gets averaged (simple, exponential, smoothed or weighted method) with another user-selectable period. Again, it's your call if we use it or not. If simple method with period 1 is used, it effectively produces non-smoothed output, so it's the best of both worlds.

Another possibility would be to smooth the base data.

To recap the questions:
1. Which LRMA to use?
2. Smooth output?
3. Smooth input?

Re: Linear Regression MA cross MA Envelope

From what I can see/measure, the indicator you attached 'Linear Regression Line' produces the same results I have been working with to date and will be suitable (and less work for you I am assuming).

For the smoothing, could you please smooth the output, I like the way you have suggested to obtain best of both worlds.

Please advise anything else you require from me.

Re: Linear Regression MA cross MA Envelope

Great! That will be \$5 for .cs and .mqh file. If the quote is ok I'll try to finish this within the next 8 hours or so, then I'll email the indi to you (to registration address you have in this forum), if everything works and you're happy, the payment can take place.

Talk to you soon!

Re: Linear Regression MA cross MA Envelope

Yeah, that is perfect, sorry for the late reply I am in Australia and it was night time here.

Thanks.

Re: Linear Regression MA cross MA Envelope

No problems, I sent you the indi 9h ago, did you get it?

Re: Linear Regression MA cross MA Envelope

I did thank you, it has been a crazy day at work I am just testing now.

Re: Linear Regression MA cross MA Envelope

slim_watson wrote:

I did thank you, it has been a crazy day at work I am just testing now.

No problems, take your time, I did send it in early morning hours so anything can happen during that time, I'm glad everything worked. Again, test thoroughly!

Re: Linear Regression MA cross MA Envelope

Hi Footoon,

Not sure if you want notes on here or email but here we go

Opposing pairs for Long and Short Signals
It seems the core (long) signals functions correctly, but when automatically reversed for a short signal it does not chose the desired prerequisite. I should really have clarified this earlier, sorry.

Eg.
If chosen, 'LRMA crosses the upper envelop from the outside to the inside' will long a signal as desired.

The automatic short for this then seems to be 'LRMA crosses the upper envelope from the inside to the outside' where as the desired option would be 'LRMA crosses the lower envelope from the outside to the inside'

Pairs required are: (switching upper and lower bands rather then inside/outside direction)
Long (Short) - LRMA crosses the upper envelop from the outside to the inside
Short (Long) - LRMA crosses the lower envelope from the outside to the inside

Long (Short) - LRMA crosses the upper envelop from the inside to the outside
Short (Long) - LRMA crosses the lower envelope from the inside to the outside

Indicator function
It seems the option 'LRMA crosses the lower envelope from the inside to the outside' is performing the function that should be on 'LRMA crosses the lower envelope from the outside to the inside' and vice versa.

Other
I had once case of my computer freezing while testing, may have been unrelated I did have a number of items open (in the background).
The order of the inputs was a little confusing also, maybe 'output smoothing method' could be moved to between 'output MA period' and 'shift'.

Apart from those minor items it all seems to work fine!

Re: Linear Regression MA cross MA Envelope

Did you reply to my email? If so, I haven't received it for some reason. I'll paste the answer here too, just in case.

I fixed the logic! If indicator function was off it should be fixed as well. If freezing happens again, try to establish what other indis were at play and how many bars are in use, especially great would be to know indicator settings.

Then the inputs order - I'm afraid you have to live with that. FSB parameter sequence is set in stone, so to speak, I can't move ListParameter to NumParameter slot, text and number slots are clearly separated.

Take the indi for a test drive then, waiting for your feedback later!

Re: Linear Regression MA cross MA Envelope

I have replied to your email (about 11 hours ago) if you haven't noticed, maybe its in your junk mail?

It is all spot on, everything is working as it should, how do we proceed from here?

Lee