Help: How to write simple EA to buy and sell at a specific time? - page 4

 
Bongo:
We developed 4 years ago a robot based on correlation (see picture).

Refco is not existing but correlation is still working well.

We are using few correlator on different pairs.

Bongo, what platform is that - you apparently are able to backtest multiple currency pairs simultaneously?

 
lcfxtrader:
In deed we have talked about it through PM and have seen positive results of this system. It's up to him if he wants to do it. We are still working on our other project at this time so this will probably be placed on the back burner for a while unless another coded can program it. Do you know of a grid EA that has these inputs already?

Oh, Ok then If only there was a way to backtest strategies like this with MT, maybe then we would see some progress - the forward-test alternative is a real hinderance...

 
lcfxtrader:
In deed we have talked about it through PM and have seen positive results of this system. It's up to him if he wants to do it. We are still working on our other project at this time so this will probably be placed on the back burner for a while unless another coded can program it. Do you know of a grid EA that has these inputs already?

I will try to code a system like this when I get the time. I needed to first understand the entire system layout. It is interesting, however I'm not convinced we have a winner here yet, due to the fact that I have tried to code a similar system before. (with not so good results)

Omelette was right about a few things:

I have been very busy with our other on-going project, along with a full time day job.

Also, these systems are VERY SLOW to test, due to the fact that MT4 can not run multiple pairs in the back tester. We all know the back tester is unreliable for results, but it is a very valuable tool for making sure your code is executing properly. A system like this, ONLY forward testing can be used, even if just to make sure your code is written properly. Makes for pretty slow progress.

 
I will try to code a system like this when I get the time. I needed to first understand the entire system layout. It is interesting, however I'm not convinced we have a winner here yet, due to the fact that I have tried to code a similar system before. (with not so good results)

The thread starter seems like he has had good success, however, he use discretion for his entries. I appreciate any work you can do on this if you have some free time in the future. Do you have a grid EA already written that you can share? I can't seem to find a simple one that uses a start time with TP, SL, & Spacing that can be used on multiple pairs. Thanks again, Lcfx

 
lcfxtrader:
The purpose of this thread is to create and test a Correlated Grid EA as a group and report the results.

EA requirements:

Start time in GMT

Currency pairs to be traded: drop down to choose pairs (Ex: EUR/USD & USD/CHF)

1st pair trade position: Long or Short

2nd pair trade position: Long or Short

1st pair lot size

2nd pair lot size

1st pair max # of positions

2nd pair max # of positions

1st pair spacing in pips

2nd pair spacing in pips

1st pair take profit in pips

2nd pair take profit in pips

1st pair stop loss in pips

2nd pair stop loss in pips

Notes: A spacing interval would be replaced after its designated TP is reached.

Please post suggestions for improvements.

A few questions needed answered before an attempt in coding:

I am assuming each pair is operating INDEPENDENTLY from one another.

Let's look at 1 pair at a time-

If 1st pair spacing in pips is hit, does it enter another trade trade even if the first trade has not been closed yet? Do we have multiple orders of the same pair open at once? If this is true, do we close all orders of the same pair based on the combinedtotal pip value, OR does each individual order close based on their own TP or SL? Gotta know this!

Plus, it would be MUCH easier to code if pair 1 is always long, and pair 2 is always short.

 
A few questions needed answered before an attempt in coding:

I am assuming each pair is operating INDEPENDENTLY from one another

Let's look at 1 pair at a time-

If 1st pair spacing in pips is hit, does it enter another trade trade even if the first trade has not been closed yet? Do we have multiple orders of the same pair open at once? If this is true, do we close all orders of the same pair based on the combined total pip value, OR does each individual order close based on their own TP or SL? Gotta know this!

Plus, it would be MUCH easier to code if pair 1 is always long, and pair 2 is always short.

Wolfe,

It can work independently or be based solely on the EUR/USD. If the trades are based off the EUR/USD at X spacing, then every time the EUR/USD trade is taken it would simultaneously trigger the USD/CHF (this pair is only traded based off the EUR/USD). Once the TP is reached for the EUR/USD, the level that the trade was taken will be replaced. The TP for the USD/CHF has its own input as does the EUR/USD. A SL could be based on each trade for each pair, global for the account, or not use one at all (I don't recall seeing this on the other forum). I like the idea off having one based on all positions. Any thoughts on this?

If you want to code it independently, then basically would need the requirements on the 1st page along with anything else I may have missed. Can we have the EA close shop after a certain number of pips both in the closed and open positions have been reached?

I hope this answered your questions. Let me know if something isn't clear. Also, according to thread both pairs need to be traded the same direction (either all long or all short). Thanks, Lcfx

 
lcfxtrader:
Wolfe,

It can work independently or be based solely on the EUR/USD. If the trades are based off the EUR/USD at X spacing, then every time the EUR/USD trade is taken it would simultaneously trigger the USD/CHF (this pair is only traded based off the EUR/USD). Once the TP is reached for the EUR/USD, the level that the trade was taken will be replaced. The TP for the USD/CHF has its own input as does the EUR/USD. A SL could be based on each trade for each pair, global for the account, or not use one at all (I don't recall seeing this on the other forum). I like the idea off having one based on all positions. Any thoughts on this?

If you want to code it independently, then basically would need the requirements on the 1st page along with anything else I may have missed. Can we have the EA close shop after a certain number of pips both in the closed and open positions have been reached?

I hope this answered your questions. Let me know if something isn't clear. Also, according to thread both pairs need to be traded the same direction (either all long or all short). Thanks, Lcfx

I have a feeling that slippage, re-quotes, and basic broker screwing you practices may make this system difficult. Every time you close EURUSD, you can not be assured you will fill another order at the same price. By the time you fill your order, many times your USDCHF will be worth even less. Am I missing something here?

 
I have a feeling that slippage, re-quotes, and basic broker screwing you practices may make this system difficult. Every time you close EURUSD, you can not be assured you will fill another order at the same price. By the time you fill your order, many times your USDCHF will be worth even less. Am I missing something here?

You are most likely correct. I wonder if the system user experienced these problems? Thanks for all your help on TFX.

 
omelette:
Bongo, what platform is that - you apparently are able to backtest multiple currency pairs simultaneously?

omellette,

This is forward test.

You can not back test multiple pairs, for this moment.

Maybe MT4 will allow you to do in the future.

Print screen is from former Refco (FXCM) trading platform.

Bongo

 

Bongo,

Do you have a grid EA for MT4 that we can test?

Lcfx

Reason: