OILFXPRO Master E A free version

 

Hi friends and enemies

Here is another free Expert Adviser to this community.This Expert Adviser belongs to me and I paid money for it .It may require further development and coding and testing .Please feel to contribute in updating this EA and stating on the EA the improvements coded .Please feel free to write down the set of rules as to how to use this E A.

It is useful and can be used with a poorly written EA as slave and master.

The purpose of the EA is to override all the stops and take profits etc .It is not tested yet and I will let all the testers contribute with their testing .Please post if the E A is functioning properly and what else needs to be coded and any missing codes.

If more than one EA is used ,say for example 5 .it will override the instructions on all.

Post my mistakes and I will correct them.

I have attached the modified ea and master. You need to place the

master on one chart first and then the slave on another chart. The magic

number does not matter. If there are any problems with it please let me

know.

To make a slave and master you need to do the following.

Create a master ea that creates and maintains global variables using

commands like the following :GlobalVariableSet("TradingAllowed",false);

please note.....global variables only save as numbers so false shows as

0 and true as 1

You then get the slave to check the values of the global variables

before making a trade....eg.

if(GlobalVariableGet("TradingAllowed")==1)opentrade();

or if(TotalSellOrders()< GlobalVariableGet("Max_Shorts")) SellOrdOpen();

You should be able to adapt all your ea's to this master as I have not

made the master exclusively look for this slave;

Below is an explanation of some of the new variables I have used.

On the slave there is the option OrderSet, this is so you can select

which sl and tp strategy the ea trades.

On the master if a value is set to 0 this function will not be used.

extern int TradeHours =24;

extern int MaxAllowedTrades=5;

If more than 5 orders are opened within 24 hours the ea will disable trades

extern int DailyAccountLossAllowed=5;

If the account looses more than 5% in 24hours it will dissable trading;

extern int DeletePendingAfter =1; if any pending order is open for more

than 1 hour it is deleted

extern int CloseOrdersOnFridayAt=16; the hour on friday that all open

orders will be closed

extern int WeekendDissable=16; the hour on friday that new orders will

be dissalowed at

extern int WeekendEnable=10; the hour on monday that new orders will be

allowed again at

extern int NewsDissable=16;

extern int NewsEnable=10;

Best Regards

El cid

 

Hi

There were many other functions I expected to be included in this EA .There is room for improvement and additional coding

ea saves and maintains a file on the

>> computer which will contain instructions /do's and don't for all slaves.

>> I will code the slave to consult this file before making any trade.

>>> 1)The master will be created with maximum emphasis on safety and

>>> security.The master will monitor all orders sent and prevent duplicate

>>> orders and multiple orders created by ordersend functions.The master

>>> will log all orders sent and wait 10 mins before resending order. And

>>> before resending it will check orders filled and open positions , it

>>> will do the same everytime the metatrader programme reboots and will

>>> never allow orders above the maximum to be sent.

>>>

>>> 2)Sometimes, when several EAs start trading at the same time, trading

>>> functions may fail because the trading context is busy and only one EA

>>> is allowed to trade at the moment. So, other EAs will not open

>>> positions/modify orders etc. and the signal will be missed. To avoid

>>> this, you can either use WaitUntilTradingIsAllowed() function or

>>> StartTrading()/StopTrading() functions.We only had one EA.Please take

>>> care of this.

>>>

>>> 3)Your code will ensure the EA performs robustly and EA is coded to

>>> deal with situations where MT > feed is interrupted in some way. For

>>> instance, many/most EA's take no > account of MT simply being closed

>>> down and restarted - one of the most > basic requirements - and lose

>>> all their trade stats....The master will also not allow duplicate

>>> trades created by requotes in times of high volatility

>>>

>>> 4)A lot of EAS are not able to deal with requotes and platforms

>>> freezing during high volatility.The order send functions often send

>>> multiiple orders whilst the platforms are frozen.Please advise how you

>>> will code this.

>>>

>>> 5)The master will override the functions of the slave on the following

>>> commands.

>>> extern int RangeDeviation = 1; // Allowable pips +/- offset for entries

>>>> b)If EA incurs losses of more than 1% of account size in a 24 hour

>>>>

>>>> period ,disable E A. If EA incurs losses of more than 3% of account

>>>>

>>>> size in a 72 hour period ,disable E A

>>>>

>>>> The EAS can place more than the desired number of trades .I was using

>>>> How can the order send function be tightened and the code improved to

>>>>

>>>> prevent more than the required number of orders being placed?

>>>> Should every order sent be checked on log and should resending should

>>>>

>>>> be frozen for 10 minutes and should resending only be valid only after

>>>>

>>>> checking filled orders(total open trades) show trade as not executed?

>>>>

>>>> A lot of EAS are not able to deal with requotes and platforms freezing

>>>>

>>>> during high volatility.The order send functions often send multiiple

>>>>

>>>> orders whilst the platforms are frozen

>>>>

>>>> * *

>>>>

>>>> *He also gave you a couple of advices: *

>>>>

>>>> * *

>>>>

>>>> * *

>>>>

>>>> * *

>>>>

>>>> *Sometimes in the source code (for example, in the CloseAllOrders

>>>>

>>>> function) the return value of the trading functions (OrderModify,

>>>>

>>>> OrderSend etc.) is not checked. So, if an error occurs, there will be

>>>>

>>>> no error messages in the log file and it could be difficult to

>>>>

>>>> understand why the trading operation has failed. *

>>>>

>>>> * *

>>>>

>>>> * *

>>>>

>>>> * *

>>>>

>>>> *Sometimes, when several EAs start trading at the same time, trading

>>>>

>>>> functions may fail because the trading context is busy and only one EA

>>>>

>>>> is allowed to trade at the moment. So, other EAs will not open

>>>>

>>>> positions/modify orders etc. and the signal will be missed. To avoid

>>>>

>>>> this, you can either use WaitUntilTradingIsAllowed() function or

>>>>

>>>> StartTrading()/StopTrading() functions. *

>>>>

 

I noticed a problem immediately with this EA.

The "Close All" function shouldn't work properly as coded.

Reason being: MT4 will only execute one operation per tick.....

void CloseAll()

{

int total = OrdersTotal();

for(int i=total-1;i>=0;i--)

{

OrderSelect(i, SELECT_BY_POS);

It should be more like "while(OrdersTotal()>0)" etc......

That will force the program to loop instead of moving on after one order closes.

I could be wrong, but that is based on first glance.

 

There are no OrderSend() functions in the code! It will not open any trades because of this!

 
tdion:
There are no OrderSend() functions in the code! It will not open any trades because of this!

It will open trades from the slave and manage from the master.

The early bird EA is attached .This is where he modied something .At the top

extern int OrderSet =1;

Sorry I did not post earlier because I was afraid of copyright infringement

You are a coder and it would help if you could make the changes and post the EA .I am not a coder but the previous coder did all the work.

I am happy to leave this in your capable hands to handle this EA

Thanks

El cid

 

Hi folks

I want to take this further and put in 10 slaves on one master.Is it possible?

.

To start with I will provide one profitable EA , programmer will make one master EA and put 6 copies of the EA as slaves.The six EAS will work at the same time from one chart..Each EA slave will have different settings for mas,triggers etc.Each slave will have its own stop loss ,take profit and separate entry signal.

When the main working master is delivered ,I will provide 3 further EAS or logic to be input for each of the 4 additional slaves.

The master will control all the slaves and disable each individual slave if maximum orders long or short orders are generated.If maximum 4 long/short orders are open , any further signals for more longs will be disabled

Slaves will be set with override code, which if inserted will use take profit ,stop losses and type of trailing stop, only from the slave and each slave will have its own override key to override master.

The EA will read the market prices and go through the following steps

1)read market prices and activity of prices

2)slaves generate order signals

3)slaves pass order to master

4) master reads success probability count level of between 1 to 10

5)master reads stop target count level of between 1 to 10

6)master checks filters

7)0If stop loss probability and success probability above x ,master places order

8)If long and short positions are open at same time ,master widens stops according to total potential gain /probabilities

9)If part positions closed at a profit master reassess the positions and reverts to old stop loss levels

This is not an easy 2 page EA .It is an ugly nightmare to debug and compile.It is a big job

How long will it take to compile the first stage of 6 slaves into one ,plus master set up with probability counts for entry and stops?

I would want a fully working EA and MQL files fully debugged ,before I go to stage two and 4 additional masters

Regards

OILFXPRO

 

If you are talking about copy trades tool so I am testing it right now. Did not post yet as it is still in testing:

- TradeSpy_v2.1 indicator to copy trades to the other Metatrader's folder in real time (copy slaves' trades);

- SpyTrader_v1 EA (master EA)

It was created by Igorad according to many requests (including ElectricSavant request in elite section).

 
newdigital:
If you are talking about copy trades tool so I am testing it right now. Did not post yet as it is still in testing:

- TradeSpy_v2.1 indicator to copy trades to the other Metatrader's folder in real time (copy slaves' trades);

- SpyTrader_v1 EA (master EA)

It was created by Igorad according to many requests (including ElectricSavant request in elite section).

New Digital

What I am trying to achieve is to use 10 to 12 slaves EAS.These EAS are standard EAS but are used as a slave.The 10 to 12 EAS in a porfolio are managed by one master EA.

You could have 10 trades opened from a portfolio on Eur/usd and some at the same price and similiar stops.The master would limit the 10 EAS to only 4 open orders

10 EAS generate signals but the master picks the best 4 TRADES based on probability counts , and sends to broker

OILFXPRO

 
oilfxpro:
New Digital

What I am trying to achieve is to use 10 to 12 slaves EAS.These EAS are standard EAS but are used as a slave.The 10 to 12 EAS in a porfolio are managed by one master EA.

You could have 10 trades opened from a portfolio on Eur/usd and some at the same price and similiar stops.The master would limit the 10 EAS to only 4 open orders

10 EAS generate signals but the master picks the best 4 TRADES based on probability counts , and sends to broker

OILFXPRO

As to copy trades from 1 or several Metatraders to one or several other Metatraders with some settings (slaves lot size and MM; or our lot size and MM, any broker, maximum trades options and so on) so i am testing it right now. I will post it of course but need to speak with Igorad first.

As to portfolio manager

(manage some EAs concerning openning orders, equity, to stop trading, to start trading, interrupt during the trades - one EA is trading but the other is waiting - how many seconds with 'agreement " to metatrader software, switching slaves on or off according to the market condition predicted; and so on)

so it is difficult task.

You did some good posts about it in this thread.

There are some library files which are helping to do it (controlling the trades in case of many trades opened) - in Metaquotes base.

So, it can be fine if coded as library file or dll ... because according my understanding it should be very big code ...

But may be ... just to start with small ...

Anyway it is very good idea.

Reason: