[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 297

 
hoz:


There is no ideal! I just watch people who write, so to speak, for general outlook. Sometimes I find some tricks I may learn from others. Sometimes I see that the code is not readable at all. Like tarasBY's, for example. No matter how hard I try, it cannot be read. I can read it in clear segments and then bam! I can't understand anything further. And so in many places.

I'm a friend who asked me to decompile, and it's easier to understand there than tarasBY's codes. Maybe it's kind of normal, but I doubt that many downloaders will understand them. Who is too clever to understand them, they will not download... Then the question arises why post them there :)

I don't use anything from him either! Why try to do something blindly, you need to make it all clear, what for. And the publication is for advertising, and if everything is clear, they will download it and not order anything.
 
tara:
I measure my time according to Greenwich Mean Time.
My time is an hour less than the server's and I still live in Central Europe. And you should have three hours more if the server is GMT. I'm off to bed. Have a good night with no explosions!
 

I'm asleep now. Good night.

What do they say in Catalonia?

 
Buenas noches! Pero ahora ya es madrugada! But it's late at night!
 
GaryKa:
Not at all
Yes, it's the ratio of two natural logarithms. Now look at the formula from "Substitution of the base of the logarithm". So the result is that this expression
is equivalent to the decimal logarithm for bd_LOTSTEP. In MQL there is no separate function for the decimal logarithm, so this conversion is used.


This is what I was saying. The code of my language... I think either the programmer is not afraid of mathematics or it's a kind of protection from code reading (just kidding). I don't know, my personal opinion is that mathematics simplifies the algorithm just like switch...case instead of if.
 
rigonich:

Show SetVLine();
 
Hello, I have tried to understand how to insert custom indicators into EA. Compiled well, but writes absolutely

wrong data, please indicate where the error is.




I insert all code, except for "copyright"

extern int PeriodP=12;
extern int TimeFrame=0;
double P_up0,P_up1,FrApPrise;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit() xml-ph-0016@deepl.in
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----

P_up0=iCustom(Symbol(),Period(), "Price channel",PeriodP,0,0)
P_up1=iCustom(Symbol(),Period(), "rezerv-xrust",FrApPrise,0,0);
{Comment("show price channel=",P_up0,"\n", "show xrust=",P_up1);}
//----
return(0);
}



used two indicators

1)https://www.mql5.com/en/code/8908

Price channel.mq4

2)https://www.mql5.com/ru/code/8318

Fractal_Level_Xrust_V2.mq4

please help, why 1 shows and the other does not want?
 
gyfto:

That's what I was saying. Conditional my language... I think either the programmer is not afraid of mathematics or it's a kind of protection from code reading (just kidding). I don't know, my personal opinion is that mathematics simplifies the algorithm just like switch...case instead of if.

There is one flaw in that code. Here, taken out of context:


The whole point is that the expression

MathCeil(MathAbs(MathLog( 0.25 )/MathLog(10))) = 1

Hence the lot value is rounded to one decimal place.


Read on, though, maybe it will help.

 

A small addition to the description of my question.I have redone the crunch indicator.Here is the code

#property copyright "#Copyright © 2008, XrustSolution.#"
#property link "#xrust.ucoz.net#"

#property indicator_chart_window
extern int TimeFrame=0;//If=0, then the current one


extern string FrApNam="Ap";//name of the line corresponding to the upward Fractal.
extern string FrDnNam="Dn";//name of line corresponding to the Fractal downwards

//-----------------------------------------------------------------------------+
double FrPrise;
double FrApPrise=0,FrDnPrise=0;

//+----------------------------------------------------------------------------+
void init(){

if(TimeFrame==0){TimeFrame=Period();}
IndicatorShortName("Factal_Level_Xrust "+TimeFrame);
FrApNam=StringConcatenate(FrApNam,TimeFrame);
FrDnNam=StringConcatenate(FrDnNam,TimeFrame);
return;}
void deinit(){
ObjectDelete(FrDnNam);
ObjectDelete(FrApNam);
Comment(" ");
return;}
//+----------------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit;
double tmp;
int i, j,k;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//-----------------------------------------------------------------------------+

LineAp();
LineDn();
string FAP=DoubleToStr((FrApPrise),Digits);
string FDP=DoubleToStr((FrDnPrise),Digits);
int diap=MathRound((FrApPrise-FrDnPrise)/Point);
{Comment("TimeFrame="+TimeFrame+
"\nApPrise111 ="+FAP+
"\nDnPrise ="+FDP+
"\nFractal Channel ="
+diap+"Point");}

return(0);
}
//-----------------------------------------------------------------------------+
// searches horizontal line by name redraws if price has changed |
//-----------------------------------------------------------------------------+
void LineDn(){
FrPrise=NormalizeDouble(FindNearFractal(0,TimeFrame,MODE_LOWER),MarketInfo(Symbol(),MODE_DIGITS));
FrPrise=NormalizeDouble(FrPrise,MarketInfo(Symbol(),MODE_DIGITS));
//Comment(FrPrise);
if(ObjectFind(FrDnNam)==0){
if(ObjectGet(FrDnNam,OBJPROP_PRICE1)==FrPrise){return;}}
FrDnPrise=FrPrise;
ObjectDelete(FrDnNam);

WindowRedraw();
return;}
//-----------------------------------------------------------------------------+
// searches for a horizontal line by name, redraws if price has changed |
//-----------------------------------------------------------------------------+
void LineAp(){
FrPrise=NormalizeDouble(FindNearFractal(0,TimeFrame,MODE_UPPER),MarketInfo(Symbol(),MODE_DIGITS));
FrPrise=NormalizeDouble(FrPrise,MarketInfo(Symbol(),MODE_DIGITS));
if(ObjectFind(FrApNam)==0){
if(ObjectGet(FrApNam,OBJPROP_PRICE1)==FrPrise){return;}}
FrApPrise=FrPrise;
ObjectDelete(FrApNam);

WindowRedraw();
return;}
//-----------------------------------------------------------------------------+
//Kim Respect and respect !!! |
//+----------------------------------------------------------------------------+
//| Author : Kim Igor V. aka KimIV, http://www.kimiv.ru |
//+----------------------------------------------------------------------------+
//| Version : 07.10.2006 |
//| Description : Search for the nearest fractal. Returns the price level. |
//+----------------------------------------------------------------------------+
//| Parameters: |
//| sy - instrument name ("" or NULL - current symbol) |
//| tf - timeframe ( 0 - current TF) |
//| mode - fractal type (MODE_LOWER|MODE_UPPER) |
//+----------------------------------------------------------------------------+
double FindNearFractal(string sy="0", int tf=0, int mode=MODE_LOWER) {
if (sy=="" || sy=="0") sy=Symbol();
double f=0;
int d=MarketInfo(sy, MODE_DIGITS), s;
if (d==0) if (StringFind(sy, "JPY"<0) d=4; else d=2;

for (s=2; s<100; s++) {
f=iFractals(sy, tf, mode, s);
if (f!=0) return(NormalizeDouble(f, d))
}
Print("FindNearFractal(): Fractal not found");
return(0);
}

I just don't need lines on the chart, I just need two numbers (one from each of these spirit indicators).

 
palomnik:

A small addition to the description of my question.Reworked the crunch indicator.Here is the code

If you want to get an answer, respect the people reading your scribbles.

The code should be inserted using the SRC button - it's above the edit box of your post among other formatting tools.

Reason: