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

 
How do I find the smallest maximum of a candle in a given bar period?
 
savage_pinguin:
How do I find the smallest maximum of a candle in a given bar period?


Try this

bar=iLowest(NULL,0,MODE_HIGH,10,10);

 
alsu:

Please note.

1) The condition "line1[1]>line2[1]" is not sufficient for the "two lines crossing" signal. Надо "линия1[1]>линия2[1]&&линия1[2]<линия2[2]"

2) The parabolic should not be compared with Open, but with High and Low. Please note that you calculate it on zero bar and take Open[1] from the first bar.

Thank you for your attention to my questions. I did what you advised. But now the EA has stopped trading altogether. Perhaps, I have understood you wrongly and made something wrong, or there are some other errors in the code?

At the moment the code looks like this:

//+-------------------------------------------------------------------------------------+
//| Расчет значений технических индикаторов с формированием сигналов для позиций        |
//+-------------------------------------------------------------------------------------+
void GetSignal()
{
 Signal = 0;
// - 1 - == Получение значений индикаторов ==============================================
 double SAR = iSAR(Symbol(), 0, SARStep, SARMaximum, 0);
 double EnvUp = iEnvelopes(Symbol(), 0, EnvPeriod, EnvMethod, EnvShift, EnvPrice,
 EnvDeviation, MODE_UPPER, 1);
 double EnvDn = iEnvelopes(Symbol(), 0, EnvPeriod, EnvMethod, EnvShift, EnvPrice,
 EnvDeviation, MODE_LOWER, 1);
 double StochM = iStochastic(Symbol(), 0, StochK, StochD, StochSlowing, StochMethod,
 StochPrice, MODE_MAIN, 1);
 double StochS = iStochastic(Symbol(), 0, StochK, StochD, StochSlowing, StochMethod,
 StochPrice, MODE_SIGNAL, 1);
// - 1 - == Окончание блока =============================================================

// - 2 - == Генерация сигнала ===========================================================
 if (SAR < Low[1])
   {
    Signal = 3;                                                          // Закрытие SELL
    if (StochM > StochS && StochM < StochS && StochM >= 80 &&
    StochS >= 80 && High[1] >= EnvUp && SAR < High[1])
      Signal = 1;                                                         // Открытие BUY
   }   
 
 if (SAR > High[1])
   {
    Signal = 4;                                                           // Закрытие BUY
    if (StochM < StochS && StochM > StochS &&  StochM <= 20 &&
    StochS <= 20 && Low[1] <= EnvDn && SAR > Low[1])
      Signal = 2;                                                        // Открытие SELL
   }   
// - 2 - == Окончание блока =============================================================
}

Please help me to understand it, I really want to make this EA trade.

Edit: A big request: if it's possible, please form your answer in a code form.
Don't forget that I'm still a complete "dummy" in programming... I don't want to have to ask you again.
 

Somebody please explain the Ilan 1.4 code to me. I mean, I want to change it for me a little bit, but other people's code does not understand at all. Can someone explain me, at least block by block, what is done?

I don't have enough brains for realization - I've been familiar with MQL4 for only one week.

If anyone can help me, I'd be very grateful, if you can write to delit-0202@rambler.ru

And then, how to determine the trend in an EA? At least a general one, maybe even a lag one. How would one do it?

 
daytrader19:

Thank you for your attention to my questions. I did what you advised. But now the EA has stopped trading altogether. Maybe I misunderstood you and did something wrong, or there are some other errors in the code?

At the moment the code looks like this:

Please help me to understand it, I really want to make this EA trade.

Edit: A big request: if it's possible, please form your answer in a code form.
Don't forget that I'm still a complete "dummy" in programming... I don't want to have to ask you again.

How can he trade if this

 StochM < StochS && StochM > StochS

Is it a condition that is obviously impossible to meet? You need to calculate stochastic values on the first and second bars.

 double StochM1 = iStochastic(Symbol(), 0, StochK, StochD, StochSlowing, StochMethod,
 StochPrice, MODE_MAIN, 1);
 double StochS1 = iStochastic(Symbol(), 0, StochK, StochD, StochSlowing, StochMethod,
 StochPrice, MODE_SIGNAL, 1);
 double StochM2 = iStochastic(Symbol(), 0, StochK, StochD, StochSlowing, StochMethod,
 StochPrice, MODE_MAIN, 2);
 double StochS2 = iStochastic(Symbol(), 0, StochK, StochD, StochSlowing, StochMethod,
 StochPrice, MODE_SIGNAL, 2);

if( StochM1 < StochS1 && StochM2 > StochS2 ...
 

If you don't mind, I would like to clarify one more thing. I understood my mistake with Stochastic, but what about other indicators? No errors in using Envelope and Parabolic? I should have some)). Please look at both the opening and closing.

And thanks for the latest MT5 build , I already downloaded it.

 

Someone here just asked how to change the content of the text. The post disappeared while I was answering it. Just in case someone needs it.

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start(){

   ObjectCreate("1",OBJ_TEXT,0,Time[0],Open[0]);
   ObjectSet("1",OBJPROP_FONTSIZE,16);
   ObjectSet("1",OBJPROP_COLOR,Red);
   if(!ObjectSetText("1","Пример создания нового текста",16,"Verdana",Red)){
    Alert("Ошибка № ",GetLastError()," при изменении описания текста");
   }

  return(0);
}
//+------------------------------------------------------------------+ 
 

I'm not getting a text...

ObjectSetText(name,buf1[i]/buf2[i]*100,6,"Arial",C'0,33,0');
ошибка 4062
 
eddy:

I'm not getting a text...


buf1[i]/buf2[i]*100 - second parameter of this function should be string. Read parameters here - bool ObjectSetText(string name, string text, int font_size, string font_name=NULL, color text_color=CLR_NONE)
 
How do I turn an int into a string, other than to write string text=int_peremennaya
Reason: