![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
My EA test with my live account
I have tried this on my live account for 1 day with very small .01 lots size and tp of 5 and the max orders set to 3 and it was profitable till it hit about 3 trades that went the wrong direction without setting the SL i was out 21 dollars in the three trades and it pretty much wiped out all the profits it made it came back some after I manually closed those trades out and it then it entered in about 3 more bad trades and is currently in three bad trades. I have disabled this ea from the Live account for the time being. I agree if a time set was used that could make this a very good ea and if Escape can add that to this EA i would test it out with my live account. It also needs to have the gmt offset if this parameter is used
This ea has a lot of potential and I think with some code tweaking it can be close to a holy grail.![](https://c.mql5.com/forextsd/smiles/smile.png)
Can it work with real accounts?
Can you please share with us what was problem? How to enable for real accounts? MIG told me during registrations that I need to specifically require for my account to be EA enabled. Maybe that is reason? Thanks
I think I figured out my problem but thanks anyway. Now we will see how it does on a Real Live Account. I will let everyone know
Stopped Trading!
As stated in an earlier post, this EA was working fine and in profits with many profitable buy orders until market changed and went south and no trades were made or closed. All profits and more lost. I checked all parameters of this EA and all were according to instructions. Any thoughts? I think this EA is worth tweaking has good potential. Sorry I can't help with that problem just a Trader not tech guy.
Trying a 1 min. chart just for kicks.
Cigarguy![](https://c.mql5.com/forextsd/smiles/sad_smile.png)
I have tried this on my live account for 1 day with very small .01 lots size and tp of 5 and the max orders set to 3 and it was profitable till it hit about 3 trades that went the wrong direction without setting the SL i was out 21 dollars in the three trades and it pretty much wiped out all the profits it made it came back some after I manually closed those trades out and it then it entered in about 3 more bad trades and is currently in three bad trades. I have disabled this ea from the Live account for the time being. I agree if a time set was used that could make this a very good ea and if Escape can add that to this EA i would test it out with my live account. It also needs to have the gmt offset if this parameter is used This ea has a lot of potential and I think with some code tweaking it can be close to a holy grail.
Hi,
I think the idea of time set is very good!I mean to designed this ea to work only in the period 22-05 GMT on eurchf pair.In this period the ea can't executed many trades but seems low risky.Is there some one why will designed time set for eurchf 22-05? I'am totally not a programer and can't do that![](https://c.mql5.com/forextsd/smiles/frown.png)
traillingstop and stoploss code
You can change red value.
this code first part
extern int iTakeProfitCloseValue=?;
extern int iTakeProfitMaxDecCount=?;
static bool bTakeProfitPrevious=-1;
static int iTakeProfitDecraeseCount=0;
static int iTakeProfitMaxValue=-1;
this code after start function
double SL = ?;
int totalOrderCount=OrdersTotal();
for(int pos=0;pos<totalOrderCount;pos++)
{
if( OrderSelect(pos,SELECT_BY_POS)==false ) continue;
if (OrderSymbol() == Symbol()
{
if ( OrderProfit() > 0 )
{
iTakeProfitMaxValue = OrderProfit();
if (bTakeProfitPrevious > OrderProfit())
iTakeProfitDecraeseCount = iTakeProfitDecraeseCount + 1;
else if (bTakeProfitPrevious < OrderProfit())
{
iTakeProfitDecraeseCount = iTakeProfitDecraeseCount - 1;
if (iTakeProfitDecraeseCount<0)
iTakeProfitDecraeseCount = 0;
}
bTakeProfitPrevious = OrderProfit();
if (( iTakeProfitMaxDecCount = (iTakeProfitCloseValue * 7.0)) )
{
bool cticket;
Print(Symbol()," P:",Period()," take profit ",iTakeProfitDecraeseCount," ",Ask);
/*if ( OrderType() == OP_BUY )
{
Print(Symbol()," P:",Period()," take profit ",iTakeProfitDecraeseCount,"" ,Ask);
cticket = OrderClose(OrderTicket(),OrderLots(),Ask,3,Yellow);
}
if ( OrderType() == OP_SELL )
{
Print(Symbol()," P:",Period()," take profit ",iTakeProfitDecraeseCount," ",Bid);
cticket = OrderClose(OrderTicket(),OrderLots(),Bid,3,Yellow);
}*/
double Price=OrderOpenPrice();
int Ticket=OrderTicket();
double Lot=OrderLots();
int AttemptCount=0;
while(true)
{
switch(OrderType())
{
case 0: double Price_Cls=Bid;
string Text="Buy ";
break;
case 1: Price_Cls=Ask;
Text="Sell ";
}
bool Ans=OrderClose(Ticket,Lot,Price_Cls,2);
if (Ans==true)
{
Print("closed
",Text," ",Ticket," Attemp: ",AttemptCount);
break;
}
Sleep(300);
RefreshRates();
AttemptCount++;
if (AttemptCount > 7) break;
continue;
}
}
int temp = -1;
if (OrderType() == OP_BUY)
{
double ftemp = SL;
if (Digits > 4)
{
ftemp = ftemp*MathPow(10,(Digits-4));//
} else {
ftemp = ftemp*MathPow(10,(4-Digits));//
}
if ( OrderStopLoss() < (Bid-ftemp*Point) )
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-ftemp*Point,OrderTakeProfit(),0,Blue);
}
temp = GetLastError();
if (temp>0){
Print(Symbol()," P: ",Period(),", ORDER change error - SL: ", Bid-ftemp*Point," Err: ",temp);
}
} else {
double ftemp2 = SL;
if (Digits > 4)
{
ftemp2 = ftemp2*MathPow(10,(Digits-4));//
} else {
ftemp2 = ftemp2*MathPow(10,(4-Digits));//
}
if (OrderStopLoss() > ( Ask+ftemp2*Point ))
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+ftemp2*Point,OrderTakeProfit(),0,Blue);
temp = GetLastError();
if (temp>0){
Print(Symbol()," P: ",Period(),", ORDER CHANGE ERROR - SL:", Ask+ftemp2*Point," Err: ",temp);
}
}
}
}
}
any way a indicator can be added to this
I think if multiple indicatiors are added this could also make this a better EA. What do you think guys.
I think if multiple indicatiors are added this could also make this a better EA. What do you think guys.
Good idea.
Maybe I should learn MQL myself.
Good idea.
Sounds like a good plan. I think that the indicators would go a long way in helping to correct the issue of this ea trading when the conditions are not right or the trades go market goes the opposite direction. I think this paired with a Trade window can make this be a very profitable EA. I haven't learned mt4 myself yet either but think these could go a long way into making this into a better EA.
You can change red value.
this code first part
extern int iTakeProfitCloseValue=?;
extern int iTakeProfitMaxDecCount=?;
static bool bTakeProfitPrevious=-1;
static int iTakeProfitDecraeseCount=0;
static int iTakeProfitMaxValue=-1;
this code after start function
double SL = ?;
int totalOrderCount=OrdersTotal();
for(int pos=0;pos<totalOrderCount;pos++)
{
if( OrderSelect(pos,SELECT_BY_POS)==false ) continue;
if (OrderSymbol() == Symbol()
{
if ( OrderProfit() > 0 )
{
iTakeProfitMaxValue = OrderProfit();
if (bTakeProfitPrevious > OrderProfit())
iTakeProfitDecraeseCount = iTakeProfitDecraeseCount + 1;
else if (bTakeProfitPrevious < OrderProfit())
{
iTakeProfitDecraeseCount = iTakeProfitDecraeseCount - 1;
if (iTakeProfitDecraeseCount<0)
iTakeProfitDecraeseCount = 0;
}
bTakeProfitPrevious = OrderProfit();
if (( iTakeProfitMaxDecCount = (iTakeProfitCloseValue * 7.0)) )
{
bool cticket;
Print(Symbol()," P:",Period()," take profit ",iTakeProfitDecraeseCount," ",Ask);
/*if ( OrderType() == OP_BUY )
{
Print(Symbol()," P:",Period()," take profit ",iTakeProfitDecraeseCount,"" ,Ask);
cticket = OrderClose(OrderTicket(),OrderLots(),Ask,3,Yellow);
}
if ( OrderType() == OP_SELL )
{
Print(Symbol()," P:",Period()," take profit ",iTakeProfitDecraeseCount," ",Bid);
cticket = OrderClose(OrderTicket(),OrderLots(),Bid,3,Yellow);
}*/
double Price=OrderOpenPrice();
int Ticket=OrderTicket();
double Lot=OrderLots();
int AttemptCount=0;
while(true)
{
switch(OrderType())
{
case 0: double Price_Cls=Bid;
string Text="Buy ";
break;
case 1: Price_Cls=Ask;
Text="Sell ";
}
bool Ans=OrderClose(Ticket,Lot,Price_Cls,2);
if (Ans==true)
{
Print("closed
",Text," ",Ticket," Attemp: ",AttemptCount);
break;
}
Sleep(300);
RefreshRates();
AttemptCount++;
if (AttemptCount > 7) break;
continue;
}
}
int temp = -1;
if (OrderType() == OP_BUY)
{
double ftemp = SL;
if (Digits > 4)
{
ftemp = ftemp*MathPow(10,(Digits-4));//
} else {
ftemp = ftemp*MathPow(10,(4-Digits));//
}
if ( OrderStopLoss() < (Bid-ftemp*Point) )
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-ftemp*Point,OrderTakeProfit(),0,Blue);
}
temp = GetLastError();
if (temp>0){
Print(Symbol()," P: ",Period(),", ORDER change error - SL: ", Bid-ftemp*Point," Err: ",temp);
}
} else {
double ftemp2 = SL;
if (Digits > 4)
{
ftemp2 = ftemp2*MathPow(10,(Digits-4));//
} else {
ftemp2 = ftemp2*MathPow(10,(4-Digits));//
}
if (OrderStopLoss() > ( Ask+ftemp2*Point ))
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+ftemp2*Point,OrderTakeProfit(),0,Blue);
temp = GetLastError();
if (temp>0){
Print(Symbol()," P: ",Period(),", ORDER CHANGE ERROR - SL:", Ask+ftemp2*Point," Err: ",temp);
}
}
}
}
}Hi escape,
Excuse for my irrelevant question, but is it possible to comply this program code like a file to be able to download?I ask you because I can't understand where put this code and may will wrong something.I can't understand nothing from codes and programing, only play with settings of ea.
Thank you!
InstaTrader Fix
Can you please share with us what was problem? How to enable for real accounts? MIG told me during registrations that I need to specifically require for my account to be EA enabled. Maybe that is reason? Thanks
First of all it sounds like you have a problem with the broker. I have had live
accounts with each of FXDD, FXPro, and InstaTrader and none of them have
required me to specifically request the account to allow EA's. The broker I
am using right now for testing is InstaTrader. They allow you to open an
account for even $25.00 or less and they allow lot sizes of only 100 units.
IBFX also allows lot sizes of 100 units. So a lot size of .01 would equal 1
cent per pip. Trading this small of lot size I had to make a change in the
code.
In order to get the EA to work on the Live Account
with (InstaTrader) I had to change a line in the Code;
From This:
if(AccountFreeMargin()<(1000*Lots)){
To This:
if(AccountFreeMargin()<(100*Lots)){
The 1000 has to be changed to 100 because with this
broker (InstaTrader) a lot size of .01 = 100 units.
Most brokers that offer lot sizes of .01 have their
value set at 1000 units.
Hope this helps.