[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 926

 
gheka:

Try as I might, I've rewritten everything, but still error 130, help where is it wrong?

I don't think a stop leveller is needed here, are they and stops at 1000?

Try

extern double StopLoss=1000.0;
extern double TakeProfit=1000.0;
extern double Lots=1.0;
extern int total;


int start() {

int dg;
double Price_1,Price_2,min,max,pa,pb,pt;

pt=MarketInfo(Symbol(),MODE_POINT);
dg=MarketInfo(Symbol(),MODE_DIGITS);
pa=MarketInfo(Symbol(),MODE_ASK);
pb=MarketInfo(Symbol(),MODE_BID);
Price_1=pb;
Price_2=pa;
min=iLow(NULL,0,2);
max=iHigh(NULL,0,2);
total=OrdersTotal();

double slB=NormalizeDouble(pa-StopLoss*pt,dg);
double tpB=NormalizeDouble(pa+TakeProfit*pt,dg);
double slS=NormalizeDouble(pb+StopLoss*pt,dg);
double tpS=NormalizeDouble(pb-TakeProfit*pt,dg);

  if(total<1) 
  {
   if(Price_1>max)
      OrderSend(Symbol(),OP_BUY,Lots,pa,2,slB,tpB,"My order#",16384,0,Green);

   if(Price_2<min)
      OrderSend(Symbol(),OP_SELL,Lots,pb,2,slS,tpS,"My order#",16384,0,Green);
  }

}
 
Hello, does anyone have such a tester Exp - Multi Tester for Mt4 if you don't mind sharing please!
 
Hello! Guys, I can't figure out mql4(( I want to write a small EA based on two EMA's (moving averages) Which give a beep after crossing? Can you tell me something from this program ? Thanks in advance !!!
 

is there a function that returns the value of a closing order(stop loss) ?

for example to let EA know if a stop loss is triggered

I did not find it in the documentation, maybe it is there, but I have re-read it about ten times in a month and I do not remember

i did not remember to find such a function

 
silmin85:
Hello! Guys, I can't figure out mql4(( I want to write a small EA based on two EMA's (moving averages) Which give a beep after crossing? Can you tell me something about this program ? Thanks in advance !!!

Let's just write in one place next time. Spamming is not good.
 
gheka:

is there a function that returns the value of a closing order (stop loss) ?

for example to let EA know if a stop loss is triggered

I did not find it in the documentation, maybe it is there, but I have re-read it about ten times in a month and I do not remember

I don't remember it.

Look for the order in the history and if you find it, compare its close price OrderClosePrice() with its StopLoss OrderStopLoss() level

If they are equal, then the position has closed on a stop.

 
artmedia70:

Look for the order in the history, and if you find it, compare its closing price OrderClosePrice() with its StopLoss OrderStopLoss() level

If they are equal, it means that position was closed at Stop Loss.

Kim has a function that takes the last closed order...
 
OlegTs:
Kim has a function that takes the last closed order...

I know. A lot of people are starting to learn from these functions. I gave a link to his thread here recently, but the man persists in asking. Probably too lazy to look it up... :)

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 19.05.2008                                                     |
//|  Описание : Возвращает флаг закрытия последней позиции по стопу.           |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (""   - любой символ,                   |
//|                                     NULL - текущий символ)                 |
//|    op - операция                   (-1   - любая позиция)                  |
//|    mn - MagicNumber                (-1   - любой магик)                    |
//+----------------------------------------------------------------------------+
bool isCloseLastPosByStop(string sy="", int op=-1, int mn=-1) {
  datetime t;
  double   ocp, osl;
  int      dg, i, j=-1, k=OrdersHistoryTotal();

  if (sy=="0") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
      if (OrderSymbol()==sy || sy=="") {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (op<0 || OrderType()==op) {
            if (mn<0 || OrderMagicNumber()==mn) {
              if (t<OrderCloseTime()) {
                t=OrderCloseTime();
                j=i;
              }
            }
          }
        }
      }
    }
  }
  if (OrderSelect(j, SELECT_BY_POS, MODE_HISTORY)) {
    dg=MarketInfo(sy, MODE_DIGITS);
    if (dg==0) if (StringFind(OrderSymbol(), "JPY")<0) dg=4; else dg=2;
    ocp=NormalizeDouble(OrderClosePrice(), dg);
    osl=NormalizeDouble(OrderStopLoss(), dg);
    if (ocp==osl) return(True);
  }
  return(False);
}
 
Hi guys, could you please advise: slippage - The value of the maximum slippage in pips. What is it and what is it for? I always set it to zero. Maybe it makes sense to change it. Can it be changed by my brokerage company? Thank you in advance!
 
RekkeR:

Can you please tell me if there are several indicators superimposed on each other in one additional window, can you remove the line above them with the names and parameters? I'm sick of this teletext.




You can, but you need to remove it in every indicator. Edit the code
Reason: