Limiting BIN files to a maxsize of lines per file

MQL4 Experts Scripts

Trabalho concluído

Tempo de execução 1 dia
Comentário do desenvolvedor
Friendly customer
Comentário do cliente
Good job, straight to the point and honest.

Termos de Referência

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

Respondido

1
Desenvolvedor 1
Classificação
(5)
Projetos
7
29%
Arbitragem
1
0% / 100%
Expirado
0
Livre
2
Desenvolvedor 2
Classificação
(4)
Projetos
4
0%
Arbitragem
1
0% / 100%
Expirado
1
25%
Livre
3
Desenvolvedor 3
Classificação
(6)
Projetos
7
0%
Arbitragem
0
Expirado
5
71%
Livre
4
Desenvolvedor 4
Classificação
(1)
Projetos
2
0%
Arbitragem
0
Expirado
1
50%
Livre
5
Desenvolvedor 5
Classificação
(82)
Projetos
86
57%
Arbitragem
25
0% / 84%
Expirado
19
22%
Livre
6
Desenvolvedor 6
Classificação
(62)
Projetos
140
46%
Arbitragem
19
42% / 16%
Expirado
32
23%
Livre
7
Desenvolvedor 7
Classificação
(7)
Projetos
13
0%
Arbitragem
5
20% / 60%
Expirado
0
Livre
Pedidos semelhantes
Id Like to have a web based trading journal where i can import MT4/5, excel sheet or manual input. This page will require uses to register There has to be a performance dashboard of the journal
Please I have been going through some ideas and have come up with something I want to build something similar to this https://www.youtube.com/watch?v=ts4ux3Sr55Y . Please I need someone who can handle this for me .. share your idea and let’s get started
I need someone who can help me with a simple strategy for live execution on Ninja Trader: Basically if 2 candle ago is red and the previous candle close is higher than the high of 2 candles ago, go long at the open of 2 candles ago. Stop loss is at the low of 2 candles ago or last candle whatever is lower Target is 1RR : distance between entry and stop loss + entry so for example if entry is at 4010 and stop loss is
Hello, I'm currently seeking a skilled developer to assist me in the creation of a trading Bot, my first futures trading bot tailored specifically for the Binance platform. This is envisioned to automate trading activities, providing efficient execution of trading strategies while aiming to optimize profit potential and manage risk effectively
Hello! Following the interval bar specified in the Ninjatrader chart, I need to extract the following data from any of my Ninjatrader charts: date, time, instrument, OHCL, volume, and ALL INDICATOR PLOTS in REAL TIME. The indicator ought to function in a minimum of thirty future instruments. The anticipated outcome is a programming application to transfer those data from Ninhatrader to Python. Professionals alone are
I am looking for a skilled developer to create a custom indicator for NinjaTrader based on the Percentage Hughes Breadth-Momentum Oscillator formula. The formula is as follows: Percentage Hughes Breadth-Momentum Oscillator = (H × 100 ) + 100 = ( A − D A +D + U × 100 ) + 100 Percentage Hughes Breadth-Momentum Oscillator = ( H × 100 ) + 100=( A −D A + D+ U ​ , × 100 ) + 100 where: H represents today’s 1-day ratio of
I need a reliable programmer to have a look at my mql4 and mql5 trading script, this is my new strategy on Metatrader, I need thorough testing to ensure whether it work perfectly or not, I would like to have an expert in the field, I mean someone that's absolutely skilled in trading and developing trading robot, all I need is testing this bot and give best advise to ensure optimal trading performance before making
I'm looking for someone to code a trade copier copying trades locally from MT5 to NT8. Trades are going to be placed through an EA and manually (both limit and market orders) on mt5 and needs to replicate onto NinjaTrader 8. I need fast execution on the trade copy. I should be able to add multiple slave accounts (NinjaTrader). Sound alerts should be available when orders are successful or something went wrong like

Informações sobre o projeto

Orçamento
30 - 50 USD
IVA (18%): 5.4 - 9 USD
Total: 35.4 - 59 USD
Desenvolvedor
27 - 45 USD
Prazo
de 1 para 10 dias