See the above example with MTF added to the SuperTrend indi.
Add the "extern int TimeFrame = 0;
Change the "NULL, 0," to "NULL,TimeFrame,"
These are the basic steps you (or someone) can do to change the Bulls/Bears indicators (or any indicators) to make them MTF.
Recompile the indi, set your TF, and place it on your charts.
Hope this helps,
I added MTF to the indicator for you. Seems to work fine, but needs to be tested more to make sure it's doing it's job.
Here's what I changed so you can add MTF to other indicators as you need:
Added at top - extern int TimeFrame = 0; // User input - 5, 15, 30, 60, etc.
double atr = iATR(NULL,0,period,i);
double cprice = iMA(NULL,0,1,0,MODE_SMA,appliedPrice,i);
double atr = iATR(NULL,TimeFrame,period,i);
double cprice = iMA(NULL,TimeFrame,1,0,MODE_SMA,appliedPrice,i);
The attached image shows 2 indicators with 60min and 30min lines.
In the Colors Tab - You can make the colors different and the width wider to tell them apart and see the lines easier.
Hope this helps you,
MTF BearBull (sorry es trader not bars yet) and Mtf SuperTrend Nrp, Indicator BearBull needed in indicator folder for Mtf to work!
Interesting MTF Code
Thanks for your efforts to help others and for showing me an interesting way to add MTF to the SuperTrend indi... Some of your coding is a little beyond me and I'd like to learn a little more. My effort was a bare-bones basic way to change to MTF and your code has added much more to the indi.
And they definitely give different results.
The original code had no iCustom statements. I don't quite understand what indicator the iCustom is calling? It almost looks like it's calling itself? And what is the "calculate" statement for?
Also, it looks like the buffers are being used by both routines...the original code and your new iCustom statements? Plus the original code still contains the "NULL, 0" format. Is this somehow now bypassed by your new code?
BTW, if your code is more accurate/useful, I have no problem deleting my simple changed version so people don't get confused with so many versions.
Thanks in advance for your help...and I'm still enjoying learning more and more...!
I tried it the way you described ... but I failed. When I changed (0) to (TimeFrame) and tried to compile the metaeditor showed these changes as mistakes.
As MrTools changed it to MTF there was a possibility to find out what I did wrong. Sorry to say: I know I'm not able to do programming works and it is not as easy as it seems to be ... I'm only a user.
Thank you for your great work ... perhaps ... some day I will be able to understand what you are doing. I have to learn a lot.
It is a little bit complicated
I tried it again ... and this is what I changed (the changes are blue):
#property indicator_level1 0.0002
#property indicator_level2 -0.0002
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_width1 4
#property indicator_width2 2
//---- input parameters
extern int BearsBullsPeriod=13;
extern int TimeFrame=0;
//| Custom indicator initialization function |
//---- 1 additional buffer used for counting.
//---- indicator line
//---- name for DataWindow and indicator subwindow label
//| Bears Power |
for(i=0; i<limit; i++)
The attached pictures show both indicators set to M30: Chartwindow 1 shows my trial and chartwindow 2 shows MrTool's effort. Picture 1 shows them indicators added to an EURUSD M5 chart and picture 2 shows them on M30 chart.
I'm absolutely sure that MrTools shows the right indicator ... what is wrong with my kind of MTF change?
I"m sorry for posting the Mtf after your post honestly didn't see your attachment, and anyway to explain best i know how is first of all i am learning and like you enjoy learning a lot and i have especially learned everything i know about coding by the strong helping attitude of this forum, that being said this is code is from different MTF indicators posted in this thread, and its counterpart in Elite section of this forum.
Give yourself credit for trying...and learning...and actually...you coded it correctly using the basic MTF code I provided because your version compiled and worked fine...
So treat yourself to an extra dessert tonight for at least trying...and now you are an official MT4 coder and you can add these new skills to your resume....lol!
Thanks to MrTools for providing another MTF version to compare and learn from... It clearly has different results...and I'm not sure why (yet).
Which MTF indicator is more accurate?
Don't know yet, although I agree with you that it looks like MrTools MTF version matches the TF's better when you compare it with the basic BearsBulls indi charts on different TF's.
Here's what I see when I compare the code -
Your MTF code uses the original BearBulls code.
MrTools modified a MACD indicator, added iCustom calls to get the BearBulls indi values, and added his changes using the time array series that are more complex (for me) so I'm not sure how it's working (still a novice coder and still learning myself)...
So they are definitely different and worth exploring further...
I'll continue with some questions in the next post to MrTools...
Meanwhile...please let me know if you find out any more on this MTF coding and the differences...
Using Time Arrays For MTF
Thanks for your reply.
To start with, I appreciate your work and efforts to help others, so there is never any reason to apologize for your contributions.
And in this case (with your MTF versions of the SuperTrends MTF and the BearsBulls MTF), you have provided a "different" way of doing the MTF code...so it's doubly appreciated - I'm always open to a Universe of Infinite Possibilities...and I look forward to learning something new. I can't say that I understand it yet...but that's the intrigue...
I do have a few questions for you:
I would like to understand why the MTF changes were not done directly in the BearBulls original code and instead make another indicator to iCustom call the indicator? Seems doing the MTF in the original code would be the much simpler way to do it (faster operation, less CPU cycles, etc.)?
The biggest difference in your MTF code compared to the basic MTF coding is that you use Time Arrays. How does the TimeArray code work? And why are the results different from the basic MTF coding?
Hopefully you can help us understand your MTF Time Array version better...and/or some other good coders can help explain why they produce different results.
Again thanks for your help to others!
thank you very much for your kind words. I hope I will learn much more ... ok: I have to learn much more.
Have a nice weekend