W testerze dostaję błąd wewnętrzny z kodem błędu 0 tylko w zamówieniach bocznych KUPUJ i nie sprzedawaj zamówień pobocznych.
2 pytania:
1. Co to jest błąd wewnętrzny związany z kodem błędu 0, który uważałem za błąd?
2. Dlaczego otrzymuję ten błąd tylko przy zamówieniach z zakupami?
Konkretny wydrukowany wynik to: Błąd podczas modyfikacji stopu i TP zamówienia zakupu !!! Kod błędu: 0 błąd wewnętrzny
co odpowiada pierwszej modyfikacji. O ile mogę powiedzieć, kod strony kupna jest poprawny.
Oto kod użyty dla poniższej funkcji ... kod może wydawać się zredukowany, jednak ma na celu upewnienie się, że twarde przystanki i twarde tps są wysyłane i wysyłane po tym, jak zamówienie zostało wypełnione dla brokerów typu ecnSTP.
Wstawiony kod void set_stop_tp () {int totalorders = OrdersTotal (); for (int i = totalorders-1; igt; = 0; i--) {if (! OrderSelect (i, SELECT_BY_POS)) {Print (TimeToStr (TimeCurrent (), TIME_SECONDS), CHECK Funkcja gt;, __FUNCTION__, !! !!!, Error code =, GetLastError ()); } int result; int sprawdzić; {//Modyfikuj Stop i TP na serwerze, jeśli nie podczas Wprowadzania Zamówienia, jeśli (((OrderStopLoss () == 0) || (OrderTakeProfit () == 0)) (OrdersTotal () gt; 0) (UseHardStop == true) ) {RefreshRates ();/Zmodyfikuj zarówno SL, jak i TP, jeśli nie zostały jeszcze ustawione, jeśli ((OrderType () == OP_BUY) (OrdersTotal () gt; 0) (OrderSymbol () == Trade) ((OrderStopLoss () == 0) (OrderTakeProfit ( ) == 0))) result = OrderModify (OrderTicket (), OrderOpenPrice (), OrderOpenPrice () - HardStop, OrderOpenPrice () HardTP, 0,0); check = GetLastError (); if (check! = 0) {Print (Błąd podczas modyfikacji stopu i TP zamówienia zakupu !!! Kod błędu:, GetLastError (),, ErrorDescription (check)); } if ((OrderType () == OP_SELL) (OrdersTotal () gt; 0) (OrderSymbol () == Trade) ((OrderStopLoss () == 0) (OrderTakeProfit () == 0))) result = OrderModify ( OrderTicket (), OrderOpenPrice (), OrderOpenPrice () HardStop, OrderOpenPrice () - HardTP, 0,0); check = GetLastError (); if (check! = 0) {Print (Błąd podczas modyfikacji stopu i TP zamówienia sprzedaży !!! Kod błędu:, GetLastError (),, ErrorDescription (check)); }/Modyfikuj TP tylko jeśli nie jest ustawione, jeśli ((OrderType () == OP_BUY) (OrdersTotal () gt; 0) (OrderSymbol () == Trade) ((OrderStopLoss ()! = 0) (OrderTakeProfit () = = 0))) result = OrderModify (OrderTicket (), OrderOpenPrice (), OrderStopLoss (), OrderOpenPrice () HardTP, 0,0); check = GetLastError (); if (check! = 0) {Print (Błąd podczas modyfikacji TP zamówienia zakupu !!! Kod błędu:, GetLastError (),, ErrorDescription (check)); } if ((OrderType () == OP_SELL) (OrdersTotal () gt; 0) (OrderSymbol () == Trade) ((OrderStopLoss ()! = 0) (OrderTakeProfit () == 0))) result = OrderModify ( OrderTicket (), OrderOpenPrice (), OrderStopLoss (), OrderOpenPrice () - HardTP, 0,0); check = GetLastError (); if (check! = 0) {Print (Błąd podczas modyfikacji TP zamówienia sprzedaży !!! Kod błędu:, GetLastError (),, ErrorDescription (check)); }/Modyfikuj SL tylko jeśli nie jest ustawione, jeśli ((OrderType () == OP_BUY) (OrdersTotal () gt; 0) (OrderSymbol () == Trade) ((OrderStopLoss () == 0) (OrderTakeProfit ()! = 0))) result = OrderModify (OrderTicket (), OrderOpenPrice (), OrderOpenPrice () - HardStop, OrderTakeProfit (), 0,0); check = GetLastError (); if (check! = 0) {Print (Błąd podczas modyfikacji Stop of Buy Order !!! Kod błędu:, GetLastError (),, ErrorDescription (check)); } if ((OrderType () == OP_SELL) (OrdersTotal () gt; 0) (OrderSymbol () == Trade) ((OrderStopLoss () == 0) (OrderTakeProfit ()! = 0))) result = OrderModify ( OrderTicket (), OrderOpenPrice (), OrderOpenPrice () HardStop, OrderTakeProfit (), 0,0); check = GetLastError (); if (check! = 0) {Print (Błąd podczas modyfikacji Stop of Sell Order !!! Kod błędu:, GetLastError (),, ErrorDescription (check)); }}
Kod przesyłany poza polem kodu FF:
*****************************
void set_stop_tp ()
{
int totalorders = OrdersTotal ();
for (int i = totalorders-1; igt; = 0; i--)
{
if (! OrderSelect (i, SELECT_BY_POS)) {
Drukuj (TimeToStr (TimeCurrent (), TIME_SECONDS), CHECK Funkcja gt;, __FUNCTION__, !!!!!, Error code =, GetLastError ()); }
int wynik;
int sprawdzić;
{
//Zmodyfikuj Stop i TP na serwerze, jeśli nie podczas wprowadzania Zamówienia
if (((OrderStopLoss () == 0) || (OrderTakeProfit () == 0)) (OrdersTotal () gt; 0) (UseHardStop == true)) {RefreshRates ();
//Zmodyfikuj zarówno SL, jak i TP, jeśli obie nie zostały jeszcze ustawione
if ((OrderType () == OP_BUY) (OrdersTotal () gt; 0) (OrderSymbol () == Trade) ((OrderStopLoss () == 0) (OrderTakeProfit () == 0)))
result = OrderModify (OrderTicket (), OrderOpenPrice (), OrderOpenPrice () - HardStop, OrderOpenPrice () HardTP, 0,0);
check = GetLastError ();
if (check! = 0) {Print (Błąd podczas modyfikacji stopu i TP zamówienia zakupu !!! Kod błędu:, GetLastError (),, ErrorDescription (check)); }
if ((OrderType () == OP_SELL) (OrdersTotal () gt; 0) (OrderSymbol () == Trade) ((OrderStopLoss () == 0) (OrderTakeProfit () == 0)))
result = OrderModify (OrderTicket (), OrderOpenPrice (), OrderOpenPrice () HardStop, OrderOpenPrice () - HardTP, 0,0);
check = GetLastError ();
if (check! = 0) {Print (Błąd podczas modyfikacji stopu i TP zamówienia sprzedaży !!! Kod błędu:, GetLastError (),, ErrorDescription (check)); }
//Modyfikuj TP tylko, jeśli jeszcze nie zostało ustawione
if ((OrderType () == OP_BUY) (OrdersTotal () gt; 0) (OrderSymbol () == Trade) ((OrderStopLoss ()! = 0) (OrderTakeProfit () == 0)))
result = OrderModify (OrderTicket (), OrderOpenPrice (), OrderStopLoss (), OrderOpenPrice () HardTP, 0,0);
check = GetLastError ();
if (check! = 0) {Print (Błąd podczas modyfikacji TP zamówienia zakupu !!! Kod błędu:, GetLastError (),, ErrorDescription (check)); }
if ((OrderType () == OP_SELL) (OrdersTotal () gt; 0) (OrderSymbol () == Trade) ((OrderStopLoss ()! = 0) (OrderTakeProfit () == 0)))
result = OrderModify (OrderTicket (), OrderOpenPrice (), OrderStopLoss (), OrderOpenPrice () - HardTP, 0,0);
check = GetLastError ();
if (check! = 0) {Print (Błąd podczas modyfikacji TP zamówienia sprzedaży !!! Kod błędu:, GetLastError (),, ErrorDescription (check)); }
//Modyfikuj SL tylko, jeśli nie jest jeszcze ustawione
if ((OrderType () == OP_BUY) (OrdersTotal () gt; 0) (OrderSymbol () == Trade) ((OrderStopLoss () == 0) (OrderTakeProfit ()! = 0)))
result = OrderModify (OrderTicket (), OrderOpenPrice (), OrderOpenPrice () - HardStop, OrderTakeProfit (), 0,0);
check = GetLastError ();
if (check! = 0) {Print (Błąd podczas modyfikacji Stop of Buy Order !!! Kod błędu:, GetLastError (),, ErrorDescription (check)); }
if ((OrderType () == OP_SELL) (OrdersTotal () gt; 0) (OrderSymbol () == Trade) ((OrderStopLoss () == 0) (OrderTakeProfit ()! = 0)))
result = OrderModify (OrderTicket (), OrderOpenPrice (), OrderOpenPrice () HardStop, OrderTakeProfit (), 0,0);
check = GetLastError ();
if (check! = 0) {Print (Błąd podczas modyfikacji Stop of Sell Order !!! Kod błędu:, GetLastError (),, ErrorDescription (check)); }
}