Limiting BIN files to a maxsize of lines per file

MQL4 전문가 스크립트

작업 종료됨

실행 시간 1 일
피고용인의 피드백
Friendly customer
고객의 피드백
Good job, straight to the point and honest.

명시

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

응답함

1
개발자 1
등급
(5)
프로젝트
7
29%
중재
1
0% / 100%
기한 초과
0
무료
2
개발자 2
등급
(4)
프로젝트
4
0%
중재
1
0% / 100%
기한 초과
1
25%
무료
3
개발자 3
등급
(6)
프로젝트
7
0%
중재
0
기한 초과
5
71%
무료
4
개발자 4
등급
(1)
프로젝트
2
0%
중재
0
기한 초과
1
50%
무료
5
개발자 5
등급
(82)
프로젝트
86
57%
중재
25
0% / 84%
기한 초과
19
22%
무료
6
개발자 6
등급
(62)
프로젝트
140
46%
중재
19
42% / 16%
기한 초과
32
23%
무료
7
개발자 7
등급
(7)
프로젝트
13
0%
중재
5
20% / 60%
기한 초과
0
무료
비슷한 주문
I am looking for a developer to create a script for MetaTrader 4 (MT4) that automatically reconnects to my broker account when the connection is lost. The script should continuously monitor the connection status and reconnect without requiring manual intervention whenever the platform is active but disconnected. The goal is to maintain a stable and uninterrupted connection to my account. If possible, the solution
Hey there, interested in your services for merging 2 pinescripts into one Ninjatrader Strategy. I have attached both scripts below and both will be running on Renko Charts. I added entry examples in the attachment as well. For this, I would like to add some user-defined variables such as Stop Loss and Profit Targets, or allow it to sync with my ATM strategies. Please advise if this would be possible. Additional
I'm looking for a skilled developer to help build a custom trading strategy for NinjaTrader 8 (N8). The project involves developing and fine-tuning a strategy tailored to specific market conditions. Experience with NinjaScript, strategy optimization, and backtesting is highly preferred. If you're available and have expertise in N8 strategy development, please get in touch to discuss further details
I have a python script that connects MT5 to Deriv for binary trading which is having some bug. It stops executing trades after a while. I need someone to check the code and fix it. Negotiable price
I currently have a Forex trading script in .txt format that I want to be converted to a functional/working robot (in .mq4), without altering the strategy of the script. The strategy of the script is already in and shouldn't be changed unless with mutual understanding

프로젝트 정보

예산
30 - 50 USD
VAT (18%): 5.4 - 9 USD
총: 35.4 - 59 USD
개발자에게
27 - 45 USD
기한
에서 1  10 일