Typical mistakes and how to deal with them when dealing with the trading environment - page 8

 
fxsaber:

The recipe, as they say, is universal:

  1. Met a market order with zero ID - exit immediately.
  2. MT5-OrderSend is rewritten to return always non-zero Result.deal - the source code was posted in KB.
  3. After each OrderSend or Sleep send to step 1.
With this approach any (absolute 100%) TC will work.

And this is not what I'm talking about?

Sometimes people have a strange perception of information :)

Only not exit immediately at order with zero ID, but its processing on the same tick - some kind of predefined expectation.

The rest is everything I was talking about. Turns out it's the bottom :)))

 

To think about the adequacy of their TOR. A real situation that happens every day on MT4

  1. Nothing is open.
  2. You have placed BuyLimit and then no OrderSend.
  3. After a while you have found 3 BUY-positions and BuyLimit.
  4. After a while you detect 2 BUY-positions and BuyLimit.
  5. In a while you have 5 BUY positions.
  6. In a while you need to detect 1 BUY position.
  7. After some time you detect point 1.

This is the easiest. Therefore, the proposed template contains

// Находит позицию соответствующего типа
bool PositionsScan( const string Symb, const ENUM_POSITION_TYPE Type );
Well, and what level of resilience TC to write and for whom - everyone decides for himself.
 
fxsaber:

  1. Nothing has been opened.
  2. You set a BuyLimit and then no OrderSend.
  3. After a while you have 3 BUY positions and BuyLimit.
  4. After a while you have 2 BUY positions and BuyLimit.
  5. In a while you need to close 5 BUY positions.
  6. In a while you need to detect 1 BUY position.
  7. After a certain period of time you detect point 1.

So BuyLimit is an EA position. The others are manual.

Any TS can distinguish between its own and other's positions.

The conversation was about their own positions.

 
Artyom Trishkin:

So BuyLimit is the one set by the adviser. The others are manual.

Any TS can distinguish between its own and someone else's.

The conversation was about their positions.

Nothing manually or by another Expert Advisor. Only one BuyLimit is exposed. All mentioned BUY positions have the same magic as BuyLimit.

 
fxsaber:

Nothing manually or by another advisor. Only one BuyLimit is set. All BUY positions mentioned have the same magic number as BuyLimit.

So - partial execution.

 
Artyom Trishkin:

So - partial performance.

Just that.

 
fxsaber:

Influence QB to stop posting code with bugs, I think it would be worth it.

 
Artyom Trishkin:

Only not to exit immediately on an order with zero ID, but to process it on the same tick - some sort of set wait.

Yes, exiting immediately is not a good solution.

 
Comments not related to this topic have been moved to "Any questions from newbies on MQL4, help and discussion on algorithms and codes".
 
Ivan Ivanov:


2018.02.20 15:20:35.845 Trades order #66745055 buy 0.01 / 0.01 EURUSDeur at market done in 610.625 ms

2018.02.20 15:20:35.935 Trades deal #5461453 buy 0.01 EURUSDeur at 1.23403 done (based on order #66745055)

2018.02.20 15:20:35.845 TestBUY (EURUSDeur,M15) retcode=10009 deal=0 order=66745055

If the request is met (10009) , why deal=0

Good afternoon!

I have a similar question for everyone and especially for fxsaber.
At first glance it seems like a primitive question, but I can't find an answer to it.
Here https://www.mql5.com/ru/forum/6343/page939 I was told "Try to search for it. fxsaber has been working on this problem for a while now. What worked out, I don't know, I'm not interested." So I decided to ask you.

The question is this. I opened position and want to print the content of MqlTradeResult:

        MqlTradeRequest request={0};
        MqlTradeResult  result={0};
        
        request.action   = TRADE_ACTION_DEAL;    // type of trade operation
        request.symbol   = Pair1;                // symbol
        request.volume   = lots;                 // volume of lot
        request.type     = oper;                 // order type
        request.price    = priceOpen;            // price for opening
        request.deviation= Slippage;             // allowed deviation from the price
        request.magic    = magic;   
 //============================================================     
        if(OrderSend(request,result))       
        Print ("retcode = " +IntegerToString (result.retcode) + "; ");        
        Print ("deal = " +IntegerToString (result.deal) + "; ");
        Print ("order = " +IntegerToString (result.order) + "; "); 
        Print ("volume = " +DoubleToString (result.volume) + "; ");  
        Print ("price = " +DoubleToString (result.price) + "; ");

retcode, order and volume are printed, but deal and price are always zeros.
Please, tell me what I'm doing wrong and how to get access (at least, print it first) to the content of result structure?

Вопросы от начинающих MQL5 MT5 MetaTrader 5
Вопросы от начинающих MQL5 MT5 MetaTrader 5
  • 2018.10.29
  • www.mql5.com
Подскажите пожалуйста, такой показатель тестера в жизни реален? И хороший это или плохой результат за год с депо 3000...
Reason: