Limiting BIN files to a maxsize of lines per file

MQL4 Asesores Expertos Sripts

Trabajo finalizado

Plazo de ejecución 1 día
Comentario del Ejecutor
Friendly customer
Comentario del Cliente
Good job, straight to the point and honest.

Tarea técnica

Hi all, the simple script im currently using has the below functions Ontick:

- Takes the Bid or Ask price of the current chart pair.
- Opens/Creates a new bin file.
- Stores that Bid or Ask price at the BOTTOM of the bin file
- Reopens the bin file to read it
- Stores it into an array in order to be manipulated

I would like to be able to limit this file, because obviously right now the file just keeps getting bigger, to a certain number of lines (circular buffer?)
So that at the current tick, and lets say maxsize = 5, the file looks like this:
-E, D, C, B, A (A being the oldest bid/ask price stored at the end of the line)

on next tick
-F, E, D, C, B  (A deleted and F inserted as the most recent tick price)

The code is the below:

void OnTick()



  {

   double PriceDiff = MarketInfo("AUDCAD",(MODE_ASK));

        

   int fileHandle2 = FileOpen("Myfile.bin",FILE_BIN|FILE_READ | FILE_WRITE);

       

   FileSeek(fileHandle2, 0, SEEK_END); // Write at the end of the file.

   double data2 = PriceDiff;

   FileWriteDouble(fileHandle2,data2);

   FileClose(fileHandle2);    

   double arr[];

   string path= "";

   ResetLastError();

   int file_handle=FileOpen("Myfile.bin",FILE_READ|FILE_BIN);

   if(file_handle!=INVALID_HANDLE)

     {

      FileReadArray(file_handle,arr);

      //--- receive the array size

      int size=ArraySize(arr);

      //--- print data from the array

      for(int i=0;i<size;i++);

      Comment("Total data = ",size);

      //--- close the file

      FileClose(file_handle);


I hope the explanation is clear enough, if not we can discuss further. 

Thanks in advance
Chris

Han respondido

1
Desarrollador 1
Evaluación
(5)
Proyectos
7
29%
Arbitraje
1
0% / 100%
Caducado
0
Libre
2
Desarrollador 2
Evaluación
(4)
Proyectos
4
0%
Arbitraje
1
0% / 100%
Caducado
1
25%
Libre
3
Desarrollador 3
Evaluación
(6)
Proyectos
7
0%
Arbitraje
0
Caducado
5
71%
Libre
4
Desarrollador 4
Evaluación
(1)
Proyectos
2
0%
Arbitraje
0
Caducado
1
50%
Libre
5
Desarrollador 5
Evaluación
(82)
Proyectos
86
57%
Arbitraje
25
0% / 84%
Caducado
19
22%
Libre
6
Desarrollador 6
Evaluación
(62)
Proyectos
140
46%
Arbitraje
19
42% / 16%
Caducado
32
23%
Libre
7
Desarrollador 7
Evaluación
(7)
Proyectos
13
0%
Arbitraje
5
20% / 60%
Caducado
0
Libre
Solicitudes similares
Hi All i need programmer to make me 2 programs first program send sell or buy from tradingview to MT4 and MT5 not using alert on tradingview . not using WEBHOOK\ mean using trade order manually from tradingview to MT Second using alert webhook from indicators inside tradingview
I am looking for a skilled Thinkorswim script developer for a one-time project. Your task will be to combine 8 distinct Thinkorswim studies (I will provide the code for each) into one Lower Study. The final script should display histogram rows for the individual studies with a bubble color scheme of bright green, dark green, gray, dark red, and bright red
I need some who can develop my strategy and hand me over the source code... I will give you the specific area in the market i want to mark out and then set pending orders to execute once price move into the zone
C onversion from Ninjatrader to Tradingview. This includes thorough testing and debugging to guarantee that the script functions as intended on Tradingview...If you are in for this job kindly bid
I believe in Robotics as a major artificial intellect to function of growth of business.Therefore if you script there is a likelihood of bringing economies of scale.The retrospective of the dynamics of indulgence of work can be economics of scale
there I hope you're doing well I want to convert the tradingview indicator to make an indicator for mt5. And in that, I want to make an automatic robot on the base of the indicator. I have the pine script of that indicator
Looking for someone who is able to code MQL for MT5 manager plug-in? Please contact me for more info. it is mainly on when to trigger a stop out of the account
see trade open on every tick seconde ok forex pair us us30 if is current running at 40170.00 so open 2 trade buy stop and sell stop both in every tick pending order of buy stop will 40171.00 and sell stop pending order will be 40169.00 buy stop will open at 40171.00 and tp will be 40173.00 and SL will be 40169.50 ok if buy stop hit sell stop order automatically will be close now if sell stop order open at 40169.00 so

Información sobre el proyecto

Presupuesto
30 - 50 USD
IVA (18%): 5.4 - 9 USD
Total: 35.4 - 59 USD
Para el ejecutor
27 - 45 USD
Plazo límite de ejecución
de 1 a 10 día(s)