Need help with a good EA for Index. Work very good already, but could be better.

 

Hi,

I coded this EA

and it woks very good (on GER30 Index in backtest, and this is kind of the strategy I use for manual trading) .

But I wish it just checked the conditions once a day, or maybe twice. Thus; that it just buy or sell once or twice a day (lets say 12:00 and 24:00, or two other minutes when the spread is low).

But I can't code that, despite it is probably pretty simple Please help.

Simon

Files:
 
simon_json:
Hi,

I coded this EA

and it woks very good (on GER30 Index in backtest, and this is kind of the strategy I use for manual trading) .

But I wish it just checked the conditions once a day, or maybe twice. Thus; that it just buy or sell once or twice a day (lets say 12:00 and 24:00, or two other minutes when the spread is low).

But I can't code that, despite it is probably pretty simple Please help.

Simon

Simon

You have to have some kind of time filter then, and that would limit the EA very much (not sure that it would check the conditions at the right time - conditions do no need to happen at the same time every day)

 
simon_json:
Hi,

I coded this EA

and it woks very good (on GER30 Index in backtest, and this is kind of the strategy I use for manual trading) .

But I wish it just checked the conditions once a day, or maybe twice. Thus; that it just buy or sell once or twice a day (lets say 12:00 and 24:00, or two other minutes when the spread is low).

But I can't code that, despite it is probably pretty simple Please help.

Simon

If it works OK, why changing it?

 
mladen:

Simon

You have to have some kind of time filter then, and that would limit the EA very much (not sure that it would check the conditions at the right time - conditions do no need to happen at the same time every day)

Thanks for reply! Yes, a time-filter would be great! And maybe a "limit trades per day" or something.

Now the EA checks the condition every single second, and therefore makes to many trades, this decreases profit.

 
nbtrading:
If it works OK, why changing it?

It could be better

 

This might clear things up. I will probably make this into a job in the freelance section on Mql5.com (if it not gets a solution here ) "Requirements Specification I

An EA with the following input parameters:

- Magic number

- Lots

- Slippage

- Stoploss (I want to be able to enable and disable StopLoss)

- TakeProfit (I want to be able to enable and disable TakeProfit)

- TrailingStop (I want to be able to enable and disable TrailingStop)

- I want to be able to trail Stoploss in small steps. (I want to be able to enable and disable this)

- If stop loss is hit, then wait for the opposite order (if the EA has a buy-order and SL is hit, then wait for a sell-”signal” before open a new order) (I want to be able to enable and disable this. If it is disabled, then the EA should open a new order depending on where price is in relative to MA.)

- Moving Average Period

- Moving Average Method

- Moving Average Timeframe

- Number of trades per day (24h)

- Trading time start

- Trading time end

I wish the EA, each day (24h), during trading time, to check if price are above or below Moving Average. And take ”Number of trades per day” into account.

One (1) number of trades means close the existing (present, current) order, and open a new order. Thats one trade. ! This is important !

If price is over MA, then buy. If price is under MA, then sell.

Example (if ”number of trades per day” is one (1) ):

If it has a buy-order, and price is over MA, then keep the order.

If it has a buy-order, and price is under MA, then close the order, and open a sell-order.

If it has a sell-order, and price is under MA, then keep the order.

If it has a sell-order, and price is over MA, then close the order, and open a buy-order.

I wish the EA to check this each day, during trading time. This menas there will be no single day that the EA has no order, it will always has one order.

In trading time, the EA should keep the existing order, or close it and open a new one (in opposite direction, if conditions are met.)

So, an example;

Trading Time (Yes/No?) if yes -> Number of trades per day (Has it reached limit? Yes/No?) if no -> is price over MA, then buy (or keep existing buy-order), is price under MA, then sell (or keep existing sell-order).

The Expert Advisor must check and correctly process possible errors in trading operations."

 
simon_json:
It could be better

Usually when people try to make better something that works OK, it gets worse

Reason: