[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 283

 
Urain >> :

Man, I didn't make it, I'm so fat.)

>> who's fat? :)

 
joo >> :

Who's Fatty? :)

Yeah, it's a festive night...

 

Thank you. Got it.

BUT I'm shocked by the speed of the answers THANK YOU SO MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 
igrok2008 >> :

Thank you. Got it.

But I'm blown away by the promptness of the answers. Thank you so much. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

:), to the "middle class" this will no longer apply

 
igrok2008 >> :

Thank you. Got it.

But I'm blown away by the promptness of the answers. Thank you so much. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

A lot of people, nothing to do, so they're having fun.

 
//+------------------------------------------------------------------+
//|                                                       скрипт.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   int kolvo_barov = 1000;
   double start_price = iOpen(Symbol(),0, kolvo_barov);
   int handle;

   while( kolvo_barov>1)
   {
      if (iHigh(Symbol(),0, kolvo_barov)> start_price + 0.01)
      {
      handle=FileOpen("my_data.csv", FILE_READ| FILE_WRITE, '\t');
         if( handle>0)
         {
            FileWrite( handle,"+100");
            FileClose( handle);
         }
      start_price = start_price + 0.01;
      kolvo_barov--;
      }
      
      else
      {
         if (iHigh(Symbol(),0, kolvo_barov)< start_price * 0.01)
         {
      handle=FileOpen("my_data.csv", FILE_READ| FILE_WRITE, '\t');
         if( handle>0)
         {
            FileWrite( handle,"-100");
            FileClose( handle);
         }
      start_price = start_price - 0.01;
      kolvo_barov--;
         }
      }
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Please tell me where the error is.

The essence of the script:

kolvo_barov - depth of history processing

start_price - initial price

If the price has departed from the starting price by +/- 100 points, then accordingly +100 or -100 points will be written in the file. The start price should be changed to start_price +/-100 respectively.

 

Can someone put fibo levels in the indicator

https://www.mql5.com/ru/forum/121664

 
xmurik писал(а) >>

Please tell me where the error is.

The essence of the script:

kolvo_barov - depth of history processing

start_price - initial price

If the price has departed from the starting price by +/- 100 points, then accordingly +100 or -100 points will be written in the file. The initial price is changed, respectively, to start_price +/-100.

The move to the end of the file should be used, otherwise it is overwritten all the time

bool FileSeek( int handle, int offset, int origin)
The function moves the file pointer to a new position, which is an offset in bytes from the start, end or current file position. The next read or write occurs from the new position.
If the move of the file pointer was successful, the function returns TRUE, otherwise it returns FALSE. To get information about the error, the function GetLastError() must be called.
Parameters:
handle - File descriptor returned by FileOpen().
offset - Offset in bytes.
origin - Origin position. The value can be one of these constants:
SEEK_CUR - from the current position,
SEEK_SET - from the beginning,
SEEK_END - from the end of the file.
Example:
 int handle=FileOpen('filename.csv', FILE_CSV|FILE_READ|FILE_WRITE, ';'); if(handle>0) { FileSeek(handle, 0, SEEK_END); //---- add data to the end of file FileWrite(handle, data1, data2); FileClose(handle); handle=0; }

 
Thanks Vinin. I figured out how to write to file, but the error is somewhere in the logic - the script doesn't terminate and doesn't write anything to the file... Anyway, I'll learn the basics.
 
xmurik писал(а) >>
Thanks Vinin. I've solved writing into file, but there is an error somewhere in logic - script doesn't terminate and doesn't write anything into file... Anyway, I'll learn the basics.

>>What instrument do you play it on?

Reason: