Limiting BIN files to a maxsize of lines per file

MQL4 Experts Scripts

Tâche terminée

Temps d'exécution 1 jour
Commentaires de l'employé
Friendly customer
Commentaires du client
Good job, straight to the point and honest.

Spécifications

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

Répondu

1
Développeur 1
Évaluation
(5)
Projets
7
29%
Arbitrage
1
0% / 100%
En retard
0
Gratuit
2
Développeur 2
Évaluation
(4)
Projets
4
0%
Arbitrage
1
0% / 100%
En retard
1
25%
Gratuit
3
Développeur 3
Évaluation
(6)
Projets
7
0%
Arbitrage
0
En retard
5
71%
Gratuit
4
Développeur 4
Évaluation
(1)
Projets
2
0%
Arbitrage
0
En retard
1
50%
Gratuit
5
Développeur 5
Évaluation
(82)
Projets
86
57%
Arbitrage
25
0% / 84%
En retard
19
22%
Gratuit
6
Développeur 6
Évaluation
(62)
Projets
140
46%
Arbitrage
19
42% / 16%
En retard
32
23%
Gratuit
7
Développeur 7
Évaluation
(7)
Projets
13
0%
Arbitrage
5
20% / 60%
En retard
0
Gratuit
Commandes similaires
I have a perfectly functioning indicator which draws lines and gives values for 3 moving averages. The modification consists in displaying the value of the previous bar of a higher timeframe and the delta in the data window. The actual indicator is Real-Multitimeframe, for example it displays the moving average of M15 on the level of M3 for each individual M3-bar. This is a task for very experienced coders only and
To check your qualifications, bidders must attempt the task below. write an ea in mql4 calling the attached indicator,printing the values of all buffers of the indicator. the compiled file(ex4) must work independent of the indicator. First three would be considered
Development of MT5 EA or Script For Account Load Calculation 1) Calculate Account Load based on Active positions and Set Stop losses 2) Calculate Account Load based on Pending orders 3) The EA Or Script will need a Simple Text and Edit box GUI to be used for communicating with user regarding load calculation parameters and results. 4) There Will Also be a text file used by both EA and User for communicating load
Looking for EA's that can pass prop firms Only message me if you are serious thank you https://t.me/ marketkillerrr Message me on tele^Gram thanks Or you can msg me here it doesn't matter please do not waste my time... Price is negotiable i can pay up to 30,000$
I hope this message finds you well. I am in search of a skilled developer to transform three indicators into a fully functional trading robot. These indicators consist of two MACD indicators, each displaying two colors (red and green), along with an arrow signal. Here are the specific requirements for the project: The robot should execute trades only when the arrow signal appears and both MACD indicators are
An expert is required based on a specific index of the market The expert does the following Opens 0.01 micro lot per $1000 A buy trade is opened if the indicator signal is buy and can be entered against the signal A sell trade is opened if the indicator signal is sell and can be entered against the signal A goal defined by the number of points Stop loss is limited to the number of pips Profit tracking Stop loss
Hello .I have existing Tradingview strategy that I will like to automate to Mt4 EA based on my specification . I need an expert in the field that have experience in both tradingview and MT4
I Want someone who can Create a Mobile EA Automatic Trading Bot system with My kind of trading style (BTMM) Beat The makert maker,which includes a bit of mixed strategies such as Smart money concept(SMC) and Market Maker Cycle(MMC),The Bot must be Able to Take short and long term trades only after Rejections/confirmations not when it's going against(to minimize/avoid blowing small Accounts),it must place Stoploss and
Hey I trust my request finds you well ❤️I need a well experienced MQL4 programmer who can pay attention to details and come up with ideas perfectly suited the needed based on my needs for trading mt4, reach out to collaborate now
Coder needed 30 - 45 USD
Hello, I am a trader and I trade on MT4/5 platform , but now I want to upgrade my trading so I need an expert who can code an Expert advisor EA for me with my strategy on MT4/MT5, so if you are an expert in coding I am expecting your response

Informations sur le projet

Budget
30 - 50 USD
TVA (18%): 5.4 - 9 USD
Total: 35.4 - 59 USD
Pour le développeur
27 - 45 USD
Délais
de 1 à 10 jour(s)