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

 
artmedia70:
What is the log entry "negative argument for MathSqrt function"? The Expert Advisor is on demo, it opens deals, but the entire log is filled with this error. It has something to do with the custom indicator... Can you please tell me who knows... Thank you.


From the help:

double MathSqrt(double x)
The function returns the square root of x. If x is negative, MathSqrt returns NaN (undefined value).

is your case :)))

 
ToLik_SRGV:


From the reference:

double MathSqrt(double x)
The function returns the square root of x. If x is negative, MathSqrt returns NaN (undefined value).

just your case :)))

Great... Is the indyect not working correctly? From codebase... magical ... :)
 
artmedia70:
Great... Is the turkey malfunctioning? From the codebase... magical ... :)
Yeah it looks like it. What's the indicator to know just in case?
 
ToLik_SRGV:
Yeah, it looks like it. What's the indicator to know just in case?
Oh, by the way, sorry, it's not in the database... Already forgot I didn't get it here... KvantLevel. There's a link to it. It's in the trailer...
Files:
 
artmedia70:
Yes, by the way, sorry, it's not in the database... Already forgot I didn't get it here... KvantLevel. There's a link to it here. And in the trailer it is...

The author of the indicator is Integer.
 
Vinin:

The author of the Integer indicator.
Yeah, Victor, are you suggesting we go to him with questions? I don't want to make too much noise... You could try and do some digging yourself... although... I don't know much about it... (There's an embarrassed smiley face...)
 

And anyway, I've been fooling everybody out of sleep... I don't know where I was looking with my sleepy eyes. I take back what I said about the indicator. AMA for Expert2 doesn't work...


Please don't kick me with your boots... :) It's time for bed...

 
ToLik_SRGV:

Added ability to change RSI period, prices on which to build and levels.
Try it :)


Thank you very much, this is exactly what I wanted. Thank you. I'll give it a try.
 

Can you please tell me what I did wrong?

I need to find the opening price of the first candle on the hour chart, i.e. the one at 0:00 and from this candle to the current one to find the maximum price value.

Why do I always get the high of the first candle of the current day.

This is how I do it:

//+------------------------------------------------------------------+
//|                                                          od3.mq4 |
//|                                                 Oleg             |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Pereverzev Pavel"
#property link      ""

#property indicator_separate_window
#property indicator_minimum -2
#property indicator_maximum 2
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
//---- input parameters
extern int       xod=100;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
         int ic=IndicatorCounted();
         int limit=Bars-ic;
//----
for (int i=limit-1;i>=0;i--)
{
//Находим цену открытия первой свечки. 
int startH = Hour();
double OP = Open[i+startH];


//Находим максимальное и минимальное значение цен на текущий день.
double max2;

for (double max=High[i+startH];startH>=0;startH--){
if (max>=OP) {
 max2=max;


}

}


Alert ("Max: ",max );


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

Can you please tell me what I did wrong?

I need to find the opening price of the first candle on the hour chart, i.e. the one at 0:00 and from this candle to the current one to find the maximum price value.

Why do I always get the high of the first candle of the current day.

This is how I do it:


I must have misunderstood the meaning of int startH = Hour(); - it will give the current server time - an hour, I would look for zero hours, or any other hour:

int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   int i =0;
   string s = StringSubstr(TimeToStr(Time[i],TIME_MINUTES),0,2);
   while ( s != "00") {i++ ;s = StringSubstr(TimeToStr(Time[i],TIME_MINUTES),0,2);}
   Alert("i= ",i," / str= ",s," Time= ",TimeToStr(Time[i]));
   return(0);
  }
Reason: