If, for example, 10 years the profit on a trading account was 500% (figures are notional) - how to calculate the average annual profit, also taking into account that all profits are reinvested? Thank you!
frixer: Hello everyone, Happy New Year. I can't find any way to place an order only once, if the condition is fulfilled after which the order is placed, then if there is an order for the second time it will not be placed. I would like to give you an example.
If, for example, 10 years the profit on a trading account was 500% (figures are notional) - how to calculate the average annual profit, also taking into account that all profits are reinvested? Thank you!
The square root of 6, then subtract 1 and multiply by 100. You get 19.62% per year.
I read it but it does not work with my algorithm and i still have orders on every tick.
//+------------------------------------------------------------------+//| trade v1.mq4 |//| |//| frixer@yandex.ru |//+------------------------------------------------------------------+//--- input parameters//extern int Время;//extern int Input;//extern int SL;//extern int TP;//+------------------------------------------------------------------+//| expert initialization function |//+------------------------------------------------------------------+int init()
{
//----//----return(0);
}
//+------------------------------------------------------------------+//| expert deinitialization function |//+------------------------------------------------------------------+int deinit()
{
//----//----return(0);
}
//+------------------------------------------------------------------+//| expert start function |//+------------------------------------------------------------------+int start()
{
//----int bars = 9; // количество баровint gmt = 16; // время входаdoubleinput = 0.0010; // вход на рынокdouble sl = 100; // уровень SL от высоты коробки в %double tp = 100;
int lot=1;
int topOrder,bottomOrder;
if (Hour()==gmt) // проверяем свечу
{
double Shift_high = iHighest(NULL,PERIOD_H1,MODE_HIGH,bars,0); //поиск бара с максимальной ценой из bars начиная с 0-го бараdouble Shift_low = iLowest (NULL,PERIOD_H1,MODE_LOW ,bars,0); //поиск бара с минимальной ценой из bars начиная с 0-го бараdouble Price_high = iHigh (NULL,PERIOD_H1,Shift_high); // присвоение переменной максимального значение ценыdouble Price_low = iLow (NULL,PERIOD_H1,Shift_low); // присвоение переменной минимального значение ценыdouble Hinput = Price_high + input; // вверхняя граница входаdouble Linput = Price_low - input; // нижняя граница входаdouble height_box = Price_high - Price_low; // высота коробки barsdouble volumeSL = height_box / 100 * sl; // уровень SL зависит от %
topOrder=OrderSend(Symbol(),OP_BUYSTOP,lot,Hinput,3,Price_high-(height_box/100*sl),Price_high+(height_box/100*tp),"BUY",16384,0,Green);
if (topOrder<0)
{
Print("Верхний ордер ошибка #", GetLastError());
return(0);
}
}
//----return(0);
//----return(0);
}
//+------------------------------------------------------------------+
I have tried it this way (my friend has advised me) but it does not work.
int Orerov=0;
int Orderov_all = OrdersTotal(); // всего ордеров в терминалеfor (int n = 0;n<Orderov_all;n++) // начало цикла перебора ордеров
{
if(OrderSelect(n,SELECT_BY_POS)==TRUE) // выбран первый в списке ордерif(Comm == OrderComment()) // условие совпадения комментария
{
Tip= OrderType(); // тип
Cena=NormalizeDouble(OrderOpenPrice(),4); // цена
Ticket= OrderTicket(); // тикет
Stop=NormalizeDouble(OrderStopLoss(),4); // стоп-лосс
LOT=NormalizeDouble(OrderLots(),1); // размер лота
Orderov=1; //
}
}
frixer: Hello everyone, Happy New Year. I can not make an order be placed only once, if the condition is fulfilled after which the order is placed, I need it then, if there is an order for the second time it will not be placed. If you can give an example.
if (OrdersTotal() > 0) {
return(0);
}
// Если установлен хоть один ордер, то никакой код после этого комментария уже не выполнится
The main problem is that iBars does not load prices of periods other than the current one...
all MQL tricks like IndicatorCounted and RefreshRates
only work for the current period, i.e. iBars takes from the history and the history is only loaded by changing the period on the chart. What to do? Does MQL have some tool for loading bars of other periods (different from the current one) in the background?
The main problem is that iBars does not load prices for a period other than the current...
Your main problem is that iBars loads not prices, but the number of known bars for a given period. And, as I have just checked, it does it quite correctly both in the tester and on the chart.
If, for example, 10 years the profit on a trading account was 500% (figures are notional) -
how to calculate the average annual profit, also taking into account that all profits are reinvested?
Thank you!
Hello everyone, Happy New Year. I can't find any way to place an order only once, if the condition is fulfilled after which the order is placed, then if there is an order for the second time it will not be placed. I would like to give you an example.
The example from the textbook is your case.
If, for example, 10 years the profit on a trading account was 500% (figures are notional) -
how to calculate the average annual profit, also taking into account that all profits are reinvested?
Thank you!
The example from the tutorial is your case.
I read it but it does not work with my algorithm and i still have orders on every tick.
I have tried it this way (my friend has advised me) but it does not work.
Hello everyone, Happy New Year. I can not make an order be placed only once, if the condition is fulfilled after which the order is placed, I need it then, if there is an order for the second time it will not be placed. If you can give an example.
The root of the tenth power of 6, then subtract 1 and multiply by 100. We get 19.62% per year.
Thank you!
Anyway, here's the question,
I have a multi-period indicator.
In order to optimize the calculations, I use the following loop
// TimeFrames[i] массив с периодами
for (i=0; i<NumTimeFrames; i++)
{if (total_bars[i] != iBars(instrument, TimeFrames[i]) )
{
// тут вычисления индиктора
total_bars[i] = iBars(instrument, TimeFrames[i]);
}
}
The main problem is that iBars does not load prices of periods other than the current one...
all MQL tricks like IndicatorCounted and RefreshRates
only work for the current period, i.e. iBars takes from the history and the history is only loaded by changing the period on the chart. What to do? Does MQL have some tool for loading bars of other periods (different from the current one) in the background?
p.s. hope I'm not rambling ((The main problem is that iBars does not load prices for a period other than the current...