[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 171

 

There is an indicator, Sanyok is the author.

It marks the level of a fractal formed on a bar with a volume greater than the average volume of the last 3 bars before the fractal.

how to load it into an EA ?

I am trying:

h=NormalizeDouble(iCustom(NULL,0, "vfractals",MODE_UPPER, 1),Digits);

l=NormalizeDouble(iCustom(NULL,0, "vfractals",MODE_LOWER, 1),Digits);

it doesn't work.

Files:
vfractals.mq4  4 kb
 
NormalizeDouble(iCustom(NULL,0, "vfractals",MODE_UPPER, 1),Digits); 1. MODE_UPPER and MODE_LOWER means you take values from the first and second indicator buffers (you have zero and first) 2. Number 1 means that you take the value of [1]-th element (on the last bar)
 
ilunga:
NormalizeDouble(iCustom(NULL,0, "vfractals",MODE_UPPER, 1),Digits); 1. MODE_UPPER and MODE_LOWER means you take values from the first and second indicator buffers (you have zero and first) 2. Number 1 means that the value of [1]-th element is taken (at the previous bar)

Thank you.
 

Moved.

Pavel447 02.03.2011 10:57
How do you do!
If you have an Expert Advisor (or script) that automatically sets SL, TP, Trailing Stop, and transfer to BU on profit taking ...?
Thanks in advance).

 
Moved.
dimeon 02.03.2011 11:41
sammi61:

Help me to add a dynamic lot to the code of an EA, so that the lot increases with the increase in the deposit, or as a percentage of the deposit?
If lot is 0, then auto lot is enabled, if it is a value, then the lot is fixed
Attached files:
FiboWave_v1_1lavtolot.mq4 (9.26 KB) removed
 
artmedia70:
Arrays can be used in so many cases and for so many different tasks. So what is the right example?
  if (Cls_B[i]||Cls_S[i]) LotCt=NormalizeLot(OrderLots()/(4-i)); 
how to write [i] ? I seem to declare it as a variable..., it gives a compilation error. I don't understand ... It's asking for an integer value, but an array can also be declared as a variable?!
 

100yan:
как прописать [i] ?

It asks for an integer value, but an array can also be declared as a variable?!

Be more specific.

an array is a variable with the same name but a different number

 
100yan:
how to write [i] ? I seem to declare it as a variable..., it gives a compilation error. I don't understand ... It asks for an integer value, but an array can also be declared as a variable ?!
Any construction in brackets [] must have data type int.
 

Can you tell me what the meaning of this crap in the logs is? How can I avoid it? The Expert Advisor trades with this indicator, after an error the trade freezes until you restart the terminal because restarting the Expert Advisor may crash again.

22:39:53 +ZigZag_Levels CLJ1,M5: uninit reason 3
22:39:53 Zigzag CLJ1,M5: uninit reason 1

22:39:53 Zigzag CLJ1,M5: removed

Maybe it's because I'm using the terminal on a remote server and on my own computer at the same time?

 
todem:

Hi all! I have a question: in this function for two positions (buy and sell) I set stop-loss so that for sell SL=open buy+18 pips, and vice versa for buy:

бла-бла-бла...

Opening prices of opposite positions are obtained from the function:

бла-бла-бла...

We know the ModifyOrder function as a standard KIMIW function, we use it to set the calculated stoplosses...

The question is, the EA sets stoplosses only for a sell and not for a buy... Who thinks so?


void SimpleLock(string sy="", int mn=-1) {
  double po, pp, ops1=0, ops2=0, opb;
  int    i, k=OrdersTotal();

  if (sy=="0") sy=Symbol();
  for (i=0; i<=k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      if (OrderSymbol()==sy || sy=="") {
        po=MarketInfo(OrderSymbol(), MODE_POINT);
        if (mn<0 || OrderMagicNumber()==mn) {
          if (OrderType()==OP_SELL) {
            opb=OrderStopLoss();                            // Значение стопа позиции до модификации = (0???)
            ops2=NormalizeDouble(OrderPrice(OP_BUY),Digits);
            if (ops2>0 && opb!=0) {
                ModifyOrder(-1, ops2+18*po, -1);
              }
            
          }
          if (OrderType()==OP_BUY) {
            opb=OrderStopLoss();
            ops1=NormalizeDouble(OrderPrice(OP_SELL),Digits);
            if (ops1>0 && opb!=0) {
                ModifyOrder(-1, ops1-18*po, -1);
              }
            
          }
        }
      }
    }
  }
}

If the stop is not set, the modify is not called...

If you don't set stop-loss for long, then the modifity is not called..:

double OrderPrice(int type) {
   double price;
   int i, k=OrdersTotal();
      
      for (i=0; i<k; i++) {
         if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
            if (OrderType()==type) {
            price=OrderOpenPrice();  // Значение цены открытия в списке ордеров терминала позиции с типом type и индексом i
            }
         }
      }
   return(price);  // Возвращает цену открытия последней в списке ордеров позиции с типом type и индексом не более k-1
}

Are you sure that the opening price of the required order is returned?

Reason: