Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 246

 

Hi all! I'm writing a function for trawling the SL by MA in my EA. I get error 1 in my log. I know what this error is and why it occurs. Who knows how to fix it in this type of trawl?

 
Youri Lazurenko:

Hi all! I'm writing a function for trawling the SL by MA in my EA. I get error 1 in my log. I know what this error is and why it occurs. If i know what it is, i will try to use it as a marker.


If i look through the site, there is a description of this error, the SL has already been modified and that's why it is not modified.

 
Youri Lazurenko:

Hi all! I'm writing a function for trawling the SL by MA in my EA. I get error 1 in my log. I know what this error is and why it occurs. Please advise how to eliminate it in this type of trawl.

I gave a trawl template by MA right in this thread - search for it.

In general, the error number 1 means that you are trying to modify the price at exactly the same price. For example, you have a stop at 1.12345, and you modify it by passing the same price into the modification function --- 1.12345

 
Artyom Trishkin:

Right in this thread I gave a trawl template on MA - look it up.

And in general: error number 1 means that you are trying to modify the price to exactly the same. For example, you have a stop at 1.12345, and you modify it by passing the same price --- 1.12345 into the modification function

Thanks for the reply. About the error, what it means and why, I know. Will I have to leaf through the branch or is there an easier way, like just your posts?

 
Youri Lazurenko:

Thank you for your reply. About the error, what it means and why, I know. Will I have to scroll through the thread or is there an easier way, like just your posts?

You can look in my profile under Publications -- All posts - it's quicker to find there

Found it.

 

Good afternoon. The "PerkyAsctrend1" indicator gives the first couple of signals during visualization and then "keeps silent". Can you help me fix it?

Files:
 
Artyom Trishkin:

You can look in my profile under Publications -- All posts - you can find it there quicker

Found it.

Thanks again, found it (your way), looked it up (and kept it as a note for myself), reworked mine a bit, it seems to work. The strangest thing - if trawl by MA only (without step), it gives error 1, if trawl with step - no error.
 
Vladislav Ugrumov:

Hello. The "PerkyAsctrend1" indicator produces first couple of signals during visualization and keeps quiet after that. Can you help me fix it?


This is the well-known ASCtrend indicator. I see you have clumsily upgraded it, which is why it is silent. If you are a beginner, try writing something purely your own first. That is, your indicator itself. Because you need a good programming experience and good skills to be able to edit other people's programs.

 

Good day to you all! I'm writing this again, as I still can't get it right myself. Please help me with changing variable values. There are two variables with initial zero value. For example in my chart there are always two levels. I want to change first variable's value to "1" on reaching one level and to change it's value back to "0" on reaching another one. The second variable acts in the opposite way. Then at terminal start, the Expert Advisor will detect the last level the price was at and set the appropriate values. I hope I have described it clearly. Thanks in advance.

 
AlGuru: two variables with an initial value of zero. there are two levels on the graph. How to make the first variable change value to "1" when one level is reached and only when the other level is reached will it change value back to "0", while the second variable is reversed.

Is this how it should be? Levels -0.75 and +0.75

It is simpler to have one variable. First 0. Then +1 -1 -1 -1