I wanted to drop a fixed number of time series values into an array, and then work with this array. I understood that for this purpose either to write a loop into the array via
iOpen
for example. Or copy and paste a piece of history into an array via CopyOpen for example. Do I understand correctly?
Wrote a script that fills an array with time series values.
If you take the data of the current chart symbol, everything is fine
But how to specify another symbol of the instrument?
It gives the error 'Symbol' - wrong parameters count
Read more carefully the help on the used functions.
The Symbol() function returns a string with the name of the current symbol. If you need another one, you can specify it either as a string literal or create a string variable with the desired name and pass it to the iOpen() function.
Read more carefully the help for the functions used.
The Symbol() function returns a string with the name of the current symbol. If another symbol is needed, we specify it either as a string literal or create a string variable with the desired name and pass it to the iOpen() function.
Thanks. I have read the help, but I haven't found an example of specifying another character. Thank you. I'd like to put your example directly into the help below.
Conditionally I want my code to start like this: if current time >=9:00, then I open a deal
Everything is almost ready, the code is partially there, the idea of how to do it is there, but on the implementation of the mind is not enough, help me
Hey, everybody. Help. I have written a function to calculate the profit of closed orders. It does not work in the tester. Please tell me what the problem is and where to look.
double History_Profit(datetime startTime)
{
double h_profit = 0.0;
ulong ticket;
HistorySelect(startTime, TimeCurrent()); // Выбор истории сделок в указанном диапазонеint total_h = HistoryDealsTotal(); // Общее количество сделок в истории// Цикл проходит по всем сделкам в историиfor(int i = total_h - 1; i >= 0; i--)
{
ticket = HistoryDealGetTicket(i); // Получение тикета сделкиif(ticket > 0)
{
// Получение символа, магического числа и прибыли сделкиstring dealSymbol = HistoryDealGetString(ticket, DEAL_SYMBOL);
long dealMagic = (long)HistoryDealGetInteger(ticket, DEAL_MAGIC);
double dealProfit = HistoryDealGetDouble(ticket, DEAL_PROFIT);
double dealCommission = HistoryDealGetDouble(ticket, DEAL_COMMISSION);
double dealSwap = HistoryDealGetDouble(ticket, DEAL_SWAP);
// Фильтрация сделок по символу и магическому числуif(dealSymbol == _Symbol && dealMagic == Magic)
{
// Суммирование прибыли, комиссии и свопа
h_profit += dealProfit + dealCommission + dealSwap;
}
}
}
return (h_profit); // Возврат общей прибыли
}
Robert Sadamon #: Hey, everybody. Help. I have written a function to calculate the profit of closed orders. It does not work in the tester. Please tell me what the problem is and where to look.
Hi. Where does the Magic variable get its value? Is it global?
Robert Sadamon #: Hey, everybody. Help. I have written a function to calculate the profit of closed orders. It does not work in the tester. Please tell me what the problem is and where to look.
You have it all wrong, besides, an order cannot be closed/open, it can be set/deleted.
I have written a script that fills an array with time series values.
If you take the data of the current chart symbol, everything is fine
But how to specify another symbol of the instrument?
It gives the error 'Symbol' - wrong parameters count
I wanted to drop a fixed number of time series values into an array, and then work with this array. I understood that for this purpose either to write a loop into the array via
iOpenfor example. Or copy and paste a piece of history into an array via CopyOpen for example. Do I understand correctly?
Wrote a script that fills an array with time series values.
If you take the data of the current chart symbol, everything is fine
But how to specify another symbol of the instrument?
It gives the error 'Symbol' - wrong parameters count
Read more carefully the help on the used functions.
The Symbol() function returns a string with the name of the current symbol. If you need another one, you can specify it either as a string literal or create a string variable with the desired name and pass it to the iOpen() function.
Read more carefully the help for the functions used.
The Symbol() function returns a string with the name of the current symbol. If another symbol is needed, we specify it either as a string literal or create a string variable with the desired name and pass it to the iOpen() function.
Thanks. I have read the help, but I haven't found an example of specifying another character. Thank you. I'd like to put your example directly into the help below.
Everything is almost ready, the code is partially there, the idea of how to do it is there, but on the implementation of the mind is not enough, help me
Hey, everybody. Help. I have written a function to calculate the profit of closed orders. It does not work in the tester. Please tell me what the problem is and where to look.
Hi. Where does the Magic variable get its value? Is it global?
Of course it is. It's in external variables.
Hey, everybody. Help. I have written a function to calculate the profit of closed orders. It does not work in the tester. Please tell me what the problem is and where to look.
You have it all wrong, besides, an order cannot be closed/open, it can be set/deleted.
A position can be closed.