EA N7S_AO_772012 - page 29

 
boing9267 >> :

>>What exactly shocks you, can you be more specific?

It's really confusing. The variable names are a nightmare. Half of the variables are global, but they are not. In short, now I'm rewriting everything to understand how it all works.

 
:) I've also started redoing it for myself, I think I'll be able to compare options over the weekend :)
 
boing9267 >> :
:) I also started redoing it for myself, I think I'll finish it at the weekend so we can compare options :)

See! So I'm not the only one who doesn't understand :)

 
I think it's even better for learning the code, by the way:). So thanks to the shooter for that
 
boing9267 >> :
I think it's even better for learning the code:). So thank you to the shooter for that.

check out the personal messages.

 
mpeugep писал(а) >>

Interesting observation! And if you can - name the DC, at least the first letter)

А

 
rtr989 писал(а) >>

sorry for possibly stupid question... Tell me, and all these optimizations are somehow related to each other, I mean stage-2 is based on data after stage-1? after the first stage, I load _stage_2=y_l3.set and those input parameters that were after the first optimization as I understand it are replaced by those prescribed in _stage_2=y_l3.set? what then the meaning of the first optimization? or am i mistaken and am i doing something wrong? now i'm doing the following: i load _step_1=x_l3.set, optimize it, choose the best result in my opinion, right click "set input parameters", run it through the tester, then load _step_2=y_l3.set, check the box for optimization... and so 6 optimizations, after the 6th optimization I get the set I need, am I doing it right?

You are doing everything correctly. And you understand almost everything right. Except for the fact that the optimization set files like _step_2=y_l3.set are specially written by me, which when loaded sequentially in no way affect the values obtained earlier. >>About dependency, first and second steps don't depend on each other (almost :-)) third one depends on two (first and second) fourth one on three, fifth one also depends on three and almost doesn't depend on fourth one, while sixth one depends on all of them.

 
ShestkoFF писал(а) >>

Today I decided to try to understand how an Expert Advisor works and I was shocked. It all looks very confusing to me.
I wonder if anyone besides SHOOTER777 understands how an EA operates? I do not mean how it should be optimized but how it works.

Sorry, but this is one of, if not the easiest of my EAs. In others, even I can't figure it out quickly after some time - I forget, and explaining to others how and what works is a pain in the ass (there were even hints that I did not do it). I tried to share my code with them, that they could help me to correct some moments or improve it, but.... Although I try to create codes mainly via functions, it's more clear and easy to understand. I'd like to learn how to give concise comments in code...

 
ShestkoFF писал(а) >>

It's really confusing. The variable names are a nightmare. Half of the variables are global, although they are not. In short, now I'm rewriting everything to understand how everything works.

There may be "cracks" in variables. I have not studied programming in details, so -say me tips, constructive criticism is welcome.

 
SHOOTER777 >> :

There may be "problems" with the variables. I haven't studied programming in detail, so tips, constructive criticism is welcome.

I don't like to criticize things that work. I will just give you some criticism of the code:

  • You don't have to write everything in a line, it's impossible to read the code that way. For example, the initialization code of the Expert Advisor
int init(){ MMH1 = Hour( ); LFB  = iTime(Symbol(), 0, 0); H1();
Delta_G12 = G12(); if ( IsOptimization( )  ) TrBlnc = false;//if ( IsTesting() ) TrBlnc = false;
if ( VSR () !=0) { Flg=false;} else { Flg=true;}
cmmnt();}

I think you'd better write

int init(){
	expertInitHour = Hour();
	SYMBOL = Symbol();
	lastBarTime  = iTime(NULL, 0, 0); 
	H1();
	AO_Delta = indicatorDelta(); 
	if (IsOptimization()) {
		TrBlnc = false;
	}
	if ( VSR() != 0) {
		Flg=false;
	} else {
		Flg=true;
	}
	cmmnt();
}

The code becomes more readable but even with this replacement it remains unclear what H1, VSR, Flg are.

  • Name the variables in a meaningful way. It is better to spend a couple of minutes longer to think up a variable or function name, but then it is easy to remember what it is for. Example: The G12 function - what is it for? It calculates the delta between the last indicator values (you have it even selecting the variant of the indicator). Well, it should be called indicatorDelta, it's much easier and clearer.
  • Do not make variables global, if they are local. I don't remember, in what function I have seen it.
  • Not making global variables static does not make sense. If this is not the case please explain.
  • Use standard constants defined in the language. For example, to specify a time interval. double iA_C (int pr){int tmfr=60; return(iAO(Symbol(), tmfr, pr));} seems better replaced with double iA_C (int pr){return(iAO(Symbol(), PERIOD_H1, pr));}.


I will try to rewrite this EA and make it clearer to myself and perhaps to others as well.

Thank you very much for sharing your idea. It's very nice that you share your work and post the results every week.
Apologies for the criticism :)

Reason: