Help with this code

 

Hi there,


I am developing (with your help) my first expert advisor.

This one is based on trading one of the manual strategies I use and seems to be profitable if auto traded since when manual trading we lost several opportunities.

In fact, I have made some changes on some indicators and used an expert sample to open/close/modify trades.


I have some problems I need you (once again) to try to help me. These are:

1. Since the original expert advisor was built to open just one trade a day, it does not opens more than one trade at the same time. What I need is to be able to open more than one position on different currency pairs if signals appears. For instance, be able to open 1 EUR-USD and 1 GBP-USD positions at the same time if the conditions are satisfied for this currency pairs (and open additional positions on other currency pairs if need). But open just one position for the same currency pair. For instance, not open more than 1 position on EUR-USD at the same time.


2. I have discovered how to change the expert in order to open more than one trade per day, but the problem is that when a position is closed (if a profit target is reached), he opens an additional position for the same currency pair if the signal is still there... and sometimes is too risky to do it. How to prevent the system to open this kind of positions? How can I make the expert to open trades for the same currency pair with 2-3 hours diference? That is, if a position is closed at 8am, the system must be able to open positions just from 10am, or 11am, etc. An aditional option should be a specific number of bars from the closed position. For instance, count from the closed bar 7/8 candles before open a new trade on the same currency pair.


This are the 2 problems I have and need your help to solve them.


I cannot tell you if the system is a profitable one or not, but I can garantee that on a +/-10 hours period he had made more than 200pips tradding just one currency pair. The only lost trades where closed manually since it is on a testing purposes and those positions where open by the exposed problem on point 2.

Perhaps on a future the EA will just open a position per day for each currency pair but for testing purposes I need to be able to open more than one position per day (for a specific currency pair) and more than one position at the same time on diferent currency pairs, since this system cannot be backtested.


Attached find a copy of the expert advisorin order for you to see what can you do.

Basically, my problems are on the CheckTodaysOrders() routine, and on OPEN BUY/SELL routine.


Your help will be very apreciated.


Thank you in advance


Regards


Paulo

Files:
teste.mq4  7 kb
Reason: