[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 260

 

Hello citizens.

In order not to clutter up the forum really, I decided to write in this thread. Answer Please, on my two computers there was (and now there is only one left, after reinstalling Windows in a hurry) MetaTrader 4 with the same account, had a brainstorm and I lost my password, so where still remains MT4 untouched, I can see, and log in, and work with this account normally, but I see the password only under the asterisks. I saw in MT4 in the dialog box for entering number and password there is a checkbox "Store personal information", can I see this file somewhere and somehow, and will the password be in it?

 
vovdec >> :

... I lost my password, so this is where MT4 still remains untouched, I can see, and log in, and work with this account normally, but I only see the password under the asterisks. I saw in MT4 in the dialog box for entering number and password there is a checkbox "Store personal information", can I see this file somewhere and somehow, and will the password be in it...?

The password in MT4 is stored in an encrypted form and its location is not made public.

Some of the local bison have pulled it out, but it's a challenge to put it mildly.

When copying/transferring the MT4 folder, the password is lost. Made for security purposes.

Password to any real account can be restored via TP.

From demos it is better to save it or change it for the one which you will not forget, immediately after

>> It's better to save or change it after you open the demo.

 

Hello. I've built a small EA here that just opens a position by time. Basically everything works, but I can't test it on the history. Help me to understand it.

//+------------------------------------------------------------------+
//| Midnight.mq4 |
//| BaceK |
//| |
//+------------------------------------------------------------------+
#property copyright "BaceK"
#property link ""

//---- input parameters
extern int Dist_SL=20;
extern int_TP=30;
extern double Prots=0.35;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{

string Symb=Symbol(); // financial. instrument.
int Min_Dist=MarketInfo(Symb,MODE_STOPLEVEL);// Min_Dist
//Alert("Min. distance = ",Min_Dist);
double Min_Lot=MarketInfo(Symb,MODE_MINLOT);//Min. lot size
//Alert("Min. lot size = ",Min_Lot);
double Free =AccountFreeMargin(); // Free means
//Alert("Free money = ",Free);
double One_Lot=MarketInfo(Symb,MODE_MARGINREQUIRED);//Evalue of One_Lot
//Alert("Cost per lot = ",One_Lot);
double Lot=MathFloor((Free*Prots)/(One_Lot*Min_Lot))*Min_Lot;//Lots
//Alert("Bars = ",Lot);
//Alert("Bars = ",Bars);

//-----------------------------------------------
// Checking for free spaces
if ( Lot != 0 )
{
//Alert("Work onwards = ",OrderSymbol());

// Checking working time
int h=TimeHour(TimeCurrent());
if ( h < 1 )
{
for(int i=1; i<=OrdersTotal(); i++) // Order loop
{
if(OrderSelect(i-1,SELECT_BY_POS)==true) // if there is a
{
// Order analysis:
if (OrderSymbol()!= Symb) // Not our financial instrument.
{
//Alert("Work Next = ",OrderSymbol());
// Determination of which way to open
if (iOpen(NULL,PERIOD_D1,1)-iClose(NULL,PERIOD_D1,1)< 0)
{
//Alert("Long position = ",iOpen(NULL,PERIOD_D1,1)-iClose(NULL,PERIOD_D1,1));
int ticket=OrderSend(Symb,OP_BUY,Lot,Ask,3,Bid-Dist_SL*Point,Bid+Dist_TP*Point);
}else
{
//Alert("Short Position = ",iOpen(NULL,PERIOD_D1,1)-iClose(NULL,PERIOD_D1,1));
int ticket1=OrderSend(Symb,OP_SELL,Lot,Bid,3,Bid+Dist_SL*Point,Bid-Dist_TP*Point);
}
if (ticket>0 || ticket1>0) // it worked :)
{
// Alert ("A SELL order is set ",ticket || ticket1);
Sleep(5000);
}else
{
int Error=GetLastError(); // failed :(
switch(Error) // Insurmountable errors
{
case 129:Alert("Wrong price. Try again...");
RefreshRates(); // Refresh data.
return(0);
case 135:Alert("The price changed. Try again...");
RefreshRates(); // Refresh data.
return(0); // Next iteration.
case 146:Alert("The trading subsystem is busy. Try again...");
Sleep(500); // Simple solution.
RefreshRates(); // Refresh data.
return(0); // Next iteration
}
switch(Error) // Critical errors
{
case 2 : Alert("General error;)
break; // Exit switch
case 5 : Alert("Older version of client terminal.");
return(0); // Exit switch.
case 64 : Alert("Account blocked.");
return(0); // Exit in switch
case 133:Alert("Trading prohibited");
return(0); // Exit the switch
default: Alert("An error has occurred ",Error);// Other options
}
//Alert("GetLastError();
return(0);
}


}else
{
//Alert("Exit by Symb = ",Symb);
return(0);
}
}else
{

//Alert("Exit by no order = ",Symb);
if (iOpen(NULL,PERIOD_D1,1)-iClose(NULL,PERIOD_D1,1)< 0)
{
//Alert("Long position = ",iOpen(NULL,PERIOD_D1,1)-iClose(NULL,PERIOD_D1,1));
int ticket2=OrderSend(Symb,OP_BUY,Lot,Ask,3,Bid-Dist_SL*Point,Bid+Dist_TP*Point);
}else
{
//Alert("Short Position = ",iOpen(NULL,PERIOD_D1,1)-iClose(NULL,PERIOD_D1,1));
int ticket3=OrderSend(Symb,OP_SELL,Lot,Bid,3,Bid+Dist_SL*Point,Bid-Dist_TP*Point);
}
if (ticket2>0 || ticket3>0) // it worked :)
{
//Alert ("SELL order set ",ticket2 || ticket3);
Sleep(5000);
}else

{
int Error1=GetLastError(); // failed :(
switch(Error1) // Insurmountable errors
{
case 129:Alert("Wrong price. Try again...");
RefreshRates(); // Refresh data.
return(0);
case 135:Alert("The price changed. Try again...");
RefreshRates(); // Refresh data.
return(0); // Next iteration.
case 146:Alert("The trading subsystem is busy. Try again...");
Sleep(500); // Simple solution.
RefreshRates(); // Refresh data.
return(0); // Next iteration
}
switch(Error1) // Critical errors
{
case 2 : Alert("General error;)
break; // Exit switch
case 5 : Alert("Older version of client terminal.");
return(0); // Exit switch.
case 64 : Alert("Account blocked.");
return(0); // Exit in switch
case 133:Alert("Trading prohibited");
return(0); // Exit the switch
default: Alert("An error has occurred ",Error1);// Other options
}
Alert("GetLastError();
return(0);
}

}
}

}else
{
// Alert("Exit by time = ",Hour());
return(0);
}
}else
{
//Alert("Exit by Lot = ",Lot);
return(0);
}

//----


//Alert ("Script finished -----------------------------");
return(0);
}
//+------------------------------------------------------------------+

 

What exactly doesn't work? If the alert is so in the tester it doesn't work, replace it with a print or a comment.

Instead of alerts, put a function like this:

void ComAlert(string text)
{//+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
 if(IsTesting())Comment( text);else Alert( text);
return;
}//+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+


 

The advisor has not made a single trade in the tester at all. Everything is nil.

 
BaceK1 >> :

The advisor has not made a single trade in the tester at all. All for nil.

>> Does it work live?

 
It works in live mode. It opens the position in the desired direction with the set parameters. It does not open anything in the tester.
 
BaceK1 >> :
Works in live mode. It opens the position in the desired direction with the set parameters. In the tester it does not open anything.

What does it say in the log? Be brave or do I have to get every word out of you.

 

2009.10.16 20:33:19 2009.07.31 22:43 Midnight EURJPY,Daily: Alert: Time Out = 22

Third from bottom Alert

 
How do I open a position at a precise time? For example, a position has to be opened at 00.15 local time.
Reason: