Here are the wonders of testing an EA program in MT5 (see picture-file)...Can there be positive eqivity with a negative balance ? and when is the balance negative ? Before turning to Trading Nation changed my mind a lot and never got around to it yet... I think it's time to get some sleep)
If anyone interested in the open code and set let me know ? - I will certainly post it. I have started to master MT5 with hedging and now, - miracles, though)
No miracles. I have an open position with large surplus and a closed position with a loss exceeding my balance. I am not losing because I have enough funds to maintain an open position.
Artyom Trishkin: There are no miracles. There are open positions with a large surplus, and there is a closed position with a loss greater than the size of the balance sheet. There's no downside because there are enough funds to maintain the open positions.
If I close as before, opposite one, it gets lacquered ))
Already tried everything, still gives error 2016.04.15 13:17:24 Core 1 2016.03.29 09:00:00 failed close position #64 buy 0.81 EURUSD by position #0 [Invalid request]
Which fields to fill and which ones not? I guess it doesn't matter if the position opened is short or long.
//+------------------------------------------------------------------+//| Закрытие позиции по типу |//+------------------------------------------------------------------+void PositionClose(double lot, int P_type,long id)
{
Print("Вход в функцию Закрытие позиции по типу !");
ZeroMemory(mrequest); ZeroMemory(mresult); // обнуляем значения mrequest, mresult//--- Получить текущее значение котировки в структуру типа MqlTickif(!SymbolInfoTick(_Symbol,latest_price))
{
Alert("Ошибка получения последних котировок - ошибка:",GetLastError(),"!!");
return;
}
//--- формируем торговый запрос
mrequest.action = TRADE_ACTION_CLOSE_BY; // закрыть позицию встречной
mrequest.order = id;
// mrequest.action = TRADE_ACTION_DEAL; // немедленное исполнение// mrequest.price = NormalizeDouble(latest_price.bid,_Digits); // последняя цена ask// mrequest.sl = 0; // Stop Loss// mrequest.tp = 0; // Take Profit
mrequest.symbol = _Symbol; // символ
mrequest.volume = lot; // количество лотов для торговли// mrequest.magic = MAGIC; // Magic Number// if (P_type == 0) mrequest.type = ORDER_TYPE_SELL; // проверяем тип позиции// if (P_type == 1) mrequest.type = ORDER_TYPE_BUY;
mrequest.type = ORDER_TYPE_CLOSE_BY;
mrequest.type_filling = ORDER_FILLING_FOK; // тип исполнения ордера - все или ничего
mrequest.deviation=10; // проскальзывание от текущей ценыif( OrderSend(mrequest,mresult)>0) // если значение отосланного ордера не ноль, то
{ if(mresult.retcode==10009 || mresult.retcode==10008)
Print(" позиция закрыта !");
} else {
Print(ResultRetcodeDescription(mresult.retcode));
return;
}
}
I am testing a multicurrency Expert Advisor and I would like to see in the visualizer all the windows on all currency pairs that are being traded.
In the visualizer help it is said about some command "Chart" in the "View" section of the visualizer main menu, which seems to be used to open new charts. But for some reason I don't have "Chart" command at all and, accordingly, I cannot open charts of additional pairs. What is the problem here ?
If I close as before, opposite one, it gets lacquered ))
Already tried everything, still gives error 2016.04.15 13:17:24 Core 1 2016.03.29 09:00:00 failed close position #64 buy 0.81 EURUSD by position #0 [Invalid request]
Which fields to fill and which ones not? As far as I understand, it does not matter whether the position is long or short.
ES 009:12:21.189 Trade 2016.04.1400:00:30 instant sell 0.01 EURUSD at 1.12728 (1.12728 / 1.12736 / 1.12728)
IL 009:12:21.189 Trades 2016.04.1400:00:30 deal #2 sell 0.01 EURUSD at 1.12728 done (based on order #2)
OP 009:12:21.189 Trade 2016.04.1400:00:30 deal performed [#2 sell 0.01 EURUSD at 1.12728]
NF 009:12:21.189 Trade 2016.04.1400:00:30 order performed sell 0.01 at 1.12728 [#2 sell 0.01 EURUSD at 1.12728]
GJ 009:12:21.192 TestEA (EURUSD,H1) 2016.04.1400:00:30 CTrade::OrderSend: instant sell 0.01 EURUSD at 1.12728 [done at 1.12728]
KH 009:12:21.192 Trade 2016.04.1400:00:31 instant buy 0.02 EURUSD at 1.12736 (1.12728 / 1.12736 / 1.12728)
OD 009:12:21.192 Trades 2016.04.1400:00:31 deal #3 buy 0.02 EURUSD at 1.12736 done (based on order #3)
GI 009:12:21.193 Trade 2016.04.1400:00:31 deal performed [#3 buy 0.02 EURUSD at 1.12736]
LM 009:12:21.193 Trade 2016.04.1400:00:31 order performed buy 0.02 at 1.12736 [#3 buy 0.02 EURUSD at 1.12736]
NS 009:12:21.193 TestEA (EURUSD,H1) 2016.04.1400:00:31 CTrade::OrderSend: instant buy 0.02 EURUSD at 1.12736 [done at 1.12736]
OP 009:12:21.193 TestEA (EURUSD,H1) 2016.04.1400:00:32 Вход в функцию Закрытие позиции по типу !
GI 009:12:21.193 Trade 2016.04.1400:00:32 close position #2 sell 0.01 EURUSD by position #3 buy 0.02 EURUSD (1.12728 / 1.12736 / 1.12728)
OM 009:12:21.193 Trades 2016.04.1400:00:32 deal #4 buy 0.01 EURUSD at 1.12736 done (based on order #4)
RK 009:12:21.193 Trades 2016.04.1400:00:32 deal #5 sell 0.01 EURUSD at 1.12728 done (based on order #4)
EF 009:12:21.193 TestEA (EURUSD,H1) 2016.04.1400:00:32 CTrade::OrderSend: unknown action 10 [done]
EI 009:12:21.423 Trade 2016.04.1423:59:59 position closed due end of test at 1.12663 [#3 buy 0.01 EURUSD 1.12736]
JG 009:12:21.423 Trades 2016.04.1423:59:59 deal #6 sell 0.01 EURUSD at 1.12663 done (based on order #5)
HN 009:12:21.423 Trade 2016.04.1423:59:59 deal performed [#6 sell 0.01 EURUSD at 1.12663]
IS 009:12:21.423 Trade 2016.04.1423:59:59 order performed sell 0.01 at 1.12663 [#5 sell 0.01 EURUSD at 1.12663]
Here are the wonders of testing an EA program in MT5 (see picture-file)...Can there be positive eqivity with a negative balance ? and when is the balance negative ? Before turning to Trading Nation changed my mind a lot and never got around to it yet... I think it's time to get some sleep)
If anyone interested in the open code and set let me know ? - I will certainly post it. I have started to master MT5 with hedging and now, - miracles, though)
There are no miracles. There are open positions with a large surplus, and there is a closed position with a loss greater than the size of the balance sheet. There's no downside because there are enough funds to maintain the open positions.
Can you please tell me what my mistake is.
for(int i=0;i<N_Sell;i++) printf("OpenSellTime[%d] = %G",i,TimeToString(OpenSellTime[i],TIME_DATE|TIME_MINUTES)," PriceOpenSell[%d] = %G",i,PriceOpenSell[i]);
The date from OpenSellTime array is not printed and not the second part of the expression - PriceOpenSell.
And, I can't find aboutprintf commandslike%G and%d.
Good afternoon All!)
This is a question for a dummy in programming...
I am trying to compile an EA for a new build. The compiler gives me lots of different errors...
Here is one of them
if(oppositedelete){delete( OP_SELLSTOP);delete( OP_SELLLIMIT);}
There are 2 errors marked in red in this code fragment:'(' - object pointer expected
Having read a bit about the subject of the error, I understood that the name is reserved and I must replace it...
So the question is what to replace it with?
Good afternoon All!)
This is a question for a dummy in programming...
I am trying to compile an EA for a new build. The compiler gives me lots of different errors...
Here is one of them
if(oppositedelete){delete( OP_SELLSTOP);delete( OP_SELLLIMIT);}
There are 2 errors marked in red in this code fragment:'(' - object pointer expected
Having read a bit about the subject of the error, I understood that the name is reserved and I must replace it...
So the question is what to replace it with?
There is this line in the code
Print (";OpenSellTime - ",TimeToString(OpenSellTime[N_Sell],TIME_DATE|TIME_MINUTES), ";PriceOpenSell", PriceOpenSell[N_Sell]);
Why do I get this text in the output:
OpenSellTime - 2015.12.01 11:15
where ";" and the second part is"PriceOpenSell"?
There is this line in the code
Print (";OpenSellTime - ",TimeToString(OpenSellTime[N_Sell],TIME_DATE|TIME_MINUTES), ";PriceOpenSell", PriceOpenSell[N_Sell]);
Why do I get this text in the output:
OpenSellTime - 2015.12.01 11:15
where is the ";" and the second part"PriceOpenSell"?
removed ";" - worked.
The question about printf remains...
How do I correctly send a request to close a counter position?
If I close as before, opposite one, it gets lacquered ))
Already tried everything, still gives error 2016.04.15 13:17:24 Core 1 2016.03.29 09:00:00 failed close position #64 buy 0.81 EURUSD by position #0 [Invalid request]
Which fields to fill and which ones not? I guess it doesn't matter if the position opened is short or long.
Hello, Question about the tester.
I am testing a multicurrency Expert Advisor and I would like to see in the visualizer all the windows on all currency pairs that are being traded.
In the visualizer help it is said about some command "Chart" in the "View" section of the visualizer main menu, which seems to be used to open new charts. But for some reason I don't have "Chart" command at all and, accordingly, I cannot open charts of additional pairs. What is the problem here ?
How do I correctly send a request to close a counter position?
If I close as before, opposite one, it gets lacquered ))
Already tried everything, still gives error 2016.04.15 13:17:24 Core 1 2016.03.29 09:00:00 failed close position #64 buy 0.81 EURUSD by position #0 [Invalid request]
Which fields to fill and which ones not? As far as I understand, it does not matter whether the position is long or short.
Use minimal code - use standard library:
Agent Log: