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

 
What in mql4 is a nice way to limit losses (stop the EA) if everything went wrong? I've invented only to reset maximum AccountEquity() value in ini file from time to time and stop trading if current value of AccountEquity() is less by some defined percentage than saved one. Please advise.
 
igrok2008 писал(а) >>
The above examples describe the buy and sell code for CCI, RSI and WPR. Why exactly these indicators are used? In my opinion they are the easiest to learn how to build an Expert Advisor. The buy and sell principle is the same for them. less than -100 (for CCI), -70 (for RSI) and 20 (for WPR), respectively sell will be: +100, -30 and 80. It seems to me (crossed more than once) that the errors are in the trading conditions, but where I don't understand..... It's about the principle of WRITING the trading conditions correctly (I think so).............. That's what I wanted to ask you........
double CCI = NormalizeDouble(iCCI(NULL, 0,Period,PRICE_CLOSE,1), Digits);

if(CCI[1] > -100)
wait a minute, where does this SSI[1] come from ?
it turns out that the code does not compile, so no compilation is wrong?
 
MuruFigi писал(а) >>
What in mql4 is a nice way to limit losses (stop the EA) if everything went wrong? I've invented only to reset maximum value of AccountEquity() in ini file from time to time and if current value of AccountEquity() is less by some defined percentage than saved one, then stop trading. Please advise.

Look for the equity and balance indicator by Surgeon. It's in CodeBase.

 
Korey >> :
Wait a minute, where is it CCI[1]?
it turns out that the code does not pass the compilation, i.e. the absence of compilation is wrong?

CCI[1]is the CCI for the first bar.

What is compilation? Compiling an EA (indicator, script) is what you do in the metaeditor by pressing F5 (compile) ??????????

I think, because the first bar is not yet formed, so the calculation should be done on the first bar. Hence the CCI[1]. What am I wrong about??????

 
igrok2008 >> :

>> what I'm wrong about??????

In everything. The counsellors have already scattered, realising that you still need to read a textbook in order to grasp the basic concepts. Otherwise there will be no conversation.

For example, CCI[1], even a "programmer" like me reads as a cell call of an array named CCI and indexed [1]. What did you mean by that?

 
granit77 >> :

In everything. The counsellors have already scattered, realising that you still need to read a textbook in order to grasp the basic concepts. Otherwise, the conversation will not work.

For example, even a "programmer" like me reads CCI[1] as a call of an array cell with name CCI and index [1]. What do you mean by that?

About the same. How about the link to the tutorial? Or is it MQL4 tutorial "MQL4Bookrussian"??????????????

 
igrok2008 >> :

Roughly the same thing.

How about a link to a textbook? Or maybe it's the MQL4 tutorial "MQL4Bookrussian"???????????????

1. If it is the same, where and why did you declare (create) this array? You can call something that exists.

2. Link Tutorial at the top of the page. I personally found Rosh's articles more suitable.

 
granit77 >> :

1. If the same, where and why did you declare (create) this array? You can call whatever exists.

2. Tutorial link at the top of the page. I personally found Rosh's articles more suitable.

1 entry CCI[1]>-100 is a trade condition to buy

2 read (superficially though) the tutorial, read up to 30 pages of KimIV useful functions, read articles "for dummies" and nowhere to find the answer to the question WHY the token condition SHOULD be written this way if(bullshit know what<*****&& bullshit know how>******). Why should it be.

tratat AND trat, not just if(trat<******). That's what's not clear to me. Of course vinin explained to me earlier (for MA) clearly what's what, BUT WHY you MUST USE logical AND ..... unexplained.................

Haven't gotten to Rosha's articles yet, thanks for the tip.............

 
igrok2008 >> :

1 entry CCI[1]>100 is a buy trade condition

Why should it be tratata AND trututu and not just if(tratata<******). That's what's not clear to me. Of course vinin explained to me earlier (for MA) intelligibly what's what, BUT WHY you MUST USE the logical AND ..... unexplained........

1. It's not about what kind of condition it is, it's about what you are comparing and with what. You think that you are comparing the value of the CCI indicator with the level, while instead of the indicator you are writing the value of a cell of a non-existent and unnecessary custom array CCI[] that just has the same name, i.e., empty space. This is a gross error that the compiler will not be able to compile.

2. If you are taking a signal from an arrow indicator in which a value appears only when a condition occurs, you are writing:

if(trata>0) enter; This is because the signal is discrete, if there is no arrow the buffer is empty and there is nothing else to check

If you track the indicator line crossing a certain level ( the buffer is full of line, the signal is analogue), then this writing if(trata>level) will cause continuous signal to input as long as the indicator line is above the level. But that's not what you want, you want to get a signal at the moment of crossing. And the moment of crossing is caught precisely through the tratata and trutata.

That is, we read and write into the variables the CCI values on the zero bar and the first bar. We check if the CCI was higher on the first (previous) bar. If the CCI on the zero bar has already fallen below this level, then a cross has occurred. Combine these two conditions with a logical AND and we get a single cross signal.

//объявляем переменную cci_0 и присваиваем ей значение индикатора CCI на нулевом (текущем) баре
double cci_0=iCCI(NULL,0, CCIperiod, CCIprice,0);
//объявляем переменную cci_1 и присваиваем ей значение индикатора CCI на первом (предыдущем) баре
double cci_1=iCCI(NULL,0, CCIperiod, CCIprice,1);
//если значение индикатора CCI на нулевом (текущем) баре уже меньше уровня 100
//а предыдущее его значение (на первом баре) было больше уровня 100
//значит произошло пересечение, и мы даем сигнал на продажу
if( cci_0<100 && cci_1>100) SignalSell=true;
 
granit77 >> :

1. It's not about what condition it is, it's about what you're comparing and to what. You think that you are comparing to the level of CCI indicator, but instead of the indicator you are writing the value of a cell of non-existing and unnecessary cell that just has the same name as the user array CCI[], i.e., empty space. This is a gross error that the compiler will not be able to compile.

2. If you are taking a signal from an arrow indicator in which a value appears only when a condition occurs, you are writing:

if(tratata>0) enter; This is because the signal is discrete, if there is no arrow, the buffer is empty and there is nothing else to check

If you track the indicator line crossing a certain level ( the buffer is full of line, the signal is analogue), then this writing if(trata>level) will cause continuous signal to input as long as the indicator line is above the level. But that's not what you want, you want to get a signal at the moment of crossing. And the moment of crossing is caught precisely through the tratata and trutata.

That is, we read and write into the variables the CCI values at bar zero and bar one. We check if the CCI was higher on the first (previous) bar. If the CCI on the zero bar has already fallen below this level, then a cross has occurred. Combine these two conditions with logical AND and we get a single cross signal.

wo......Wo.......Wo.............. understand.... understand.....shaz this afternoon I will reply THANK YOU to granit77. Even at first glance, you can see YOU have angelic patience,

not like the teachers at school today.....

Reason: