Need Help Developing an EA

 
Hello folks. I think I've finally learned a subtle nuance of moving averages that I was missing before.

This is probably not new to anyone but I want to share in case anyone else has the same misconception I did before today.

For a very long time I used to assume that if a fast moving average crosses a slow moving average then that is either a buy or sell indicator depending on whether the fast was above or below the slow.

Now I realize that such indicators do not occur when the lines cross, but rather when they begin to agree or begin to disagree.

If a fast and slow moving average disagree then this is an indication of a short term trend (which often carries a profit opportunity).

But when a fast and slow moving average agree then this is an indication of a long term trend (which always carries a profit opportunity).

In a theory that I recently developed, I'm using 5-bar Bollinger bands (marked to weighted close (HLCC/4) with a deviation of 2) coupled with a 20-bar moving average (marked to weighted close (HLCC/4).

I'm wondering if anyone has or could help me develop an EA that does the following:


Use these indicators:

-5 bar Bollinger Bands marked to weighted close (HLCC/4) with deviation of 2

-20 bar moving average marked to weighted close (HLCC/4)


[When I say "Fast" I am referring to the moving average portion of the aforementioned Bollinger Bands]

[When I say "Slow" I am referring to the 20 bar moving average]


When Fast is up and Slow is down, go long until ask price => upper bollinger band

When Fast is down and Slow is up, go short until bid price <= lower bollinger band

When Fast is up and Slow is up, go long until bid price => upper bollinger band

When Fast is down and Slow is down, go short until ask price <= lower bollinger band

-NOW-

If conditions change (ie fast and slow were up before, but now fast is down) then liquidate all positions and re-apply all of the above logic.


Also - I want the EA to enter the ideal position for EACH BAR that opens under the same conditions as the last.

(ie: last trade was long while fast and slow were up, next bar opens and both fast and slow are still up so we go long once again)


The size of the lot should be 0.1, the account is worth $3,000 and we're using H1 charts on Gold:Currency pairs.


If it works, I will make it publicly available for anyone to download. This Strategy has worked very very well with simple projections but I want to know if it will work longer term.

I will be attempting to code this myself but I foresee I will make many mistakes as I am not well versed in MQL4 and suffer greatly from "BASICitis". Any help would be greatly appreciated.
 

When Fast is up and Slow is down, go long until ask price => upper bollinger band

When Fast is up and Slow is up, go long until bid price => upper bollinger band

When Fast is down and Slow is up, go short until bid price <= lower bollinger band

When Fast is down and Slow is down, go short until ask price <= lower bollinger band

What is the reason for using slow and if there is a reason What kind of MA method has the moving average

 
trivates:
I'm wondering if anyone has or could help me develop an EA that does the following:
Also - I want ...
I will be attempting to code this myself
No Slaves here, learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.
 
trivates:

If a fast and slow moving average disagree then this is an indication of a short term trend (which often carries a profit opportunity).

But when a fast and slow moving average agree then this is an indication of a long term trend (which always carries a profit opportunity).

What bullocks can this be!

Assuming when you say fast ma and slow ma "disagree", to mean = they cross each other, and

when they "agree" means they are moving alongside = they dont cross each other.

So, in all cases, you still take their crosses, or otherwise, as SIGNALS!

 
deVries:

When Fast is up and Slow is down, go long until ask price => upper bollinger band

When Fast is up and Slow is up, go long until bid price => upper bollinger band

When Fast is down and Slow is up, go short until bid price <= lower bollinger band

When Fast is down and Slow is down, go short until ask price <= lower bollinger band

What is the reason for using slow and if there is a reason What kind of MA method has the moving average


I suppose I should explain myself better. By "up" I mean that the slope is positive and by "down" I mean that the slope is negative, regardless of which one is above or below the other....

As for the use of the slow moving average, this tells me whether or not the market is "crazy". If the fast moving average and the slow moving average "disagree" (ie: fast has a negative slope and slow has positive) then that means it could be a short term correction and if I can take my profit early, then I want to do so. As such, I look for the bid price to hit the lower band. This, instead of the ask price as the case would be if both fast and slow had negative slopes. If both have negative slopes, then it's more likely that the ask price will hit the lower band.)

So when slopes oppose each other, I "play it safe" and when they are agree with each other (both are negative or positive) then I "get aggressive".

Does that help?

 
WHRoeder:
No Slaves here, learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.

If I fail in my attempt to code this myself I will be sure to contact you directly before I ask for help from anyone else. You're obviously the best.
 
trivates:


I suppose I should explain myself better. By "up" I mean that the slope is positive and by "down" I mean that the slope is negative, regardless of which one is above or below the other....

As for the use of the slow moving average, this tells me whether or not the market is "crazy". If the fast moving average and the slow moving average "disagree" (ie: fast has a negative slope and slow has positive) then that means it could be a short term correction and if I can take my profit early, then I want to do so. As such, I look for the bid price to hit the lower band. This, instead of the ask price as the case would be if both fast and slow had negative slopes. If both have negative slopes, then it's more likely that the ask price will hit the lower band.)

So when slopes oppose each other, I "play it safe" and when they are agree with each other (both are negative or positive) then I "get aggressive".

Does that help?

If gradients of prices (or in this case MAs) are the consideration, you shouldnt even be looking at MAs or Bands.

Try regression techniques instead. They give a more accurate and smoother curves for gradient measures and price slopes.

 
diostar:

What bullocks can this be!

Assuming when you say fast ma and slow ma "disagree", to mean = they cross each other, and

when they "agree" means they are moving alongside = they dont cross each other.

So, in all cases, you still take their crosses, or otherwise, as SIGNALS!



no, you misunderstand.

moving averages have slopes that change from time to time. If at this very moment, each has an opposing slope angle (one negative and one positive, ie: one is falling and the other is rising) then they DISAGREE.

If, however, both moving averages have positive (or both have negative) slopes then they AGREE.

When the status quo changes between both moving averages, then something might be happening requiring the trader's attention. When the prices move outside the deviation of the bollinger bands, that can be a take-profit indicator. This is simply an elaboration on a similar strategy I brought to this board back in March this year but sometimes the price went absolutely bonkers and ignored the "rules" causing catastrophic losses.

I believe I have found a way to curb that and make windfalls. It's extremely aggressive: Buy (or sell as may be appropriate) on every new bar open as long as certain conditions exist... and liquidate when the best opportunity arises. And if it turns out that WASN'T the best opportunity, jump back on the wave and ride it some more.

I won't say it can't fail but I have yet to see a two-day period wherein the gains do not outweigh the losses by 1000+ percentiles. So yes, you can take losses doing this, but my observations indicate they would be minimal. I just want to be deadly certain.

 
WHRoeder:
No Slaves here, learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.

Are you going to be on between Monday 1800 and Tuesday 0200 GMT? That is when I plan to take my first crack at this and would appreciate any guidance you could provide.
Reason: