[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 219

 

Thanks, pasted this code into EA, compilation gives out '(' - function definition unexpected after bool ExistOrders, there's an extra parenthesis or something...

for (int k=0;k<OrdersTotal();k++)//We review among all open orders
{
OrderSelect(k,SELECT_BY_POS,MODE_TRADES);
if (!ExistOrders(Symbol(), OP_SELLLIMIT, Magic) )
OrderSend(Symbol(),OP_SELLLIMIT,Lots,Ask+(Shag/0.2)*Point,3,0,0,",123,0,Red);
bool ExistOrders(string sy="", int op=-1, int mn=123)
{
int i, k=OrdersTotal(), ty;
if (sy=="0") sy=Symbol();
for (i=0; i<k; i++)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
ty=OrderType();
if (ty<6)
{
if ((OrderSymbol()==sy || sy=="") && (op<0 || ty==op))
{
if (mn<0 || OrderMagicNumber()==mn) return(True);
}}}} return(False);
}
//----
return(0);
}
 
Graall:

Thanks, pasted this code into EA, compilation gives out '(' - function definition unexpected after bool ExistOrders, there's an extra parenthesis or something...


Take the ExistOrders functionout of the start function .
int start()
{
.....
for (int k=0;k<OrdersTotal();k++)//Производим просмотр среди всех открытых ордеров
   {
    OrderSelect(k,SELECT_BY_POS,MODE_TRADES);
    if (!ExistOrders(Symbol(), OP_SELLLIMIT, Magic) )  
     OrderSend(Symbol(),OP_SELLLIMIT,Lots,Ask+(Shag/0.2)*Point,3,0,0,"",123,0,Red);
}
   return(0);
 }

    bool ExistOrders(string sy="", int op=-1, int mn=123) 
     {
      int i, k=OrdersTotal(), ty; 
      if (sy=="0") sy=Symbol();
      for (i=0; i<k; i++) 
      {
       if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) 
       {
        ty=OrderType();
        if (ty<6) 
        {
          if ((OrderSymbol()==sy || sy=="") && (op<0 || ty==op)) 
         {
          if (mn<0 || OrderMagicNumber()==mn) return(True);
      }}}}  return(False);
          }
 
 

Yeah got it,ExistOrdersfunctionis a custom function, took it out of the start function, the error is the same, it's fighting something in the first part of the EA, I'm pasting it completely


//+------------------------------------------------------------------+

//| 1.mq4 |
//| Oleg 2013 |
//| |
//+------------------------------------------------------------------+
#define Magic 123

//--- input parameters
extern int TakeProfit = 100;
extern double Lots = 0.1;
extern int Shag = 100;
string sy;
int ty;
int op;
int mn;
int k;
int i;
//--------------------------------------------------------------------------------------------
int start()
{
// search for the first zero element
int total=OrdersTotal();
if (total==0)
{
OrderSend(Symbol(),OP_SELLLIMIT,Lots,Ask+(Shag/0.2)*Point,3,0,0,",123,0,Red);
OrderSend(Symbol(),OP_BUYLIMIT,Lots,Ask-(Shag/0.2)*Point,3,0,0,",123,0,Blue);
for (int i=0;i<OrdersTotal();i++)//View all open orders
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if ( OrderType()==OP_SELLLIMIT)
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(),Ask-(TakeProfit/0.2)*Point, 0);
if ( OrderType()==OP_BUYLIMIT)
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(),Ask+(TakeProfit/0.2)*Point, 0);
}
}
for (int k=0;k<OrdersTotal();k++)//View among all open orders
{
OrderSelect(k,SELECT_BY_POS,MODE_TRADES);
if (!ExistOrders(Symbol(), OP_SELLLIMIT, Magic) )
OrderSend(Symbol(),OP_SELLLIMIT,Lots,Ask+(Shag/0.2)*Point,3,0,0,",123,0,Red);

//----
return(0);
}
//+------------------------------------------------------------------+
bool ExistOrders(string sy="", int op=-1, int mn=123)
{
int i, k=OrdersTotal(), ty;
if (sy=="0") sy=Symbol();
for (i=0; i<k; i++)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
ty=OrderType();
if (ty<6)
{
if ((OrderSymbol()==sy || sy=="") && (op<0 || ty==op))
{
if (mn<0 || OrderMagicNumber()==mn) return(True);
}}}} return(False);
}
 
Graall:



Check parentheses pairing {} (carefully). The error means that there is at least one closing missing in the start () function.
 
alsu:

Check pairing of brackets {} (carefully). The error means at least one closing is missing in the start () function.


right, after

for (int k=0;k<OrdersTotal();k++)//Watch among all open orders

{
OrderSelect(k,SELECT_BY_POS,MODE_TRADES);
if (!ExistOrders(Symbol(), OP_SELLLIMIT, Magic) )

OrderSend(Symbol(),OP_SELLLIMIT,Lots,Ask+(Shag/0.2)*Point,3,0,0,",123,0,Red);

missed } thank you!

 
Hello, my time in the terminal does not coincide with the real time, now if I move the mouse over the M5 candle it shows 18.45, and in fact the time in Ukraine is 19.45, how can I change the time?
 
sanktum:
Hello, my time in the terminal does not coincide with the real time, now if you hover over the M5 candlestick shows 18.45, but actually in Ukraine 19.45, how to change the time?

None. The time on the candlesticks is the server time.

 

Good afternoon.

I am writing data to a file on every opening of a new bar:

int handle=FileOpen(Symbol1+Symbol2+".csv",FILE_WRITE|FILE_READ|FILE_CSV);
      if(handle>0)
        {
         FileSeek(handle,0,SEEK_END);
         FileWrite(handle,TimeToString(TimeCurrent(),TIME_DATE|TIME_MINUTES), DoubleToString(Pr1,2),DoubleToString(Pr2,2),DoubleToString(Pr3,2),DoubleToString(Pr4,2));
         FileClose(handle);
        }

I need the indicator to read this data and build a chart on the recorded time intervals.

I want to have an indicator that reads this data and plots it on the chart at every opening of a new bar.

 

I have installed MT4 (Version: 4.00 Build 451) and noticed that in the Experts Logs folder there is only one file dated the day the terminal was installed, i.e. the 13th. No more log files, although I have turned the platform on and off many times.

Any comments on this phenomenon would be appreciated.

 
Geowind64:

I have installed MT4 (Version: 4.00 Build 451) and noticed that in the Experts Logs folder there is only one file dated the day the terminal was installed, i.e. the 13th. No more log files, although I have turned the platform on and off many times.

Any comments on this phenomenon would be appreciated.


I need to run at least one expert/indicator/script, they are the ones that write to this folder.
Reason: