StopLimit - page 6

 

A post-break, available price squeeze at the opening of the day's session, the next day.
It's a squeeze like that, at the opening of the market.
The only confusion is why the execution was not at bid price.
I have a suspicion that the quotes of the depth gauge in the tester are either lying or the quotes are curved.
Has the simulation by real ticks been selected?

In real trading, usually the first 1-5 minutes from market opening are missed.
Otherwise there will be such squeezes, at the first available price, and volatility with a crazy spread.
For this reason, before the market closes, for example at 23.40, remove all of your stoplimit orders.
And allow placing orders after 10.01 with control of the spread.

You have a stoplimit order that was issued yesterday and it bumps at market opening when there is no liquidity.
Why have you set the limit of 100 ticks? Put a limit of 5 ticks for entry.


 
Dmitry Fedoseev:

That's why you draw strange conclusions - out of laziness. I don't need it, you need it to understand what is going on.

The last price on the chart was on December 2 at 23:48. The logs show order execution on the 3rd at 10. What is this?

Once again, I do not need it, I have understood everything for a long time. Do you really not understand or are you just pretending?

Thechart on December 2 at 23:48 is not the last price, it is the timeline, that's how the terminal works ))))))))))))


 
Sergey Chalyshev:

Once again, I don't need this, I've understood it all for a long time. Do you really not understand or are you just pretending?

Onthe December 2nd chart at 23:48 is not the last price, it's the timeline, that's how the terminal works ))))))))))))


A very profound expression: 23:48 is not the price.

Well... I'm off... I'll try not to interfere in your topics anymore.

 
Dmitry Fedoseev:

A very profound expression: 23:48 is not the price.

Well... I'm off... I'll try not to interfere in your threads anymore.

Dimitri, don't stray too far and intervene on the case ))

You help sometimes, and have personally helped me understand some of the issues.

Do you want me to give you a login and password to my trading account? Only on condition: not to drain much and not to change the password.

 
Sergey Chalyshev:

Dimitri, don't stray too far and intervene on the case ))

You help sometimes, and have personally helped me to understand some issues.

Do you want me to give you login and password to my trading account? Only on condition: not to drain much and not to change the password.

Yeah. I would try a couple of orders in the tester as well.

 
Dmitry Fedoseev:

Yeah. I'd try a couple of orders in the tester too.

I'll write to you in person

 
Sergey Chalyshev:

Apparently no one uses it,

the order is opened at non-existent prices:

A simple example to check:

//+------------------------------------------------------------------+
//|                                               StopLimit_Test.mq5 |
//+------------------------------------------------------------------+
#include <Trade\Trade.mqh>
CTrade trade;

input int Deviation = 100;
//+------------------------------------------------------------------+
void OnTick()
  {
   MqlTick tick;
   SymbolInfoTick(_Symbol,tick);
   trade.SetTypeFilling(ORDER_FILLING_RETURN);
   double ticksise=SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE);

   if(OrdersTotal()==0)
      trade.OrderOpen(
         _Symbol,                      // символ
         ORDER_TYPE_BUY_STOP_LIMIT,    // тип ордера
         1.0,                          // объем ордера
         tick.ask+Deviation*ticksise,  // цена исполнения
         tick.ask+10*ticksise,         // цена стоплимита
         0,                            // цена stop loss
         0                             // цена take profit
      );
  }
//+------------------------------------------------------------------+

And here is the actual problem: the stoploom price and limit are mixed up. Actually, the limit_price parameter is mixed up first, and then the price. Therefore, if you set a buy-stop-limit, price should be higher than limit_price. But in the code from the quote on the contrary, the first trigger occurs at the close price tick.ask+10*ticksise and the bylite appears somewhere up there (above the market price) and it immediately triggers.

But in the tester at the beginning of the testing period the price goes down so I checked with a stoplimit, this kind of code works fine:

void OnTick()
  {

   static int x=0;
   
   if(x==1)return;
   
   x=1;
  

   MqlTick tick;
   SymbolInfoTick(_Symbol,tick);
   trade.SetTypeFilling(ORDER_FILLING_RETURN);
   double ticksise=SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE);

   if(OrdersTotal()==0){
      Comment(GetTickCount()," ",ticksise);
      trade.OrderOpen(
         _Symbol,                      // символ
         ORDER_TYPE_SELL_STOP_LIMIT,    // тип ордера
         1.0,                          // объем ордера
         tick.bid-100*ticksise,  // цена исполнения
         tick.bid-1000*ticksise,         // цена стоплимита
         0,                            // цена stop loss
         0                             // цена take profit
      );
   }

  }

after the first trigger the limit appears...

 
Dmitry Fedoseev:

Here's the actual problem: the stoploom price and limit are mixed up. In fact, the limit_price parameter is first and then the price. Therefore, if you set a buy-stop-limit, price should be higher than limit_price. But in the code from the quote on the contrary, the first trigger occurs at the close price tick.ask+10*ticksise and the bylite appears somewhere up there (above the market price) and it immediately triggers.

But in the tester at the beginning of the testing period the price goes down so I checked with a stoplimit, this kind of code works fine:

after the first trigger the limit appears...

Nothing is mixed up in my example, BuyLimit is set higher than Ask and it should be executed at Ask and not at the price that is specified in BuyLimit.

Read the whole branch again, tired to explain.

Try to set the BuyLimit above the Ask without the StopLimit.

Just replaceORDER_TYPE_BUY_STOP_LIMIT byORDER_TYPE_BUY_LIMIT .

BuyLimit is triggered adequately at Ask price, and in case of BuyStopLimit inadequately at the price specified inBuyLimit.

 
Sergey Chalyshev:

In my example nothing is mixed up, BuyLimit is placed above Ask and it should be executed at Ask, not at the price that is specified in BuyLimit.

Read the whole branch again, tired to explain.

Try to set the BuyLimit above the Ask without the StopLimit.

Just replaceORDER_TYPE_BUY_STOP_LIMIT by ORDER_TYPE_BUY_LIMIT .

BuyLimit is triggered adequately at the Ask price, while in case of BuyStopLimit it is triggered inadequately at the price specified inBuyLimit.

It is clear now.

 

A stop limit order can be checked in the tester for Forex as well. It is enough to set "Execution" = Exchange.



I checked the buy stop limit as follows: I set the price of the limit order worse than the activation price. The order opened at market price (ask price) on activation. So, it seems that the functionality in the tester works.