It turns out that to avoid redundancy in 99% of cases you must still write all code manually...
Well, I'm talking about adequate balance, and you can't avoid redundancy in TRANSFORM code at all. I stopped on such a matryoshka of 3 structures
struct ORDER {
double d_Price;
double d_Lot;
double d_Profit;
string s_Comment;
datetime t_Time;
int i_Ticket;
int i_Op_Type;
};
struct ORDERS_GROUP {
double d_Lots_Total; // сумма лотовdouble d_Profit_Total; // суммарная прибыльdouble d_BreakEven_Price; // уровень б/у
ORDER o_Lowest; // параметры нижнего ордера
ORDER o_Highest; // параметры верхнего ордера
ORDER o_Oldest; // параметры старейшего ордера
ORDER o_Newest; // параметры новейшего ордераint i_Orders_Total; // кол-во ордеров
};
struct ALL_ORDERS {
int i_Orders_Total; // кол-во ордеровdouble d_Lots_Total; // сумма лотовdouble d_Profit_Total; // суммарная прибыльdouble d_BreakEven_Price; // уровень б/уdouble d_One_Point_Price; // прибыль одного пунктаdatetime t_Data_Collected; // время последнего обновления данныхbool b_Changed; // была операция после последнего обновления данных?
ORDERS_GROUP o_Buy; // сводка данных ордеров Buy
ORDERS_GROUP o_Sell; // сводка данных ордеров Sell
ORDERS_GROUP o_Buy_Stop; // сводка данных ордеров BuyStop
ORDERS_GROUP o_Sell_Stop; // сводка данных ордеров SellStop
ORDERS_GROUP o_Buy_Limit; // сводка данных ордеров BuyLimit
ORDERS_GROUP o_Sell_Limit; // сводка данных ордеров SellLimit
ORDERS_GROUP o_Market; // сводка данных рыночных ордеров
ORDERS_GROUP o_Pendings; // сводка данных отложенных ордеров
};
ALL_ORDERS go_Orders;
It is filled in during one pass, it is updated when the bot makes a transaction or the number of orders changes. The redundancy is on the edge here, I think. It is enough for me in 90% of cases but it doesn't solve your problem; you need a separate function
Dmitry Fedoseev: Suppose the second highest price order goes first, it is stored in price_max, then the first order is overwritten by price_max and the second order is lost,
no, we do not lose the second order; the maximum order is written first
if(op>price_max) // Самый верхний ордер
{
price_max=op;
m_tick_upper=tc;
}
If the second order is higher, it is overwritten if it is lower, then the second condition works
Well, I'm talking about adequate balance, and you can't avoid redundancy in TRANSFORMAL code altogether. I settled on such a matrix of 3 structures
It is filled in during one pass, updated when the bot makes a deal or the number of orders changes. The redundancy here is too much for me in 90% of cases but it doesn't solve your problem; you need a separate function
So, you put two structures in a third ...
Your method of filling all structures is interesting ...
There is no quicker way. If you want faster, you need to think about the whole EA algorithm, maybe you can get rid of the need to look for two low, two high on every tick.
I must admit that your method of searching for orders is more stable than mine in some cases, now I'm running tests and depending on the order opening position your method works without errors... My method does not work correctly in some cases...
Vladimir Pastushak: I must admit that your method of finding orders is more stable than mine in some cases, now I'm doing tests and depending on the order opening position your method works without errors... My method does not work correctly in some cases...
I'm not OTK:) Test on orders in the tester or on a demo account.
What is QA ?
It turns out that to avoid redundancy in 99% of cases you must still write all code manually...
Well, I'm talking about adequate balance, and you can't avoid redundancy in TRANSFORM code at all. I stopped on such a matryoshka of 3 structures
It is filled in during one pass, it is updated when the bot makes a transaction or the number of orders changes. The redundancy is on the edge here, I think. It is enough for me in 90% of cases but it doesn't solve your problem; you need a separate function
Suppose the second highest price order goes first, it is stored in price_max, then the first order is overwritten by price_max and the second order is lost,
no, we do not lose the second order; the maximum order is written first
If the second order is higher, it is overwritten if it is lower, then the second condition works
the ticket is checked, if it is not the maximum but the top one, then it is the top one before the maximum one.
Well, I'm talking about adequate balance, and you can't avoid redundancy in TRANSFORMAL code altogether. I settled on such a matrix of 3 structures
It is filled in during one pass, updated when the bot makes a deal or the number of orders changes. The redundancy here is too much for me in 90% of cases but it doesn't solve your problem; you need a separate function
So, you put two structures in a third ...
Your method of filling all structures is interesting ...
There is no quicker way. If you want faster, you need to think about the whole EA algorithm, maybe you can get rid of the need to look for two low, two high on every tick.
I must admit that your method of finding orders is more stable than mine in some cases, now I'm doing tests and depending on the order opening position your method works without errors... My method does not work correctly in some cases...
I wrote about this yesterday. Depends on which order was opened.
I wrote about this yesterday. Depends on the order in which you opened it.