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
空闲
相似订单
My strategy is very simple. I need someone who c an write this code for robot trading. this strategy is not very complex it is very simple. hope anyone will accept it
Looking to create a way to detect break of structure and market structure shift using the zigzag indicator. The script will look back a number of bars and plot all BOS and MSS
"I am seeking a skilled developer proficient in both TradingView and NinjaTrader 8 platforms to convert my trading strategies from TradingView Pine Script to NinjaScript. The ideal candidate should have experience in algorithmic trading and be able to accurately translate the logic and indicators used in TradingView to NinjaTrader 8. This conversion will enable me to execute my strategies seamlessly on the
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'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

项目信息

预算
30 - 50 USD
VAT (18%): 5.4 - 9 USD
总计: 35.4 - 59 USD
开发人员
27 - 45 USD
截止日期
 1  10 天