[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 521

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
How would I check it?
Thank you.
Is it possible to make the MaxEquity setting work for example 500 times without restarting the EA?
For example, if I write 500 in the counter, let it be as follows: Suppose the initial equity is 10 000,
After adding to the initial equity of 10,000 (by specifying in the settings), large deficits will close.
It will be done 500 times (for example) (it is anyway impossible to multiply the initial equity 500 times).
That is the difference will turn out with your version - that after increments of 10 000 to the initial equity = 10 000 -
The EA does not need to be restarted, and the cycle will continue - to 20 000 more 10 000 will be added, to 30 000 + 10 000 and so on 500 times ( for example). Well
and after each increment = 10 000, the losing order with the biggest minus ( or several orders - to be specified in the settings) will be closed ?
Thank you.
Is it possible to make MaxEquity setting work for example 500 times without restarting the EA?
For example, if I write 500 in the counter, let it work like this: Suppose the initial equity is 10 000,
After adding to the initial equity of 10,000 (by specifying in the settings), the big drawbacks will close.
In the same way, let's say 500 times (for example) (after all, it is impossible to multiply the initial equity 500 times).
In other words, the difference will appear in your version: after adding 10 000 to the initial equity = 10 000.
The Expert Advisor does not need to be restarted, and the cycle will continue - to 20 000 will be added 10 000, to 30 000 + 10 000 and so on 500 times ( for example). For example:
And, after each increment equal to 10 000, the losing order with the biggest loss will be closed (or several losing orders, if you specify so in the settings) ?
There is no need to do any restarts. You need to update the initial equity data after closing the positions and wait for the equity to increase from the new initial equity.
But as I understand it, it's all done in programming code. I don't have the power of programming.)
Naturally. There is only one function that will continuously monitor equity and send a command to close unprofitable positions if the specified value is exceeded. Then, after all of the positions are closed successfully, the new equity status must be recorded and continued to monitor it.
Can you tell me what the problem might be?
I'm assuming that my question doesn't contain enough information to help me.) I will complete my question. Below I provide a structure with the main functions of my Expert Advisor. Maybe this will reveal the problem that I have outlined.
At the moment I have to recompile the EA every time after enabling/disabling the money management function in EA parameters, for the report to be generated correctly.
P.S. Maybe it has something to do with global variable terminal fxprop_lot?
I assume, that there is not enough information in my question to help me). I'll supplement my question. Below I am providing structure with basic functions of my EA. Maybe in this way it will be possible to identify the problem, which I have highlighted.
At the moment I have to recompile the EA every time after enabling/disabling the money management function in EA parameters for the report to be generated correctly.
P.S. Maybe it has something to do with global variable terminalfxprop_lot?
If you think that's enough, I guess it is. I just have to wait for an answer. I don't have one.
If you think that is enough, I guess so. I am waiting for an answer. I do not have one.
And in the next post the report generation function...My experience so far unfortunately does not allow me to judge whether or not the information provided is sufficient to address a particular issue. I don't do it on purpose and apologise if you do.) The thing is, in my opinion, the key point in the problem I highlighted is that everything works correctly when recompiling the Expert Advisor. But this again due to my immature experience. Please advise what information needs to be provided to resolve this issue. The money management function or report generation function obviously appears in the problem. That is why I will give you the money management function:
void Short_Trade_Report(int Mgc_Src_LP_TS№1,int Mgc_LP01_TS№1,int Mgc_LP02_TS№1,int Mgc_LP03_TS№1,int Mgc_LP04_TS№1,int Mgc_LP05_TS№1,int Mgc_LP06_TS№1, int Mgc_Src_SP_TS№1,int Mgc_SP01_TS№1,int Mgc_SP02_TS№1,int Mgc_SP03_TS№1,int Mgc_SP04_TS№1,int Mgc_SP05_TS№1,int Mgc_SP06_TS№1, int Mgc_Src_LP_TS№2,int Mgc_LP01_TS№2,int Mgc_LP02_TS№2,int Mgc_LP03_TS№2,int Mgc_LP04_TS№2,int Mgc_LP05_TS№2,int Mgc_LP06_TS№2, int Mgc_Src_SP_TS№2,int Mgc_SP01_TS№2,int Mgc_SP02_TS№2,int Mgc_SP03_TS№2,int Mgc_SP04_TS№2,int Mgc_SP05_TS№2,int Mgc_SP06_TS№2, int Mgc_Src_LP_TS№3,int Mgc_LP01_TS№3,int Mgc_LP02_TS№3,int Mgc_LP03_TS№3,int Mgc_LP04_TS№3,int Mgc_LP05_TS№3,int Mgc_LP06_TS№3, int Mgc_Src_SP_TS№3,int Mgc_SP01_TS№3,int Mgc_SP02_TS№3,int Mgc_SP03_TS№3,int Mgc_SP04_TS№3,int Mgc_SP05_TS№3,int Mgc_SP06_TS№3) { #define RA 10000 // Range Array - Размер массива для отчёта double Acc_Bal_Close[RA]; // Массив для баланса на закрытии сделки(-ок) double Acc_Bal_Open[RA]; // Массив для баланса на открытии сделки(-ок) double Price_Open_Pos[RA]; double Price_Stop_Loss[RA]; double TS№1_DS[RA], TS№2_TA[RA], TS№3_SBH[RA]; int pos, handle, dgt, Magic, sign, index; double Swap_P; double Profit_P; double Commission; double Open_Price; double Stop_Loss; string Type_Pos; string comment; string Str_Stop_Loss; //--- ПРОВЕРКА НА КОЛ-ВО ЗНАКОВ В СИМВОЛЕ ДЛЯ РАСЧЁТА ОТСТУПА В СТРОКАХ КОММЕНТАРИЕВ --------------------------------// int digit_string; int digit = MarketInfo(Symbol(),MODE_DIGITS); switch(digit) { case 2 : digit_string = 4; dgt = 100; break; case 3 : digit_string = 5; dgt = 100; break; case 4 : digit_string = 6; dgt = 10000; break; case 5 : digit_string = 7; dgt = 10000; break; default: Print("Неизвестный символ! Количество знаков = ",digit); return(0); } handle = FileOpen("ShortReport.csv",FILE_CSV|FILE_WRITE); if(handle > 0) //1 { FileWrite(handle,"Time Close"+","+"Symbol"+","+"Type"+","+"Lots"+","+"Balance($)"+","+"Stop Loss(p)"+","+"Profit(p)"+","+"TS#1_DS(p)"+","+"TS#2_TA(p)"+","+"TS#3_SBH(p)"); for(pos = 0; pos < OrdersHistoryTotal(); pos++) // 2 { OrderSelect(pos,SELECT_BY_POS,MODE_HISTORY); Commission = OrderCommission(); Swap_P = (OrderSwap()/10)/OrderLots(); Profit_P = (OrderProfit()/10)/OrderLots()+(OrderSwap()/10)/OrderLots(); Open_Price = NormalizeDouble(OrderOpenPrice(),Digits); index = StringFind(OrderComment(),"[sl]",0); if(index != -1) { comment = StringSubstr(OrderComment(),0,StringLen(OrderComment())-4); } else { comment = StringSubstr(OrderComment(),0,StringLen(OrderComment())); } if(OrderType() < 2 && OrderCloseTime() == TimeCurrent() && (OrderMagicNumber() == Mgc_Src_LP_TS№1 || OrderMagicNumber() == Mgc_Src_SP_TS№1 || OrderMagicNumber() == Mgc_LP01_TS№1 || OrderMagicNumber() == Mgc_LP02_TS№1 || OrderMagicNumber() == Mgc_LP03_TS№1 || OrderMagicNumber() == Mgc_LP04_TS№1 || OrderMagicNumber() == Mgc_LP05_TS№1 || OrderMagicNumber() == Mgc_LP06_TS№1 || OrderMagicNumber() == Mgc_SP01_TS№1 || OrderMagicNumber() == Mgc_SP02_TS№1 || OrderMagicNumber() == Mgc_SP03_TS№1 || OrderMagicNumber() == Mgc_SP04_TS№1 || OrderMagicNumber() == Mgc_SP05_TS№1 || OrderMagicNumber() == Mgc_SP06_TS№1)) { TS№1_DS[pos] = Profit_P + Swap_P + Commission; Acc_Bal_Close[pos] = AccountBalance(); Str_Stop_Loss = StringSubstr(comment,StringLen(comment)-digit_string,digit_string); Price_Stop_Loss[pos] = MathAbs((StrToDouble(Str_Stop_Loss)-Open_Price)*dgt); } if(OrderType() < 2 && OrderCloseTime() == TimeCurrent() && (OrderMagicNumber() == Mgc_Src_LP_TS№2 || OrderMagicNumber() == Mgc_Src_SP_TS№2 || OrderMagicNumber() == Mgc_LP01_TS№2 || OrderMagicNumber() == Mgc_LP02_TS№2 || OrderMagicNumber() == Mgc_LP03_TS№2 || OrderMagicNumber() == Mgc_LP04_TS№2 || OrderMagicNumber() == Mgc_LP05_TS№2 || OrderMagicNumber() == Mgc_LP06_TS№2 || OrderMagicNumber() == Mgc_SP01_TS№2 || OrderMagicNumber() == Mgc_SP02_TS№2 || OrderMagicNumber() == Mgc_SP03_TS№2 || OrderMagicNumber() == Mgc_SP04_TS№2 || OrderMagicNumber() == Mgc_SP05_TS№2 || OrderMagicNumber() == Mgc_SP06_TS№2)) { TS№2_TA[pos] = Profit_P + Swap_P + Commission; Acc_Bal_Close[pos] = AccountBalance(); Str_Stop_Loss = StringSubstr(comment,StringLen(comment)-digit_string,digit_string); Price_Stop_Loss[pos] = MathAbs((StrToDouble(Str_Stop_Loss)-Open_Price)*dgt); } if(OrderType() < 2 && OrderCloseTime() == TimeCurrent() && (OrderMagicNumber() == Mgc_Src_LP_TS№3 || OrderMagicNumber() == Mgc_Src_SP_TS№3 || OrderMagicNumber() == Mgc_LP01_TS№3 || OrderMagicNumber() == Mgc_LP02_TS№3 || OrderMagicNumber() == Mgc_LP03_TS№3 || OrderMagicNumber() == Mgc_LP04_TS№3 || OrderMagicNumber() == Mgc_LP05_TS№3 || OrderMagicNumber() == Mgc_LP06_TS№3 || OrderMagicNumber() == Mgc_SP01_TS№3 || OrderMagicNumber() == Mgc_SP02_TS№3 || OrderMagicNumber() == Mgc_SP03_TS№3 || OrderMagicNumber() == Mgc_SP04_TS№3 || OrderMagicNumber() == Mgc_SP05_TS№3 || OrderMagicNumber() == Mgc_SP06_TS№3)) { TS№3_SBH[pos] = Profit_P + Swap_P + Commission; Acc_Bal_Close[pos] = AccountBalance(); Str_Stop_Loss = StringSubstr(comment,StringLen(comment)-digit_string,digit_string); Price_Stop_Loss[pos] = MathAbs((StrToDouble(Str_Stop_Loss)-Open_Price)*dgt); } if(OrderType() == OP_BUY) { Type_Pos = "buy"; } if(OrderType() == OP_SELL) { Type_Pos = "sell"; } if(OrderType() < 2) { FileWrite(handle,TimeToStr(OrderCloseTime(),TIME_DATE|TIME_MINUTES)+","+Symbol()+","+Type_Pos+"," +DoubleToStr(OrderLots(),2)+","+DoubleToStr(Acc_Bal_Close[pos],2)+","+DoubleToStr(Price_Stop_Loss[pos],2)+"," +DoubleToStr(Profit_P+Swap_P+Commission,2)+","+DoubleToStr(TS№1_DS[pos],2)+","+DoubleToStr(TS№2_TA[pos],2)+","+DoubleToStr(TS№3_SBH[pos],2)); } } FileClose(handle); // 2\ } //1 }
Please help in resolving the issue.Tried calling the capital management function during initialisation:
But that doesn't solve the problem...