My script successfully compiles without any errors but won't submit a trade in the strategy tester, and my print function doesn't return a value. - page 3

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
No, it is not a small issue. I am trying to be respectful, but it seems that you will not understand if I am soft with my words.
So, I will have to be harsh so that you can understand it ... Your code is a TOTAL MESS! Even a script kiddy could do better.
I am not trying to offend you, but it seems to be the only way for you to understand the reality of the situation.
So, please, follow my advice and learn your ABCs first. Learn the basics. Start small. Study other peoples code and read the book.
... Study the examples in the CodeBase, and read the MQL5 book already mentioned, while referencing the documentation.
Or ... hire someone in the Freelance section to code it for you.
No, it is not a small issue. I am trying to be respectful, but it seems that you will not understand if I am soft with my words.
So, I will have to be harsh so that you can understand it ... Your code is a TOTAL MESS! Even a script kiddy could do better.
I am not trying to offend you, but it seems to be the only way for you to understand the reality of the situation.
So, please, follow my advice and learn your ABCs first. Learn the basics. Start small. Study other peoples code and read the book.
... Study the examples in the CodeBase, and read the MQL5 book already mentioned, while referencing the documentation.
Or ... hire someone in the Freelance section to code it for you.
Can you name one error or warning on compiling from the script you took down (ie the most recent script I uploaded)? Are you here to actually help people or to fan your tiny ego?
you, very badly -- NEED TO WATCH THE VIDEO AGAIN.
I watched part of the video, and he describes in great details about handles and copybuffer. This is the last comment that I will make on this thread. It is waste of our time to spend on a newbie that only wants to argue.
You are being argumentative and arrogant. You are the one that does not want to learn.
The post that violated the forum rules, was duplicated in post #16, and includes the the attached source code.
I have already indicated one of the major errors in your code in my post #12. In a follow-up post and code, you stated that you fixed it, but unfortunately the changes you carried out were only artificial and did not correct the main issue.
You are still committing the same mistakes ..
In other places where you tried to correct it, you are totally messing up the logic of the functions ...
In general, your code is very "stringy" and the logic very "messy". It is really bad.
I have tried to point you in the correct direction, but you have done everything to resist. It seems you are not ready to accept the advice, so this will be my last post to you.
Any further disruption, will have this whole topic removed and your account temporarily banned.
Follow the advice given ...
I assume that it's probably a very small issue that can get fixed without the dramatic effects .....
As Fernando pointed out, there are very many logic errors in your code. The one that sticks out most to me is that you assume that CopyBuffer returns data, whilst it actually returns a count of the number of bytes returned by the indicator - this assumption messes up all logic where you use CopyBuffer.
For instance:
Could be done like this, with two buffers and two calls to CopyBuffer.
As Fernando pointed out, there are very many logic errors in your code. The one that sticks out most to me is that you assume that CopyBuffer returns data, whilst it actually returns a count of the number of bytes returned by the indicator - this assumption messes up all logic where you use CopyBuffer.
For instance:
Could be done like this, with two buffers and two calls to CopyBuffer.
The OP has been banned for one day and their most recent post has been removed with the message: "Abusive, insulting or offensive language or imagery will not be tolerated."
I encourage the OP to consider being less argumentative, if they truely want to learn to properly program in MQL5.
As Fernando pointed out, there are very many logic errors in your code. The one that sticks out most to me is that you assume that CopyBuffer returns data, whilst it actually returns a count of the number of bytes returned by the indicator - this assumption messes up all logic where you use CopyBuffer.
For instance:
Could be done like this, with two buffers and two calls to CopyBuffer.
Hey Dude! Thanks for the previous assistance, do you know what usually causes the 4804, "The indicator cannot be applied to another indicator" error?
My EA I designed compiles successfully without any errors or warning, when I tested it in the strategy tester, all the other indicators loaded expected for the MA, RSI, CCI and Momentum indicators. Does anyone know what might have caused the, "Cannot load indicator[4804] error?
Thanks for everything.
Hey Dude! Thanks for the previous assistance, do you know what usually causes the 4804, "The indicator cannot be applied to another indicator" error?
My EA I designed compiles successfully without any errors or warning, when I tested it in the strategy tester, all the other indicators loaded expected for the MA, RSI, CCI and Momentum indicators. Does anyone know what might have caused the, "Cannot load indicator[4804] error?
Thanks for everything
I ran your code, and didn't see that error. I think it means that the parameters in the indicator call are wrong.
However, I did see a couple of array access issues:
In two places the call to copybuffer reads 2 buffers, when it should read 4 according to how you access the array (AOOneMinute[3] causes an array access error).
Personally, when I write an EA, I prefer to separate the indicator mechanics from the trading logic. I usually have a ReadIndicators() function in the OnTick() loop that does all the CopyBuffer calls. It is easier for debugging and maintenance.
For example - there is another block of code that does the same.
I ran your code, and didn't see that error. I think it means that the parameters in the indicator call are wrong.
However, I did see a couple of array access issues:
In two places the call to copybuffer reads 2 buffers, when it should read 4 according to how you access the array (AOOneMinute[3] causes an array access error).
Personally, when I write an EA, I prefer to separate the indicator mechanics from the trading logic. I usually have a ReadIndicators() function in the OnTick() loop that does all the CopyBuffer calls. It is easier for debugging and maintenance.
For example - there is another block of code that does the same.
You are an absolute blessing, thank you so much!