Jump to content

ECN stuff EA's only


Recommended Posts

  • 7 months later...

Re: ECN stuff EA's only

 

Hi traders,

 

Good day,

 

I will be glad to share something related to this topic.

 

Maybe I can share some of what I know; to what we call it " converting to ECN ".

 

The steps are as the following:

 

1- Since your EAs will be use on ECN brokers, make sure the sendorder function place positions without SL or TP.

 

2- You can then modify SL and/or TP using orderreliable2step

 

For that you need to use this mqh file as shown below:

 

#include <LibOrderReliable.mqh>

 

3- You can modify your code like this:

 

 if(CheckEntry(trendtimeframe) ==  1 && CountBuys(MagicNumber)  == 0 && CountSells(MagicNumber) == 0)
   {                                                                          
   OrderSendReliable2Step(Symbol(),OP_BUY,LotsOptimized(),Ask,Slippage,Ask-(StopFactor*Point), Ask+(ProfitFactor*Point), "ECN Buy", MagicNumber,0,Blue);
   }

  if(CheckEntry(trendtimeframe) == -1 && CountSells(MagicNumber) == 0 && CountBuys(MagicNumber)  == 0) 
   {
   OrderSendReliable2Step(Symbol(),OP_SELL,LotsOptimized(),Bid,Slippage,Bid+(StopFactor*Point), Bid-(ProfitFactor*Point), "ECN Sell", MagicNumber,0,Red);
   }

 

I hope the idea is clear now. Keep it simple simple ;)

 

If there is an question, please don't hesitate to ask.

 

Best wishes for all.

Link to comment
Share on other sites

Re: ECN stuff EA's only

 

To put it simply, what he is saying is that once you included the LibOrderReliable MQH as he said, you can simply replace all "OrderSend" with "OrderSendReliable2Step" and it will start working on STP/ECN brokers without changing any of the parameters passed to the function. In addition to this, you gain some more added benefits such as automatic retrying, detailed logging etc. provided by that library.

Link to comment
Share on other sites

Re: ECN stuff EA's only

 

Hi traders,

 

Good day,

 

I will be glad to share something related to this topic.

 

Maybe I can share some of what I know; to what we call it " converting to ECN ".

 

The steps are as the following:

 

1- Since your EAs will be use on ECN brokers, make sure the sendorder function place positions without SL or TP.

 

2- You can then modify SL and/or TP using orderreliable2step

 

For that you need to use this mqh file as shown below:

 

#include <LibOrderReliable.mqh>

 

3- You can modify your code like this:

 

 if(CheckEntry(trendtimeframe) ==  1 && CountBuys(MagicNumber)  == 0 && CountSells(MagicNumber) == 0)
   {                                                                          
   OrderSendReliable2Step(Symbol(),OP_BUY,LotsOptimized(),Ask,Slippage,Ask-(StopFactor*Point), Ask+(ProfitFactor*Point), "ECN Buy", MagicNumber,0,Blue);
   }

  if(CheckEntry(trendtimeframe) == -1 && CountSells(MagicNumber) == 0 && CountBuys(MagicNumber)  == 0) 
   {
   OrderSendReliable2Step(Symbol(),OP_SELL,LotsOptimized(),Bid,Slippage,Bid+(StopFactor*Point), Bid-(ProfitFactor*Point), "ECN Sell", MagicNumber,0,Red);
   }

 

I hope the idea is clear now. Keep it simple simple ;)

 

If there is an question, please don't hesitate to ask.

 

Best wishes for all.

Thanks scarface and birt, but you guys are still a couple levels above my thought process.

I know I'm gonna sound like a total noob but:

 

1- Since your EAs will be use on ECN brokers, make sure the sendorder function place positions without SL or TP.

How do we do this? Look for every line of code that says OrderSend(...) and put zero on the TP and SL values?

 

2- You can then modify SL and/or TP using orderreliable2step

 

For that you need to use this mqh file as shown below:

 

#include <LibOrderReliable.mqh>

This mql file? Is that mql file already on the mt4 folder or do we have to download it?

That piece of code, do we write it around the beginning of the EA code?

 

- You can modify your code like this:

 

 if(CheckEntry(trendtimeframe) ==  1 && CountBuys(MagicNumber)  == 0 && CountSells(MagicNumber) == 0)
   {                                                                          
   OrderSendReliable2Step(Symbol(),OP_BUY,LotsOptimized(),Ask,Slippage,Ask-(StopFactor*Point), Ask+(ProfitFactor*Point), "ECN Buy", MagicNumber,0,Blue);
   }

  if(CheckEntry(trendtimeframe) == -1 && CountSells(MagicNumber) == 0 && CountBuys(MagicNumber)  == 0) 
   {
   OrderSendReliable2Step(Symbol(),OP_SELL,LotsOptimized(),Bid,Slippage,Bid+(StopFactor*Point), Bid-(ProfitFactor*Point), "ECN Sell", MagicNumber,0,Red);
   }

This is probably the most dificult part. I guess it's just copy paste, but how? Do we replace the all the OrderSend(...) lines with all that code, or put it after? Do we have to change any values, like where do we put the TP and SL?

 

Sorry I make it sound so complicated, I wish I understood more about MQ4. Would you mind put a very simple example, I think we noobies might get it easier.

 

Tks for your efforts

Link to comment
Share on other sites

Re: ECN stuff EA's only

 

scarface, see what I mean? ;))

 

dinj:

 

Add this somewhere at the beginning of your EA:

#include <LibOrderReliable.mqh>

 

Download LibOrderReliable.mqh and LibOrderReliable.mq4. Google them, they should be in a pack. Put the mqh file in includes, the mq4 file in libraries.

 

In your EA, replace all instances of "OrderSend" with "OrderSendReliable2Step".

 

That's it.

Link to comment
Share on other sites

Re: ECN stuff EA's only

 

scarface, see what I mean? ;))

 

dinj:

 

Add this somewhere at the beginning of your EA:

#include <LibOrderReliable.mqh>

 

Download LibOrderReliable.mqh and LibOrderReliable.mq4. Google them, they should be in a pack. Put the mqh file in includes, the mq4 file in libraries.

 

In your EA, replace all instances of "OrderSend" with "OrderSendReliable2Step".

 

That's it.

 

Hi Birt

 

Good day,

 

First, Thanks birt

 

Second, :o :o :o :o :o :o :-/ That was a big surprise. I thought they could understand that easily. :D

 

O.k, sorry guys about that. Next time I will do my best to explain in details. ;)

 

Here you find the links to the files, download them and add them to your MT4 folder.

 

1- This is the mq4 file. You should add it to the MT4 folder .... experts/ libraries

 

hxxp://xxx.multiupload.com/QKL9RX4FRL

 

2- This is the mqh file. You should add it to the MT4 folder ....experts/ include

 

hxxp://xxx.multiupload.com/T97G91D0M3

 

I guess now you guys are set. so all you need to make sure it works through a backtest run.

 

Please feel free to ask if you have any question.

 

Best wishes,

Link to comment
Share on other sites

  • 3 weeks later...

Re: ECN stuff EA's only

 

Hi scarface,

hi dinj,

hi Birt,

are the ECN files working only for ECN brokers or STP brokers like BeamFX, CollectiveFX or JadeFX as well ?

I have the problem, that e.g. the Firebird EAs (e.g. 1.0 or 0.67) are running on my Alpari account but not on the other brokers above.

All are 5 digit brokers.

BeamFX seems to be an ECN broker, but after adding the ECN add-ons as described above I couldn't open the EA anymore.

I would appreciate your support.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...