[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 552

 
Vovo4ka:

Guys, I made a counter here...it determines the minimum value for an n period...is this correct or not?

Usually before using

if (min<A)

variables are initialized (given an initial value)

 
Stells:


That's the only way.

I immediately put a takeprofit and a stoploss.

Of course you can open an order and then modify it, but it has always worked on A...ri.

So you know exactly where to dig, but stubbornly demand from the account type something that will not work.... Well if it's a matter of principle, then you can keep insisting on it.

 
sergeev:

So you know exactly where to dig, but you insist on demanding something from the account type that won't work.... Well if it's a matter of principle, you can keep insisting.


so the point is that other EAs are standing on the same account and they are working.

orders are placed on the market at once with TP and SL.

 
 
if(OrderMagicNumber( )== 1000||OrderMagicNumber( )== 2000){
Sorry for the silly question, is it spelled e correctly?
 
Stells:


so the thing is that there are other EAs on the same account, and they are working.

orders are placed on the market at once with TP and SL.


Have you tried to check the other options when opening an order?
 
sergeev:

have you tried to check other options when opening an order?
What do you mean by parameters?
 
Sepulca:

Maybe the problem is with delimiters. Check int FileOpen( string filename, int mode, int delimiter=';') operator and your file.
No. Everything is correct there. The problem is in reading from the file, the numbers are small. Maybe the default value in double is less than the number of decimal places, so it sees 0.000 and seems to be 0. How to check how many decimal places are there?
 

For example, symbol, lot, order direction, open price, slip, stop price, order comment, magik, expiry date, arrow colour.

You have to do something and change the parameters to get to the bottom of the problem.

You have to do something and change the parameters in order to catch up with the root of the problem.

You are a programmer or a passer-by?

 
orb:
No. The problem with reading from a file is that the numbers there are small. Maybe the default value in double is less than the number of decimal places, so it sees 0.000 and thinks it's 0. How do you check how many decimal places are there?

It can't be, four decimal places for sure. Is Histxmas[qq][0] array declared as double?
 

There was a discussion about exporting mq4 to *.csv and *.xls. I don't understand it. I understood that first I have to create a file, then open it, then write data into it and, if necessary, save it. This is in the csv file, and their commands in https://docs.mql4.com/ru/files/FileWriteArray

Can someone please show me how to export zz_arr_Abs[] array to both files using real example. The array needs to be written in columns. Or maybe you can use the bibliotheca described in https://forum.mql4.com/ru/44307

//+------------------------------------------------------------------+
//|                                                           ZZ.mq4 |
//|                      Copyright © 2012, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//indikatoriaus zz kintamieji
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;

extern int Bars_count=240;                  //Is kiek baru skaiciuosime
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   if( !NewBar() ) return(0);
   double zz_arr[10000],zz_arr_Abs[10000];
   double preZz=0;
   int i,ii;
   for(i=0;i<=Bars_count;i++)
   {
       double zz = iCustom(NULL,0,"ZigZag",ExtDepth,ExtDeviation,ExtBackstep,0,i); 
      if(zz!=0)
      {
         if(preZz==0)
         {
            preZz=zz
            ;continue;
         }
        zz_arr[ii]=zz-preZz;
        preZz=zz;
        ii++;
        Print(zz_arr[ii-1]/Point, "    ii = ", ii - 1);
        zz_arr_Abs[ii-1]=MathAbs(zz_arr[ii-1]);                              //Надо экспортировать
        Print("                      ",zz_arr_Abs[ii-1]/Point, "    ii = ", ii - 1);
     }
  }
  
  ArrayResize(zz_arr,ii);
  Print("-------------------------------------------------");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Iaia?o?aiea iiaiai aa?a
//+------------------------------------------------------------------+
bool NewBar() 
  {
//----
   static datetime NewTime;               // A?aiy oaeouaai aa?a
   bool NewBar=false;                     // Iiaiai aa?a iao
   if( NewTime!=Time[0] )
     {
      NewTime=Time[0];                    // Oaia?u a?aiy oaeia
      NewBar=true;                        // Iieiaeny iiaue aa?
     }
//----
   return(NewBar);
  }
//+------------------------------------------------------------------+
Reason: