Discussion of article "The checks a trading robot must pass before publication in the Market" - page 23

 
I don't understand why the working robot doesn't skip I translated all comments into English as it gave an error and after all this it gave this kind of error

test on EURUSD,H1 (netting) 2022.02.01 09:36:20 failed instant sell 1 EURUSD at 0.00000 sl: 1.12832 tp: 1.12078 [Invalid price] 2022.02.01 09:37:40 failed instant sell 1 EURUSD at 0.00000 sl: 1.12837 tp: 1.12081 [Invalid price] 2022.02.01 09:37:59 failed instant sell 1 EURUSD at 0.00000 sl: 1.12836 tp: 1.12080 [Invalid price] 2022.02.01 09:38:00 failed instant sell 1 EURUSD at 0.00000 sl: 1.12837 tp: 1.12081 [Invalid price] 2022.02.01 09:38:20 failed instant sell 1 EURUSD at 0.00000 sl: 1.12836 tp: 1.12080 [Invalid price] 2022.02.01 09:41:40 failed instant sell 1 EURUSD at 0.00000 sl: 1.12847 tp: 1.12057 [Invalid price] 2022.02.01 09:41:59 failed instant sell 1 EURUSD at 0.00000 sl: 1.12847 tp: 1.12057 [Invalid price] 2022.02.01 09:42:00 failed instant sell 1 EURUSD at 0.00000 sl: 1.12847 tp: 1.12057 [Invalid price] 2022.02.01 09:44:40 failed instant sell 1 EURUSD at 0.00000 sl: 1.12850 tp: 1.12060 [Invalid price] 2022.02.01 09:44:59 failed instant sell 1 EURUSD at 0.00000 sl: 1.12847 tp: 1.12057 [Invalid price] 2022.02.01 09:45:00 failed instant sell 1 EURUSD at 0.00000 sl: 1.12848 tp: 1.12058 [Invalid price] 2022.02.01 17:43:40 failed instant sell 1 EURUSD at 0.00000 sl: 1.13007 tp: 1.11921 [Invalid price] 2022.02.01 17:44:40 failed instant sell 1 EURUSD at 0.00000 sl: 1.13014 tp: 1.11928 [Invalid price] 2022.02.01 17:44:59 failed instant sell 1 EURUSD at 0.00000 sl: 1.13014 tp: 1.11928 [Invalid price] 2022.02.01 17:45:00 failed instant sell 1 EURUSD at 0.00000 sl: 1.13016 tp: 1.11930 [Invalid price] 2022.02.01 17:45:40 failed instant sell 1 EURUSD at 0.00000 sl: 1.13000 tp: 1.11908 [Invalid price] 2022.02.01 17:45:59 failed instant sell 1 EURUSD at 0.00000 sl: 1.13003 tp: 1.11911 [Invalid price] 2022.02.01 17:46:00 failed instant sell 1 EURUSD at 0.00000 sl: 1.13005 tp: 1.11913 [Invalid price] 2022.02.01 17:46:20 failed instant sell 1 EURUSD at 0.00000 sl: 1.13000 tp: 1.11908 [Invalid price] 2022.02.01 17:59:40 failed instant sell 1 EURUSD at 0.00000 sl: 1.13003 tp: 1.11911 [Invalid price] 2022.02.01 17:59:59 failed instant sell 1 EURUSD at 0.00000 sl: 1.13020 tp: 1.11928 [Invalid price] there are no trading operations

it can't be possible that the trading robot can't open a trade as I personally use this robot and here it is!!!!
 

Please help me, I don't understand what's cause my validation to show like this, if I understand the problem, I will know where to fix my code. Thanks

Validator show error

 
Mean Pichponreay #:

Please help me, I don't understand what's cause my validation to show like this, if I understand the problem, I will know where to fix my code. Thanks


Hi, you need to check positions for Margin Stop Out and close positions before Stop Out.

ACCOUNT_MARGIN_SO_SO

 
Nauris Zukas #:

Hi, you need to check positions for Margin Stop Out and close positions before Stop Out.

ACCOUNT_MARGIN_SO_SO

Thank you so much sir, let's me try to fix now.

 
I'm facing the same problem. No matter what I try, nothing seems to work. I've even implemented a mock trading mechanism in my Expert Advisor (EA), but that hasn’t resolved the issue. I hope someone can help us figure out how to bypass this error while still maintaining our EA trading strategy.
 

I really need help—I'm stuck here with a 'no trading operation' error. I would appreciate any advice or assistance on how to fix my code so that I can resolve this issue. I've attempted several shortcuts, but no matter what I do, I keep encountering this error.





Files:
Capture.PNG  20 kb
 

Hi, I am trying to upload an EA, but I always get the same error

test on EURUSD,H1 (hedging)
 2022.02.03 15:40:40   failed modify #11 buy 0.55 EURUSD sl: 1.12910, tp: 1.13310 -> sl: 1.13260, tp: 1.13310 [Invalid stops]
 2022.02.03 15:40:59   failed modify #11 buy 0.55 EURUSD sl: 1.12910, tp: 1.13310 -> sl: 1.13225, tp: 1.13310 [Invalid stops]
 2022.02.03 15:41:00   failed modify #11 buy 0.55 EURUSD sl: 1.12910, tp: 1.13310 -> sl: 1.13225, tp: 1.13310 [Invalid stops]
 2022.02.03 15:41:20   failed modify #11 buy 0.55 EURUSD sl: 1.12910, tp: 1.13310 -> sl: 1.13240, tp: 1.13310 [Invalid stops]
 2022.02.03 15:41:40   failed modify #11 buy 0.55 EURUSD sl: 1.12910, tp: 1.13310 -> sl: 1.13155, tp: 1.13310 [Invalid stops]
 2022.02.03 15:41:59   failed modify #11 buy 0.55 EURUSD sl: 1.12910, tp: 1.13310 -> sl: 1.13210, tp: 1.13310 [Invalid stops]
 2022.02.03 15:42:00   failed modify #11 buy 0.55 EURUSD sl: 1.12910, tp: 1.13310 -> sl: 1.13210, tp: 1.13310 [Invalid stops]
 2022.02.03 15:42:20   failed modify #11 buy 0.55 EURUSD sl: 1.12910, tp: 1.13310 -> sl: 1.13210, tp: 1.13310 [Invalid stops]
 2022.02.08 09:13:40   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.14035, tp: 1.13945 [Invalid stops]
 2022.02.08 09:13:59   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.14055, tp: 1.13945 [Invalid stops]
 2022.02.08 09:14:00   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.14055, tp: 1.13945 [Invalid stops]
 2022.02.08 09:14:20   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.14065, tp: 1.13945 [Invalid stops]
 2022.02.08 09:14:40   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.14030, tp: 1.13945 [Invalid stops]
 2022.02.08 09:14:59   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.14035, tp: 1.13945 [Invalid stops]
 2022.02.08 09:15:00   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.14035, tp: 1.13945 [Invalid stops]
 2022.02.08 09:15:20   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.14040, tp: 1.13945 [Invalid stops]
 2022.02.08 09:15:40   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.13985, tp: 1.13945 [Invalid stops]
 2022.02.08 09:15:59   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.14025, tp: 1.13945 [Invalid stops]
 2022.02.08 09:16:00   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.14025, tp: 1.13945 [Invalid stops]
 2022.02.08 09:16:20   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.14025, tp: 1.13945 [Invalid stops]
 2022.02.08 09:16:40   failed modify #21 sell 0.55 EURUSD sl: 1.14345, tp: 1.13945 -> sl: 1.14050, tp: 1.13945 [Invalid stops]
strategy tester report 100 total trades

I run the same test locally but I don't get any errors. What could be happening to cause these errors? 

2025.02.01 11:34:52.756 2022.02.03 15:40:26   Ticket #4#  
2025.02.01 11:34:52.756 2022.02.03 15:40:26   new stopLoss: 1.1313000000000002
2025.02.01 11:34:52.756 2022.02.03 15:40:26   position modified [#4 buy 0.55 EURUSD 1.13081 sl: 1.13130 tp: 1.13280]
2025.02.01 11:34:52.758 2022.02.03 15:40:26   CTrade::OrderSend: modify position #4 EURUSD (sl: 1.13130, tp: 1.13280) [done]
2025.02.01 11:34:52.759 2022.02.03 15:40:27   Ticket #4#  
2025.02.01 11:34:52.759 2022.02.03 15:40:27   new stopLoss: 1.1314000000000002
2025.02.01 11:34:52.759 2022.02.03 15:40:27   position modified [#4 buy 0.55 EURUSD 1.13081 sl: 1.13140 tp: 1.13280]
2025.02.01 11:34:52.761 2022.02.03 15:40:27   CTrade::OrderSend: modify position #4 EURUSD (sl: 1.13140, tp: 1.13280) [done]
2025.02.01 11:34:52.763 2022.02.03 15:40:28   Ticket #4#  
2025.02.01 11:34:52.763 2022.02.03 15:40:28   new stopLoss: 1.13145
2025.02.01 11:34:52.763 2022.02.03 15:40:28   position modified [#4 buy 0.55 EURUSD 1.13081 sl: 1.13145 tp: 1.13280]
2025.02.01 11:34:52.765 2022.02.03 15:40:28   CTrade::OrderSend: modify position #4 EURUSD (sl: 1.13145, tp: 1.13280) [done]
2025.02.01 11:34:52.765 2022.02.03 15:40:28   Ticket #4#  
2025.02.01 11:34:52.765 2022.02.03 15:40:28   new stopLoss: 1.13155
2025.02.01 11:34:52.767 2022.02.03 15:40:28   position modified [#4 buy 0.55 EURUSD 1.13081 sl: 1.13155 tp: 1.13280]
2025.02.01 11:34:52.769 2022.02.03 15:40:28   CTrade::OrderSend: modify position #4 EURUSD (sl: 1.13155, tp: 1.13280) [done]
2025.02.01 11:34:52.770 2022.02.03 15:40:29   Ticket #4#  
2025.02.01 11:34:52.770 2022.02.03 15:40:29   new stopLoss: 1.1316000000000002
2025.02.01 11:34:52.770 2022.02.03 15:40:29   position modified [#4 buy 0.55 EURUSD 1.13081 sl: 1.13160 tp: 1.13280]
2025.02.01 11:34:52.772 2022.02.03 15:40:29   CTrade::OrderSend: modify position #4 EURUSD (sl: 1.13160, tp: 1.13280) [done]
 
Francisco Jesus Alonso Martin #:

Hi, I am trying to upload an EA, but I always get the same error

I run the same test locally but I don't get any errors. What could be happening to cause these errors? 

Ok, I have solved it, I had to check the stop levels against the price.

 

Hello, me again.

I only have one error left but I can't find the solution to this one.

test on XAUUSD,D1 (hedging)
 2022.07.12 04:30:40   current account state: Balance: 1126.50, Credit: 0.00, Commission: 0.00, Accumulated: 0.00, Assets: 0.00, Liabilities: 0.00, Equity 1126.50, Margin: 0.00, FreeMargin: 1126.50
 2022.07.12 04:30:40   calculated account state: Assets: 0.00, Liabilities: 0.00, Equity 1126.50, Margin: 1132.76, FreeMargin: -6.26
 2022.07.12 04:30:40   not enough money for order [#7 buy stop 0.65 XAUUSD at 1742.70]
strategy tester report 13 total trades

I am always checking the margin I have before doing any buy or sell with this method:

bool checkMoneyForTrade(string symb,double lots,ENUM_ORDER_TYPE type) {
//--- Getting the opening price
    MqlTick mqltick;
    SymbolInfoTick(symb,mqltick);
    double price = mqltick.ask;
    if(type == ORDER_TYPE_SELL)
        price = mqltick.bid;
//--- values of the required and free margin
    double margin,free_margin = AccountInfoDouble(ACCOUNT_MARGIN_FREE);
    //--- call of the checking function
    if(!OrderCalcMargin(type,symb,lots,price,margin)) {
        //--- something went wrong, report and return false
        Print("Error in ",__FUNCTION__," code=",GetLastError());
        return(false);
    }
    //--- if there are insufficient funds to perform the operation
    if(margin > free_margin || free_margin < 0) {
        //--- report the error and return false
        Print("Not enough money for ",EnumToString(type)," ",lots," ",symb," Error code=",GetLastError());
        return(false);
    }
//--- checking successful
    return(true);
}
 

 got error in validation process that i cant find that when i got back test on mqlf5 on that date no error in my terminal

no error