[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 560

 
TEXX:

That's the point, there are no errors, just buy does not modify and that's it, but if I comment out sell, then modify....
That's how it seems to work, thanks to everyone who responded.
void FirstSellLockBuyModifi()
{
 double lock_buy_tp = NormalizeDouble((FirsSellLockBuyAvP()+TakeProfit*Point),Digits);
 int spread = MarketInfo(Symbol(),MODE_SPREAD);
 double first_sell_sl = NormalizeDouble((lock_buy_tp+spread*Point),Digits);        
 for (int i = 0; i <= OrdersTotal(); i++)
    {
     OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
     if (OrderSymbol()!=Symbol())continue;
     if (OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
     if (OrderType()==OP_SELL)
       {
        if (OrderOpenPrice()==FirstSellPrice())
          {
           Print("Мод-ция ордера FIRST SELL");
           OrderModify(OrderTicket(),OrderOpenPrice(),first_sell_sl,OrderTakeProfit(),0,CLR_NONE);
           error=GetLastError();
           if (error != 0) Print("Мод-ция ордера FIRST SELL № ",OrderTicket()," ошибка № ",error);
           }
          }
       else {
             if (OrderType()==OP_BUY)
               {
                Print("Мод-ция ордера LOCK BUY");
                OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),lock_buy_tp,0,CLR_NONE);
                error=GetLastError();
                if (error != 0) Print("Мод-ция ордера LOCK BUY № ",OrderTicket()," ошибка № ",error);
               }
            }
    }
 return(0);
}
 
Vovo4ka:

A negative result is also a result and is no less important, but if you see the following picture (on the pound, the total loss from 100 000 to 2000 with 1 lot) ...... is it reasonable to rewrite the buy on sell, stop on profit, etc.?

Your opinion?


It's very easy to change buy to sell, but in this case I'm sure the reverse EA will also lose out because of the spread.
 
jelizavettka:

But in this case, I'm sure that the reverse EA will also fail because of the spread.


I have accounted for the spread, originally entered the so-called difference, i.e. I opened a buy trade 2.2 aunts higher than necessary, and sold it 2.2 below=)) seems to have accounted for the spread=))

 
Vovo4ka:


I have accounted for the spread, originally entered the so-called difference, i.e. I opened a buy trade 2.2 aunts higher than necessary and sold it 2.2 below=)) seems to have accounted for the spread=))


Clearly..... is a killer pipser - will drain at the rate of the spread and quite quickly because of the large number of trades. Want to be sure of that - do a reverse EA.
 
Vovo4ka:


I have accounted for the spread, originally entered the so-called difference, i.e. I opened a buy trade 2.2 aunts higher than necessary and sold it 2.2 below=)) seems to have accounted for the spread=))

If you opened a trade 2.2 points later, then the price has already passed this 2.2 points in some time (theoretically - from one tick to infinity) - it is not the same as opening a trade at some price and giving away a fixed spread at the same point in time. It is therefore wrong to account for the spread in this way.
 
So as not to create a new topic, I'll write here. I once saw a script/advisor or tp where you could set the time when you could or could not trade the main MTS (put it on a separate chart and it would block your MTS orders at the right time). Now I really need it and can't find it. Maybe someone has seen it? Thanks in advance.
 
gawrik:
So as not to create a new topic, I'll write here. I once saw a script/advisor or tp where you could set the time when you could or could not trade the main MTS (put it on a separate chart and it would block your MTS orders at the right time). Now I really need it and can't find it. Maybe someone has seen it? Thanks in advance.

I think there is such a f-fi by Kim I.V. - search for it like this: time-limit trading site:mql4.com...
 
Hi all, where do we store the parameter - accuracy - for the lot to be opened(number of decimal places)? How do we know if it's 0.01 or 0.001 (2 or 3)?
 
fore-x:
Hi all, where do we store the parameter - accuracy - for the lot to be opened (number of decimal places)? How do we know if it's 0.01 or 0.001 (2 or 3)?

Process through MinLot and LotStep
 
alsu:
If you opened the deal 2.2 points later, then the price has already passed this 2.2 points in some time (theoretically - from one tick to infinity) - it is not the same as opening a deal at some price and giving a fixed spread at the same moment in time. It is therefore wrong to account for the spread in this way.


why not correct??? if let's say I am working on a 5 min, then the trade should open only at that 5 min, otherwise the conditions for opening the trade will change, and as a consequence the trade will not be opened!

If you want to open a position in a certain time (in theory - from one tick to infinity), it's not the same as opening a position... If you want to open a position in a certain time (in theory - from one tick to infinity), then the price has already passed these 2.2 pips - it's not the same as opening a position... If you want to open a position in a certain time (in theory - from one tick to infinity), then you have to do it in reverse...

Reason: