Alexander111  
Hello!
When installing Meta Trader 5, which Proxy server should I install?
mario  
Vladon:

it works on mt5.

Yes it works-calculate errors-01.10.20112 to 06.10.2012 on euro/$
Files:
20121111.log  60 kb
mario  
Vladon:

what do you mean?

failed modify buy 0.10 EURUSD sl: 1.29120, tp: 1.29370 -> sl: 1.29120, tp: 1.29370 [Invalid stops]

JF 0 Core 1 19:48:37 2012.10.03 16:20:27 Modify error =4756

I would say stoploss and takeprofit cannot be modified in itself, that's why it says stop error, why is it surprising.

Yes, and what is written in the code:
  if(PositionSelect(Symbol())){
    if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY)
      {
      if(MStop > 0)
       {
        if(NormalizeDouble(Bid - MStop,4) >= Open)
          if(SL == 0 || NormalizeDouble(Bid - MStop,4) >= SL) 
           {
            ModifyPosition(Symbol(),NormalizeDouble(Bid - MStop,4),TP);
           }
        }
      }
    if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_SELL)
      {
      if(MStop > 0)
       { 
        if(NormalizeDouble(Ask + MStop,4) <= Open)
          if(SL == 0 || NormalizeDouble(Ask + MStop,4) <=SL) 
           {
            ModifyPosition(Symbol(),NormalizeDouble(Ask + MStop,4),TP);
           }
        }
      }
     } 
  }

change stop after 10 pips or not?

How do I calculate 10 pips as expensive if I specify when to change the stop?

if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY)

if there is a buy position

if(MStop > 0)

If MStop is above zero

if(NormalizeDouble(Bid - MStop,4) >= Open)

If the Bid price minus the MStop price is greater than the Open price double Open = NormalizeDouble(PositionGetDouble(POSITION_PRICE_OPEN),4)

which is specified by 4 digits.

if(SL == 0 || NormalizeDouble(Bid - MStop,4) >= SL)

If Stoploop = 0 or Bid price minus points pips higher or equal to the Stoploop level.

What is not clear?

Works fine on MT4.

I use it on MT5, it's a glitch.

On MT5 I set more because of StopLevel(SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL)). still a glitch.

Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства позиций
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства позиций
  • www.mql5.com
Стандартные константы, перечисления и структуры / Торговые константы / Свойства позиций - Документация по MQL5
Yury Reshetov  
mario065:
Yes, and what is written in the code:

Should the stop be changed after 10 pips?

So how do I calculate 10 pips as expensive if I specified when to change the stop?

if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY)

if there is a buy position

if(MStop > 0)

If MStop is above zero

if(NormalizeDouble(Bid - MStop,4) >= Open)

If the Bid price minus the MStop price is greater than the Open price double Open = NormalizeDouble(PositionGetDouble(POSITION_PRICE_OPEN),4)

which is specified by 4 digits.

if(SL == 0 || NormalizeDouble(Bid - MStop,4) >= SL)

If Stoploop = 0 or Bid price minus points pips higher or equal to the Stoploop level.

What is not clear?

Works fine on MT4.

I use it on MT5, it's a glitch.

I do my calculations and it works fine on MT4, I set more stop level on MT5 (SymbolInfoInteger(_Symbol,SYMBOL_TRADE_STOPS_LEVEL)). still a glitch.


if(NormalizeDouble(Bid - MStop,4) >= Open)
                                  ^^^^^^
                                Что за хрень?

if(SL == 0 || NormalizeDouble(Ask + MStop,4) <=SL) 
  ^^^^^^^^                 ^^^^^^^^^^^^^^
Почему не нормализовано? Нахрена это нормализовать?

Vladislav Andruschenko  

It's simple, it's the wrong level of stops, namely a stop less than the minimum.

What's not to understand?

Yury Reshetov  
Vladon:

It's simple, it's the wrong level of stops, namely a stop less than the minimum.

What's not to understand?

He's got it all wrong there, as there's more joints than there needs to be.
mario  
Reshetov:

Hello Reshetov,

For you it's "What the hell?", for me it's the condition when I have to make a call to the modification function.

If you looked at the code, you wouldn't have written it.

if(NormalizeDouble(Bid - MStop,4) >= Open)
                                  ^^^^^^
                                Что за хрень?

if(SL == 0 || NormalizeDouble(Ask + MStop,4) <=SL) 
  ^^^^^^^^                 ^^^^^^^^^^^^^^
Почему не нормализовано? Нахрена это нормализовать?

The code does:

  double Bid  = NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),4);
  double Ask  = NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),4);
  double Open = NormalizeDouble(PositionGetDouble(POSITION_PRICE_OPEN),4);
  double SL   = NormalizeDouble(PositionGetDouble(POSITION_SL),4);
  double TP   = NormalizeDouble(PositionGetDouble(POSITION_TP),4);

Translation condition:

input double MStop  = 0.001;
double Open = NormalizeDouble(PositionGetDouble(POSITION_PRICE_OPEN),4);
if(NormalizeDouble(Bid - MStop,4) >= Open)

If price on Bid-MStop is higher or equal to opening level of position, then it is possible to make call of modify function - not earlier.

Also, this is not the right way to do it-it is in the code and should be done correctly:

if(SL == 0 || NormalizeDouble(Bid - MStop,4) >= SL)

The second normalization is just in case, I think it is not bad.

The condition itself (which you took from the condition for a Sell Positive):

If stop loss is zero or Bid minus 10 pips more or equal to stop loss level - then we can call the modify function.

If the price is higher and the stop loss changes, the next call will be made after 10 pips, so it doesn't happen on every tick.

That's what I wrote - I think it's right.

I was expecting you to tell me if it is right or wrong, my mistake or a bug?

Reason: