StopLimit - page 2

 
Sergey Chalyshev:

I gave you an example of the code above.

It should and will be exposed.

If it was opened by the market, there would be no problem in the tester, it would open at the Ask price. But it would be opened at a non-existent price, as you can see on the image above.

p.s. Just try the above code yourself on an exchange account

The miracles happen in the tester on the demo account. There you can see even more.

You have a stop order in the trade request above the price and the limit order below the level of the stop order. Whatever you say, I do not understand anything, but your parametersfor StopLimitorders are set in the way I told you:

Ask+100 stop order level,

level of the limit order Ask+10

The price will reach Ask+100, a Stop order will trigger and a Limit order will be set at the level of Ask-90.

Everything is exactly as I told you in your parameters.

What do you get from the demo openers - it's more likely to them. I've been getting glitches on them too.

 
Artyom Trishkin:
Wonders happen on a demo account. You can see much more than that there.

There are no miracles. Everything works as it should, both on demo and real and in BCS.

The miracles happen only in the strategy tester.

All the same - you have a stop order in the trade request above the price, and the limit order below the level of the stop order. Whatever you say I don't understand something, but your StopLimit order parameters are set as I told you.

In my example, the limit orderis higher than the stop order
 
Sergey Chalyshev:

There are no miracles. Everything works as it should, both on the demo and in BCS.

Miracles only in the strategy tester.

I have no miracles in the strategy tester with stoplites. Who among us doesn't understand what his hands are doing?

 
Artyom Trishkin:

Ask+100 stop order level,

Ask+10 limit order level

The price reaches Ask+100, a Stop order triggers and a Limit order is set at the level of Ask-90.

Everything is exactly as I told you in your parameters.

And what do you get from the demo openers - this is probably their problem. I have them, too, all glitches.

No, it is not:

Ask+10 stop order level,

the level of the limit order is Ask+100.


 
Artyom Trishkin:

I don't have miracles in the strategy tester with stoplimits. Who among us doesn't understand what his hands are doing?

of course you don't understand and don't want to try the example given ))
 
Artyom Trishkin:

The slippage is set by the deviation parameter in the trade request.

And the stoplimit level is the level at which the Limit order is set relative to the stop order level.

stoplimit
stop is the trigger for the market order,
limit is the slippage distance.

To set a limit order, the normal limit is used.
I understand that for this implementation, has a place, but not in SB.

 
Sergey Chalyshev:
Of course you don't understand and don't want to try this example ))

It's all about that +

and you are offered -

tick.ask+10*ticksise,         // цена стоплимита
 
Sergey Chalyshev:

There are no miracles. Everything works as it should, both on demo and real and in BCS.

This is only a miracle in the strategy tester.

In my example, the limit order is above the stop order level

Let's do the math:

//+------------------------------------------------------------------+
//|                                               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
      );
  }
//+------------------------------------------------------------------+

You have a 100. Right?

When placing a stop-limit order, you set the level for setting a stop order equal to Ask+100. Right?

You have set the level for the limit order (stoplimit) equal to Ask+10. Right? Right?

Which is higher: the current price Ask + 100 or the current price Ask + 10? Of course, the current price + 100.

Thus, you have set the BuyStopLimit pending order at the Ask+100 price, while the level for setting the Limit order is Ask+10 which is 90 less (lower) than the level for setting the stoplimit order.

As soon as the price reaches the level set for the StopLimit order, it will trigger. So what happens? A limit order will be placed at the price specified in the stoplimit parameter. And, in this parameter, it is90 times less (lower) than the price set for the StopLimit order.

And how did the limit order suddenly become higher than the stop order?

 
Roman:

It's all about that +

and you're being offered -

Don't give me suggestions))

I gave a concrete working example, there are no mistakes and typos in it, you just have to try it in the tester on an exchange account

 
Roman:

stoplimit
stop is the trigger for the market order,
limit is the slippage distance.

To set a limit order, the normal limit is used.
I understand that for this implementation, has a place, but not in SB.

Stunning knowledge...
Reason: