[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 934

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
Problem. Please advise.
In OrderSelect(0,SELECT_BY_POS,MODE_HISTORY)
The OrderProfit() returns the first profit in the history list,
how can I make it return the last profit in the history list?
I tried it this way:
A=OrdersHistoriTotal();
OrderSelect(A,SELECT_BY_POS,MODE_HISTORY);
OrderProfit() returns nothing at all)
)) but it is not working
Professionals, please advise how to fix the script. I use a script to export data
I get 5 files with data in the output. I want to get 1 file, which will contain data on the first instrument, then the second, etc. I can't get it all into one file... Thanks.
Professionals, please advise how to fix the script. I use a script to export data
The output is 5 files with data. I want to get 1 file, which will contain data on the first instrument, then the second, etc. I can't get it all into one file... Thanks.
Use file opening to read and write, move to the end of the file and add
FileOpen(fname,FILE_WRITE|FILE_READ);
FileSeek()
help you
Problem. Please advise.
In OrderSelect(0,SELECT_BY_POS,MODE_HISTORY)
The OrderProfit() returns the first profit in the history list,
how can I make it return the last profit in the history list?
I tried it this way:
A=OrdersHistoriTotal();
OrderSelect(A,SELECT_BY_POS,MODE_HISTORY);
OrderProfit() returns nothing at all)
)) but it is not working
So the last warrant has yet to be found. And which is the last one. By the opening or closing time. And, of course, do not forget which instrument to look for.
advise what to write in an EA for a hard limit the maximum volume of the transaction? it just decides which volume to open but sometimes opens a large volume and then go broke, I need to limit the maximum 0.5
If a person knew, he would have done it himself. But here it looks like you have to make changes to someone else's code
Thank you
extern double TP=20; // ТР для открываемого ордера
extern double Lot=0.01; // Жестко заданное колич. лотов
datetime time;
//--------------------------------------------------------------- 2 --
int start()
{
int Total;
double
M_0,
M_1;
bool
Ans =false, // Ответ сервера после закрытия
Cls_B=false, // Критерий для закрытия Buy
Cls_S=false, // Критерий для закрытия Sell
Opn_B=false, // Критерий для открытия Buy
Opn_S=false; // Критерий для открытия Sell
//--------------------------------------------------------------- 3 --
// Учёт ордеров
for(int i=OrdersTotal()-1;i>=0;i--)
if (OrderSelect(i,SELECT_BY_POS)&&OrderSymbol()==Symbol()&&OrderType()>1)Total++;
if(Total!=0 || time==Time[1])return;
// Торговые критерии
M_0=iOsMA(NULL,0,13,34,8,0,0); // 0 бар
M_1=iOsMA(NULL,0,13,34,8,0,1); // 1 бар
if (M_1<0 && M_0>0)
Opn_B=true;
if (M_1>0 && M_0<0)
Opn_S=true;
//--------------------------------------------------------------- 7 --
if (Opn_B)
{OrderSend(Symbol(),OP_BUY,Lot,Ask,0,Bid-SL*Point,Bid+TP*Point);time=Time[1];}
if (Opn_S)
{OrderSend(Symbol(),OP_SELL,Lot,Bid,0,Ask+SL*Point,Ask-TP*Point);time=Time[1];}
}
It's not working, maybe I need to change something here or put it after the start.
I tried to translate your code on paper into Russian I understand, but it doesn't work,
it's too complicated, especially when the conditions in each condition follow, and one condition out of eight conditions.
Of course I don't argue who created this code is a miracle, but for me it's a complete perversion (in a good way)
I am not lazy to add comments to each operation and condition, except for the standard function.