Your topic has been moved to the section: MQL4 and MetaTrader 4
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Chukwuemena Okonkwo:
This is a problematic approach:
if(Use_tf_0 == true) {SetIndexBuffer(0,ha1u); SetIndexLabel(0, StringSubstr(EnumToString(tf_0),7,-1)+" (bull)");} if(Use_tf_0 == true) {SetIndexBuffer(1,ha1d); SetIndexLabel(1, StringSubstr(EnumToString(tf_0),7,-1)+" (bear)");} if(Use_tf_1 == true) {SetIndexBuffer(2,ha2u); SetIndexLabel(2, StringSubstr(EnumToString(tf_1),7,-1)+" (bull)");} if(Use_tf_1 == true) {SetIndexBuffer(3,ha2d); SetIndexLabel(3, StringSubstr(EnumToString(tf_1),7,-1)+" (bear)");} if(Use_tf_2 == true) {SetIndexBuffer(4,ha3u); SetIndexLabel(4, StringSubstr(EnumToString(tf_2),7,-1)+" (bull)");} if(Use_tf_2 == true) {SetIndexBuffer(5,ha3d); SetIndexLabel(5, StringSubstr(EnumToString(tf_2),7,-1)+" (bear)");} if(Use_tf_3 == true) {SetIndexBuffer(6,ha4u); SetIndexLabel(6, StringSubstr(EnumToString(tf_3),7,-1)+" (bull)");} if(Use_tf_3 == true) {SetIndexBuffer(7,ha4d); SetIndexLabel(7, StringSubstr(EnumToString(tf_3),7,-1)+" (bear)");}
You must keep the sequence of the buffers in correct order. You cannot assume a reliable buffering for your data, if you do not stick to the sequence.
Else, concerning your issue, please show logs to pinpoint your problem. Use some print statements to show the values, you are referring to.
Dominik Egert #:
This is a problematic approach:
You must keep the sequence of the buffers in correct order. You cannot assume a reliable buffering for your data, if you do not stick to the sequence.
Else, concerning your issue, please show logs to pinpoint your problem. Use some print statements to show the values, you are referring to.
Here it is Boss.
I ran this in the Strategy Tester. It generated the result in the first file...
I paused the tester and recompiled and it generated the second file...
The buffer values have changed.
Please why does it change?
Files:
The Arrows are drawn when the 4 buffers align.
But the buffer data changes after recompiling after being formed...
Chukwuemena Okonkwo #:
The Arrows are drawn when the 4 buffers align.
But the buffer data changes after recompiling after being formed...
Have you already fixed the buffer counting sequence?
Please add print statements into your code so that you can track what is happening according to your own logic.
As a hint, you are doing a lot of assumptions in your code, you should do much more checking of what is actually happening.
Use the Debugger to figure out what's going on, if required.
Once you have narrowed down these issues and you cannot solve your problem, you at least can provide great details about what your code is doing, and someone here on the forum is probably able to help you.
Dominik Egert #:
Have you already fixed the buffer counting sequence?
Please add print statements into your code so that you can track what is happening according to your own logic.
As a hint, you are doing a lot of assumptions in your code, you should do much more checking of what is actually happening.
Use the Debugger to figure out what's going on, if required.
Once you have narrowed down these issues and you cannot solve your problem, you at least can provide great details about what your code is doing, and someone here on the forum is probably able to help you.
Hello Boss,
Please could you point out parts of my code I made assumptions and every other thing you think I did wrong.
Dominik Egert #: This is a problematic approach:
if(Use_tf_0 == true) {SetIndexBuffer …
You should be able to read your code out loud and have it make sense. You would never write if( (2+2 == 4) == true) would you? if(2+2 == 4) is sufficient. So don't write if(bool == true), just use if(bool) or if(!bool).
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