Errors, bugs, questions - page 619

 
-Alexey-:

I am currently writing for MT4 409 bild the minimum stop-levelling feature. For a buy order the tester considers the minimum values from Bid to be correct, and for a buy limit order the tester considers the minimum values from Ask to be correct. Logically, operations are performed - similar to buying. Question - is this the intention, or do we need to write to the BOD?

there has always been, is and will always be a buy from Ask.

Is there any proof other than words?

 
-Alexey-:

Now for MT4 409 bild the function of accounting the minimum stop level is being written. For a buy order, the tester considers the minimum values from Bid to be correct and for a buy order the tester considers the minimum values from Ask to be correct. Logically, operations are performed - similar to buying. Question - is this the way it's supposed to be or should I write it in the BOD?

It makes sense in principle) stop will trigger at Bid, pendent opens at Ask.

sergeev:

Always was, is and will be a buy from Ask.

For purchases the minimum distance to sl is taken from the bid, as long as I remember it has always been so)
 
sergeev:

there has always been, is and will always be a buy from Ask.

Is there any evidence other than words?


The trade operation in both cases is from ASK, but the stop level, as far as I understand, should be counted from BID, because it refers to a close-sell operation, which is what takes place in the tester for a BUY order. But for some reason, LIMIT is calculated from ASK for a BUY order. Example:

bool first_run=true;
int init()
{
   return(0);
}
int deinit()
{
   return(0);
}
int start()
{
   if (first_run==true)
   {
      string _Symbol=Symbol();
      int _Digits=MarketInfo(_Symbol, MODE_DIGITS);
      double Point_size=MarketInfo(_Symbol, MODE_POINT);
      double Min_stop_distanse=MarketInfo(_Symbol, MODE_STOPLEVEL)*Point_size;
      double Min_freeze_distanse=MarketInfo(_Symbol, MODE_FREEZELEVEL)*Point_size;
      double Spread=MarketInfo(_Symbol, MODE_SPREAD)*Point_size;
      Print("Spread="+Spread);
      double _Order_price;
      double _Order_sl;
      double _Order_tp;
      double _Order_lot;
      _Order_lot=MarketInfo(_Symbol, MODE_MINLOT);
      /* highest accepted level for buy limit order */
      double _Upper_bound_for_buy_limit=NormalizeDouble(MarketInfo(_Symbol, MODE_ASK)-Min_stop_distanse, _Digits);
      /* defining orders price */
      _Order_price=_Upper_bound_for_buy_limit; /* ASK */
      _Order_sl=NormalizeDouble(_Order_price-Min_stop_distanse, _Digits); /* ASK-STOPLEVEL */
      _Order_tp=NormalizeDouble(_Order_price+Min_stop_distanse, _Digits); /* ASK+STOPLEVEL */
      /* sending buy limit order */
      OrderSend(_Symbol, OP_BUYLIMIT, _Order_lot, _Order_price, 0, _Order_sl, _Order_tp, NULL, 0, 0, Green);
      first_run=false;
   }
   return(0);
}

Result:

2012.01.08 14:39:04 2011.06.03 01:43 test EURUSD,M1: Spread=0.00020000

2012.01.08 14:39:04 2011.06.03 01:43 test EURUSD,M1: open #1 buy limit 0.01 EURUSD at 1.4478 sl: 1.4474 tp: 1.4482 ok

 
the code wasn't inserted correctly.
 
Swan:
For purchases the minimum distance to the sl is taken from the bid, as long as I remember it has always been so)

Clarify first.

Are we talking about stops in buy orders or pending buy orders?

 
sergeev:

the code wasn't inserted correctly.
What do we do now? :) I've highlighted and pressed "Code", but there it is...
 
-Alexey-:
What do we do now? :) I think I highlighted and pressed "code", but there it is...

you can delete the post and try again normally. do you want to talk about that? or your problem with the stop level?

 
sergeev:

you can delete the post and try again in a normal way. do you want to talk about it? or about your problem with the stopwatch?

I got it with the code. About the stop levels. Is it written in the BOD or is it designed in such a way that the stop level in a BID order is calculated from the ASK of the order price. If so, why is it considered the opposite in BUY order?
 
-Alexey-:
in a buy limit order the BID stop/level is calculated from the ASK price of the order. If that is so, why is it considered the other way round in BUY order?


Let us start with the order. Second grade school.

А. In orders people calculate Stop Loss and Take Profit from their opening price. It is clear that if you want 100 points, you must close in profit 100 points from the open price.

Б. The setting of SL/TP/STOP is affected by what is known as the stop level. That is, you cannot place a stop loss/stackprofit/position closer than the StopLoss from the EXECUTION PRICE.

From this we draw the following conclusions.

1. When you open a market order, you should set SL/TP considering the stop level from the current price at which the stop is triggered. For bays, the stops trigger at Bid, so we take into account the stop level from the current Bid. That is SL/TP you usually put from the order opening (because you need 100 points), but be sure to take into account the position of the Bid and the size of the stop level.

2. When you open a Limit order, then as expected the Limit order itself should be no closer than the stop level from the price at which it triggers. That is, for a Buy Stop/ Bail Out, we measure the stop level against the Ask. That is, you place a stop order at the price you want, but always taking into account the distance of the stop level from Ask.

But pay attention! If you set the Stop Loss and Take Profit in the order , it is measured from the opening price of the order! Not from Ask, but from the opening price of the order! The current prices do not interfere with these two pending orders (SL/TP). They are only hindered by the distance to the future triggered order. That is, you set the SL/TP in the order considering the distance of the stop level from the opening price of this order. The Bid/Ask has nothing to do with it.

Remember?

 
sergeev:

But pay attention! stoploss and takeprofit in the pending order are calmly measured from the opening price of the order!!! not from Asc, but from the opening price of the order! The current prices do not interfere with these two pending orders (SL/TP). They are only hindered by the distance to the future triggered order. That is, you set the SL/TP in the order considering the distance of the stop level from the opening price of this order. The Bid/Ask has nothing to do with it.

Got it?

Yes, I remember, but I do not understand. It is clear that a pending Buy Limit order is opened when its level reaches the Ask price. Therefore, at that moment the current Bid price is at an unacceptable distance from the SL (also executed at the Bid) measured earlier as the strike price (i.e., the Ask price at the moment of execution) - Stop Level. The only thing one can try to explain this with is that it is not known in advance what the execution price of the Bid at the time of execution will be. If that's the intention - ok, it's clear, thanks for the detailed post.
Reason: