Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 714
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi all, I've already asked a similar question on page 711, unfortunately no one has responded, maybe now someone...
I do this:
I bring the situation to zero cumulative position (locking), then close the lock.
Now, detailing.
1. Calculation of aggregate position:
Reverse orders
If we buy, our aggregate position is increased by the order lot.
If selling, the aggregate position is reduced by the order lot.
End of orders search cycle
2. Creating a Location:
if the aggregate position is above zero, we sell;
if the aggregate position is below zero, we will buy;
Otherwise, we do nothing.
The lot size is equal to the aggregate position.
3. Closing a lot (overlapped positions)
Endless loop ( while (true) )
Reset to zero the ticks of the buy and sell orders
loop over the orders
if (buy) commit the ticket for a buy order
if (sell) commit the sell order ticket
close the order loop
if( there is a sale and a buy) then a cross-close
otherwise exit the endless loop (break)
end of infinite loop
Now we program this algorithm in the selected language (MQL4)
guys, tell me if I set a closing time for a pending order
Data_1=iTime(Symbol(),PERIOD_D1,0) +86400; //the order life time
if it is already in the market (i.e. has already been executed),it will close or not
guys, tell me if I set a closing time for a pending order
Data_1=iTime(Symbol(),PERIOD_D1,0) +86400; //the order life time
if it is already in the market (i.e. has already been executed),it will close or not
no
Hi all, I've never worked with file operations but I had to and I can't figure it out.
The task is to write data into csv file several times every day
That is today 24.09.2014 data is written in a row in different cells of the type
A B C
1 Date | value | value
if today's data has changed, we overwrite the row from 24.09.2014
if it's a new day, we rewrite the new line.
I'm smoking and I can't get a smoke...
Hi all, I've never worked with file operations but I had to and I can't figure it out.
The task is to write data into csv file several times every day
That is today 24.09.2014 data is written in a row in different cells of the type
A B C
1 Date | value | value
if today's data has changed, we overwrite the line from 24.09.2014
if it's a new day, we rewrite the new line.
I'm smoking and I can't get a smoke...
Probably something like this.
and how do I rewrite the last line if the data has changed ?
how do I rewrite the last line if the data has changed ?
FileSeek(), help.
If the data have changed, we should put the pointer to the place where we will overwrite it with fileseek, overwrite it with standard filewrite... method, remember the end of the file and trim it with WinApi function
Or using standard method, write position to the end of file, where useful information ends, and then read this position. (You can write the position to another file).
But anyway, you'd better trim it, and there is no standard trimming tool ((
this isZhunko12.09.2014 20:19#
It would be interesting as WinApi functions
If the data have changed, we should put the pointer to the place where we will overwrite it with fileseek, overwrite it with standard filewrite... method, remember the end of the file and trim it with WinApi function
Or using standard method, write position to the end of file, where useful information ends, and then read this position. (You can write the position to another file).
But anyway, you'd better trim it, and there is no standard trimming tool ((
this isZhunko12.09.2014 20:19#
It would be interesting to have the same WinApi functions.
How sad, it's so complicated.