Download MetaTrader 5

Triangular moving average (TMA) ... - page 4

To add comments, please log in or register
Mladen Rakic
71790
Mladen Rakic  

...

"I used Symbol() instead NULL for symbol - is that the reason why it went wrong?"

No. In the version of centered TMA you are using (the one you removed) the first parameter is TimeFrame. If you did not specify the "" after the "TMA" in a parameters of iCustom() call, it was not working as it should. You can leave out all the values for alerts in the iCustom() and then use it like this (after all you do not expect it to alert from the EA):

iCustom(Symbol(), PERIOD_M15, "TMA", "", HalfLength, Price, ATRMultiplier, ATRPeriod, Interpolate, 0, 1)
iMAG:
Thanks man, U're the best!

So, I shall use smth like this:

tma1 = iCustom(Symbol(), PERIOD_M15, "TMA", "", HalfLength, Price, ATRMultiplier, ATRPeriod, Interpolate, 0, 0, 0, 0, 0, 0, 0, 1);

(0=false for Alerts)

???

HOW THIS??? I used Symbol() instead NULL for symbol - is that the reason why it went wrong?
iMAG
9
iMAG  
mladen:
Most probably you are forgetting the first parameter (I see that you removed the indicator you are using, but in that one you have one extra parameter as the first parameter) Here us how the call should look like (a very simple test EA that withdraws correct values of centered TMA line - use the TMACentered indicator from post #3 for testing, abd set the half length values to same values)

Yeah, I'm sorry! I thought that this is Your indie and You know it very well. It was TimeFrame as first parameter and before posting here I tried combining iCustom(Symbol(), 0, "TMA", 15 ... ) and iCustom(Symbol(), PERIOD_M15, "TMA", "", ... ) and so on. Although, I am not sure I had tried Your version iCustom(NULL, PERIOD_M15, "TMA", "", ...). Could it be just in using "NULL" instead of "Symbol()"?

Mladen Rakic
71790
Mladen Rakic  

...

That version of the indicator you first posted is also mine, so I do know how it works

Read my previous post for explanation

iMAG:
Yeah, I'm sorry! I thought that this is Your indie and You know it very well. It was TimeFrame as first parameter and before posting here I tried combining iCustom(Symbol(), 0, "TMA", 15 ... ) and iCustom(Symbol(), PERIOD_M15, "TMA", "", ... ) and so on. Although, I am not sure I had tried Your version iCustom(NULL, PERIOD_M15, "TMA", "", ...). Could it be just in using "NULL" instead of "Symbol()"?
iMAG
9
iMAG  
mladen:
That version of the indicator you first posted is also mine, so I do know how it works Read my previous post for explanation

Yes, Mladen, it's a kind of pre-moderation, that's why I have missed Your previous post. Thanks for Your time, wish I knew it before ))

BTW, have I said "Thanks, Mladen, for such a great stuff?"

mladen:
If you did not specify the "" after the "TMA" in a parameters of iCustom() call, it was not working as it should

Why these things happen? Could You pass me a link to a thread with discussions on MTF indicators? It would be great!

Thanks again && have a good luck!

Mladen Rakic
71790
Mladen Rakic  

...

Why these things happen?Could You pass me a link to a thread with discussions on MTF indicators?

It is all about passing parameters.

An example : you indicator has parameters p1,p2, and p3. Yopu can call it in the following forms

//

// p1,p2 and p3 will have default values

//

double value1 = iCustom(NULL,0,"Your indicator",0,0);

//

// p2 and p3 will have default values

//

double value2 = iCustom(NULL,0,"Your indicator",p1,0,0);

//

// p3 will have default values

//

double value3 = iCustom(NULL,0,"Your indicator",p1,p2,0,0);

//

// no default values

//

double value4 = iCustom(NULL,0,"Your indicator",p1,p2,p3,0,0);

[/PHP]

But you can not do, for example, this :

[PHP]double value2 = iCustom(NULL,0,"Your indicator",p2,0,0);

Since then p1 will receive value of p2 and that will cause unpredictable behavior

So, all you have to do is to take care that you do not omit any of the parameters from the beginning of the parameters list and everything will be OK.

iMAG:
Yes, Mladen, it's a kind of pre-moderation, that's why I have missed Your previous post. Thanks for Your time, wish I knew it before ))

BTW, have I said "Thanks, Mladen, for such a great stuff?"

Why these things happen?Could You pass me a link to a thread with discussions on MTF indicators? It would be great!

Thanks again && have a good luck!
iMAG
9
iMAG  
mladen:
It is all about passing parameters.

...............

So, all you have to do is to take care that you do not omit any of the parameters from the beginning of the parameters list and everything will be OK.

Hi again! I bet You missed me! :lol:

Thanks for explanation. It does have some reason, unfortunately I know that but something is still missed. I made some changes in EA. Now it is running in real-time on a graph and the same EA is being back-tested. In back test values are different from the graph painted, while real-time values returned into the EA are the same as the indicator on the graph. It's confusing!

"Ooops, I did it again."

Mladen Rakic
71790
Mladen Rakic  

...

Judging from the code you were posting, just a wild guess : you can not back-test multi time frame indicators and EAs the same way as the regular ones. In multi time frame mode metatrader is taking real data of the target time frame, not the simulated data. Take a look at this thread : https://www.mql5.com/en/forum/general and I am sure you will find a lot of answer as of how to back-test and what to expect during back-test

iMAG:
Hi again! I bet You missed me! :lol:

Thanks for explanation. It does have some reason, unfortunately I know that but something is still missed. I made some changes in EA. Now it is running in real-time on a graph and the same EA is being back-tested. In back test values are different from the graph painted, while real-time values returned into the EA are the same as the indicator on the graph. It's confusing!

"Ooops, I did it again."
iMAG
9
iMAG  
mladen:
Judging from the code you were posting, just a wild guess : you can not back-test multi time frame indicators and EAs the same way as the regular ones. In multi time frame mode metatrader is taking real data of the target time frame, not the simulated data. Take a look at this thread : https://www.mql5.com/en/forum/general and I am sure you will find a lot of answer as of how to back-test and what to expect during back-test

OK, thanks! So, let me guess, mtf indicators use "future" values, don't they? Then let us use IsTesting() and not letting the indicator use "future" data at all! Of course, we cannot artificially cut off the quotes stream of the testing engine, but probably we could prohibit the indie itself from using them. Earlier in this thread You mentioned that TMA is the same as LWMA, then we could use LWMA when IsTesting() == true. It could be a reason to add some functionality to the EA for testing. Any suggestions?

Thanks

Mladen Rakic
71790
Mladen Rakic  

...

You mean we should "tweak" a little bit how metatrader works Good luck with it

________________________________________________

PS: I told that "non repainting (end pointed) centered TMA is equal to LWMA" I never told that TMA (triangular moving average) is the same as LWMA (linear weighted moving average). TMA and LWMA are two different indicators

iMAG:
OK, thanks! So, let me guess, mtf indicators use "future" values, don't they? Then let us use IsTesting() and not letting the indicator use "future" data at all! Of course, we cannot artificially cut off the quotes stream of the testing engine, but probably we could prohibit the indie itself from using them. Earlier in this thread You mentioned that TMA is the same as LWMA, then we could use LWMA when IsTesting() == true. It could be a reason to add some functionality to the EA for testing. Any suggestions? Thanks
iMAG
9
iMAG  
mladen:
You mean we should "tweak" a little bit how metatrader works

Good luck with it

Well, I will go further "looking for the sun".

PS: I told that "non repainting (end pointed) centered TMA is equal to LWMA" I never told that TMA (triangular moving average) is the same as LWMA (linear weighted moving average). TMA and LWMA are two different indicators

I apologize, English is not my best performance.

Anyway, I'm gonna build my EA using TMA. The only bad thing is that the testing will be performed on a demo (or some cent) account.

Again thanks and have a good luck!

To add comments, please log in or register