[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 955

 
35aleks:
how to write code in an EA to understand the rebound from level x.xx25

It all depends on how you understand the concept of "level rebound"...

The price touched, crossed to one side and immediately crossed back,
The candlestick opened on one side of the level, then the price crossed the level and the candlestick closed on the same side as it opened,
The previous candle opened on one side and closed on the other, and the current candle opened on the closing side of the previous candle and closed on the opening side of the previous candle...
И... You can get the whole suitcase of such criteria... :)

You have to be more specific with your questions...

 
kgn45:
Stoploss is needed for a martingale class EA. any option to put a stoploss on every order opened. I really need it would be grateful!
Does your martini code need to be attached? Or is this a telepath forum?
 
kgn45:
Stoploss is needed for a martingale class EA. any option to put a stoploss on every order opened. I would be very grateful!

I will say it again. There are a lot of variants to calculate. And most are here https://www.mql5.com/ru/code
 
granit77:
More like this.

Thanks for the answers!
 
Hi all, question: There are four candles, you need to find the maximum and minimum price of these candles combined. Thank you.
 
Maniac:
Hi all, Here's a question: there are four candles, I need to find the maximum and minimum price of these candles together. Thank you.

https://docs.mql4.com/ru/series/iLowest

https://docs.mql4.com/ru/series/iHighest

If the candlesticks are not in a row, then MathMax() and MathMin() in pairs

https://docs.mql4.com/ru/math/MathMax

https://docs.mql4.com/ru/math/MathMin

 
kgn45:

for these two :.

GoldenProfit_hgs.mq4 (22.16 KB)
1_1.mq4 (8.98 KB)

GoldenProfit_hgs.mq4 - decompiled code. Decompiled code is not allowed for publication on the forum. Post is removed.
 

Thank you all for ignoring the question! Figured it out on my own. The line for Sell had no time to set and returned a value of NULL.

ObjectGet("LOSSELL", 1)!=0

That's what was missing!!!

//+------------------------------------------------------------------+
//|  Линия                                                           |
//+------------------------------------------------------------------+
void CheckForClose() {  
   for (int i=0; i<OrdersTotal(); i++) {
      if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES) == false) break;
      if (OrderSymbol() != Symbol()) continue;
      //---- check order type 
      if (OrderType() == OP_BUY) {
         if (Bid <= ObjectGet("LOSBAY", 1)) {
            OrderClose(OrderTicket(),OrderLots(),Bid,3,White);
            ObjectDelete("LOSBAY");        
            break;
         }
      } else {
         if (OrderType() == OP_SELL) 
         {
            if (Ask >= ObjectGet("LOSSELL", 1)&&ObjectGet("LOSSELL", 1)!=0)
             {
               OrderClose(OrderTicket(),OrderLots(),Ask,3,White);
               ObjectDelete("LOSSELL");
               break;
            }
         }
      }
   }
   //----
   if (OrderType() == OP_SELL) {
      ObjectCreate("LOSSELL", 1, 0, Time[0], Ask+LS*Point);
      if (ObjectGet("LOSSELL", 1)-Ask > LS*Point) ObjectSet("LOSSELL", 1, Ask+LS*Point);
   } else {
      if (OrderType() == OP_BUY) {
         ObjectCreate("LOSBAY", 1, 0, Time[0], Bid-LB*Point);
         if (Bid-ObjectGet("LOSBAY", 1) > LB*Point) ObjectSet("LOSBAY", 1,  Bid-LB*Point);
      }
   }
   if (OrdersTotal() < 1) {
      ObjectDelete("LOSSELL");
      ObjectDelete("LOSBAY");
   }         
}
 
artmedia70:

Does your martini code need to be attached? Or is this a telepathic forum?

this EA needs a stoploss to be placed on each order
Files:
1_2.mq4  9 kb
 
alsu:
Because these are double numbers, they have a limited mantissa length and therefore accuracy. Try this: NormalizeDouble(0.25+(-0.25),2)
Thank you!