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
DEAR DEVELOPERS, TO ANYONE WHO WOULD LIKE TO SHARE IN THEIR SUCCESS IIN TRADING AND DEVELPMENT OF PROFITABLE EA. I NEED A READY AN AUTOMATIC EA THAT I CAN USE ON MY LIVE TRADING ACCOUNT. THIS EXPERT ADVICE SHOULD TRADES ALL INSTRUMENTS AND CAN COMPUND PROFITS THAT CAN ATLEAST MAKE 100% ROI MONTHLY. AGAIN THIS SHOULD BE WORKABLE EA WITH PROVE OF STEADY RESULTS AND RELATIVE DRAWDOWN. THE EA SHOULD WORK ON VPS 24/7
I want to connect a bot to funding accounts (FTMO) if it is programmed from MetaTrader 4. Do you know if FTMO allows EAs to be connected to their private servers? Have you done this for FTMO before? What do you think is a better option in this case to program from mt4 or from Pinescript with the help of Pineconnector
Hello, I need someone to create a script with these parameters in Tradestation (EasyLanguage). Here's what I'm trying to achieve: STRATEGY: I will manually select and sell an OTM naked call. My goal is to let it expire OTM. However if price goes past the strike, this strategy will buy and sell 100 shares of the underlying to minimize risk that I have to buy/sell shares at a higher price. What I want EasyLanguage to
Simple Hedge Zone EA 30 - 50 USD
inputs : 1 - order factor type : initial contract size / net contract size initial order size : it mean the multiply on the initial position it mean if i open 1 lot and the factor is 2.0 the second order will be 2 and the third one it will be 4 net contract size : it mean the multiply on net contract opened like exposure , it mean if i open 1 lot and the factor is 2.0 the second order will be 3 because in the stage
Guten Tag, benötigt wird eine Software die Trades auf einem MT4 oder MT5 kopiert und auf die xStation übergibt: http://developers.xstore.pro/documentation/ Auf dem MT4/5 Chart muss ein Hinweis stehen und wie die aktuelle Verbindung ist. Einstellbar wie zum Beispiel: https://drive.google.com/file/d/1ltg83qnbj-FgWRrq4q-1r1NS-vL5b-jE/view?usp=drive_link Es reicht wenn man es in MT4/5 Settings einstellen kann. Es muss
hi i want to create an ea based on price action,moving avereges and fair value gaps. i want the robot to operate on london session and newyork session. i want the bot to identify gaps, fill them and open position after fill the gap on opposite direction. Also i want the robot to open a position after a bearish or bullish engulfing candle cross the 200 moving averages
Hello, I am looking for a skilled MQL4, MQL5 PROGRAMMER WHO IS CAPABLE OF CODING A WELL AUTOMATED EA FOR MT4 AND MT5, I NEED AN EA THAT RUN WELL AS BELOW streamlined version of MY strategy Price-Based Entry : The EA opens trades based on price movements, either buying or selling. Profitable Exit : Trades are closed when they reach a predefined profit target. If a trade starts moving into negative territory, the EA
I want to build a well performance mt4 indicator or trading view indicator for my strategy, please you must make sure you are a professional in building mt4 indicator or trading view indicator with serveral years of experience, so if you are kindly react to this and let talk more on how you will get my indicator working
EA development 30+ USD
HELLO there, am looking for some one that have serveral years of experience in developing a well performance EA, that can use both mt4, mt5 platform for development, please you most be an expert in the coding of EA , THANK YOU
All rights published by the owner. Its about experience and expert advisors may not be 100% accurate but they will assist you placing or execute trades when you are busy for you not to miss entries. Its a component of mixed confluence of strategies as it fit in my trading style

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)