And than sense of the given line?
if(_BuyTotal > handle)As I understand, sense of variable _BuyTotal - quantity of the open positions, and handle - the index of a file. These are absolutely different characteristics
There can be you meant the following?
if(_BuyTotal > value)
hi, scriptong. thanks to reply
still have problem, mean total come 2. this 'value' is always change 2 or 0 repeat again
print(_BuyTotal > value); <<i try to print the record as this script above, always change 2 > 2, 2 > 0, 2 > 2, 2 > 0...
if(_BuyTotal > value)
and
print(_BuyTotal > handle); the totals is come 2, and buytt.dat record 2, but handle only get 1. if(2 > 1)?
if(_BuyTotal > handle)
can anyone help, what wrong with it?
egt520
still have problem, mean total come 2. this 'value' is always change 2 or 0 repeat again
print(_BuyTotal > value); <<i try to print the record as this script above, always change 2 > 2, 2 > 0, 2 > 2, 2 > 0...
if(_BuyTotal > value)
and
print(_BuyTotal > handle); the totals is come 2, and buytt.dat record 2, but handle only get 1. if(2 > 1)?
if(_BuyTotal > handle)
can anyone help, what wrong with it?
egt520
int handle;
int value;
handle=FileOpen("buytt.dat",FILE_CSV|FILE_READ,';');
if(handle>0)
{
value=FileReadNumber(handle);
Print(_BuyTotal," > ",value);
Comment("BUY ",value);
FileClose(handle);
}
if(_BuyTotal > handle)
{
handle=FileOpen("buytt.dat", FILE_CSV|FILE_WRITE, ';');
FileWrite(handle, _BuyTotal);
FileClose(handle);
Comment("A ",_BuyTotal," > ",value);
} else {Comment("B ",_BuyTotal," > ",value);
if(_BuyTotal == 0)
{Comment("C ",_BuyTotal," > ",value);
handle=FileOpen("buytt.dat", FILE_CSV|FILE_WRITE, ';');
FileWrite(handle, _BuyTotal);
FileClose(handle);
}
}
what relations between handle and orders count?
i want use if buytotals decrease one and close all order.
if(buytotals > handle) true to close order.
in buytt.dat file already record 2, mean handle is give we 2, but the handle still give 1 in the record?
here the picture
if(buytotals > handle) true to close order.
in buytt.dat file already record 2, mean handle is give we 2, but the handle still give 1 in the record?
here the picture
int _GetLastError = 0; for ( int z = OrdersTotal() - 1; z >= 0; z -- ) { if ( !OrderSelect( z, SELECT_BY_POS ) ) { _GetLastError = GetLastError(); Print( "OrderSelect( ", z, ", SELECT_BY_POS ) - Error #", _GetLastError ); continue; } if ( OrderMagicNumber() == magic && OrderSymbol() == Symbol() ) { switch ( OrderType() ) { case OP_BUY: _BuyTicket = OrderTicket(); _BuyTotal ++; break; } } } int handle; int value; handle=FileOpen("buytt.txt",FILE_CSV|FILE_READ,';'); if(handle>0) { value=FileReadNumber(handle); Print(_BuyTotal," > ",handle); Comment("BUY ",_BuyTotal," > ",handle); FileClose(handle); } if(_BuyTotal > handle) { handle=FileOpen("buytt.txt", FILE_CSV|FILE_WRITE, ';'); FileWrite(handle, _BuyTotal); FileClose(handle); Comment("A ",_BuyTotal," > ",handle); } else {Comment("B ",_BuyTotal," > ",handle); if(_BuyTotal == 0) {Comment("C ",_BuyTotal," > ",handle); handle=FileOpen("buytt.txt", FILE_CSV|FILE_WRITE, ';'); FileWrite(handle, _BuyTotal); FileClose(handle); }
handle value does not depend on data in file. Use GlobalVariable its easier and
more conveniently
_BuyTotal is responsible for quantity of orders which at you is equal to 2. This number also writing in a file.
At the same time variable handle always equal to 1, as the file at you is used one. Explain more particularly,
that should do the resulted piece of a code and then we can help you
Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
https://docs.mql4.com/files/FileClose
I just want a simple write-in and read-out of total buy and sell in data memory hold, but i still get no ball above site.
I try to write simple and test, many problem in below.