Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 339

 
Choco_pro:

Hi, could you please tell me how to get rid of this kind of EA, as shown in the picture? My device is designed for impulse moves and it does not show profit! I have got a good one here, but the drawdowns are annoying.

You should go to a telepath...


And there is a cure for drawdowns - it's called a stop loss.

 
Mr.Profit:

So where to complain? I've been of the firm opinion so far that closing counter orders is a single indivisible guaranteed operation.


You can't do anything about it - think of all the sticks they create and write solutions in code. The more we know, the more complicated the system becomes, the more we realize what sticks they have...

In your case, if you have not closed by OrderCloseBy, you should provide for alternative closing, by itself, without damage to the account, it is better in several ways, not closed the first way the second close) the second did not work the way the third will) well, sort of - I think you got it

 

Greetings!


Hey friends, how can I implement the colour (direction) of the previous day's candle (daily time frame) if my current time frame is in a different format?

I'm studying mql...

 
Choco_pro:

Hi, could you please tell me how to get rid of this kind of EA, as shown in the picture? My device is designed for impulse moves and it does not show profit! I have got a good one here, but the drawdowns are annoying.

The programmer has to spend long boring evenings to keep the equity above the balance. And you are bothered by it. That's weird.

Your system needs to be refined to lock some of the profits into the balance sheet. The rest should be spent. As soon as equity starts to decrease relative to its previous value.

 
 
help to understand trying to modify two orders simultaneously one pending the other open one so open one modifies without problems and pending one is much later and in addition when the advisor runs on several pairs it modifies pending at open order price for another currency pair if the orders are open in the same direction



if( NumberOfPositionsBay(Symbol())==1&& NumberOfPositionsSell_otl(Symbol())==1&&GetOrderLotsOtlSell(Symbol())==start_Lot*2&& GetOrderLotsBay(Symbol())==start_Lot)
{


for (
int k = 0; k < OrdersTotal(); k++)
{
if (
OrderSelect(k,SELECT_BY_POS)==true) // If there is next
{ // Order analysis
:
//------------------------------------------------------ 3 --
if (OrderSymbol()!= Symbol()) continue; // Not our financial instrument

if (OrderSymbol() == Symbol() && OrderType() == OP_SELLSTOP ) {

tp_sell_otl=NormalizeDouble(s-(2*Point)-spred-(GetOrderPriceBay(Symbol())-(s-Point-spred))/Point/2*Point, Digits);
sl_sell_otl=NormalizeDouble(GetOrderPriceBay(Symbol()), Digits)


OrderModify(OrderTicket(),NormalizeDouble(s-Point-spred, Digits),sl_sell_otl,tp_sell_otl,0);

}


if (
OrderSymbol() == Symbol() && OrderType() == OP_BUY ) {



sl_buy_otl=NormalizeDouble(s-spred-Point, Digits);
OrderModify(OrderTicket(), OrderOpenPrice(),sl_buy_otl,OrderTakeProfit(),0);

}
}
}


 

max020780:

I am trying to modify two orders simultaneously, one pending and one open, but the open order is modified without any problem, the pending one is modified much later, and in addition when the EA is running on several pairs it modifies the pending order at the open order price for another currency pair if the orders are open in the same direction



There is the SRC button in the Edit Control Panel where the code is coloured automatically ;)

As for the code, if you use if (OrderSymbol() == Symbol()...) then if ( OrderSymbol()!= Symbol()) continue; no longer needed, either one or the other.

for (int k = 0; k < OrdersTotal(); k++) you'd better replace with

for (int k = OrdersTotal()-1; k >=0 ; k--), it's safer


 

I am using my own indicator in the EA, I see visually during testing that it is growing and according to the conditions it should open buy, but it does not happen.

I see the following errors in the log (I have two types, I want to show them one by one):

TestGenerator: unmatched data error (volume limit 372 at 2013.12.11 21:00 exceeded)

TestGenerator: unmatched data error (low value 1.33097 at 2013.09.12 19:45 is not reached from the lowest timeframe, low price 1.33105 mismatches)

Maybe there are some peculiarities with the operation of custom indicators? I have been messing around with this EA for two months and have been putting it off for a long time.

 

Errors 129,138 occur from time to time on one EA. The problem is solved only after restarting the terminal.

I want to add Market Info function to update bid and ask and then check.

Is it possible to artificially cause errors 129,138?

 
artmedia70:

People spend long, boring evenings making sure equity is above balance. And it's bugging you. That's weird.

Your system needs to be refined to lock some of the profits into the balance sheet. The rest should be spent. As soon as equity starts to decrease from its previous value.



Well, that's what I was going to say, there's a misalignment and loss of a valid balance percentage, and you can't withdraw money from the account, so it's annoying, at least that was the idea. And it's not optimised in any way. What does it mean to spend, by the way?
 
evillive:


There is SRC button in the edit panel, the code is coloured there automatically ;)

As for the code, if it uses if (OrderSymbol() == Symbol()...) then if (OrderSymbol()!= Symbol()) continue; we don't need either one or the other.

for (int k = 0; k < OrdersTotal(); k++) you'd better replace this with

for (int k = OrdersTotal()-1; k >=0 ; k--), it's safer



I wrote it this way


if(NumberOfPositionsSell(Symbol())==1 &&  NumberOfPositionsBay_otl(Symbol())==1  &&GetOrderLotsOtlBay(Symbol())==start_Lot*2  &&GetOrderLotsSell(Symbol())==start_Lot)
{
 
     for (int kk = OrdersTotal()-1; kk >=0 ; kk--) 
      {
      
       if (OrderSelect(kk,SELECT_BY_POS)==true) // Если есть следующий
{ // Анализ ордеров:
      
      if (OrderSymbol() == Symbol() && OrderType() == OP_BUYSTOP ) {
      

      tp_buy_otl=NormalizeDouble(b+((((2*Point)+spred+(b+Point+spred-GetOrderPriceSell(Symbol()))/Point)/2)*Point), Digits);
      sl_buy_otl=NormalizeDouble(GetOrderPriceSell(Symbol()), Digits);
      OrderModify(OrderTicket(), NormalizeDouble(b+Point+spred, Digits),sl_buy_otl,tp_buy_otl,0);
     
       Alert("tp_buy_otl = ",DoubleToStr(tp_buy_otl, Digits)+"\n"+"sl_buy_otl =  ",DoubleToStr(sl_buy_otl, Digits)+"\n"+" цена открытия бай стоп = ",  DoubleToStr(b+Point+spred, Digits)+"\n"+"OrderSymbol() =  ",OrderSymbol()+"\n"+"OrderType() = ",OrderType());
     
      
     }
      
      
      if (OrderSymbol() == Symbol() && OrderType() == OP_SELL ) {
      
      sl_sell_otl=NormalizeDouble(b+spred+Point, Digits);
      OrderModify(OrderTicket(),OrderOpenPrice(), sl_sell_otl,OrderTakeProfit(),0);
       
      }
      }
      }
      
} 

а в алерте почемуто OrderSymbol()==GBPUSD посмотрите на скин
да и открытый селл он модифицировал а отложенный нет


As soon as I removed the pending order for gbpusd and removed the EA from it, the order for euro was modified immediately