Jump to content

Trend Detector MTF


Recommended Posts

Hi shabz,

you got my indi Trend Magic2_MTF.

You only have to change the name of the indicator where iCustom is called and replace CCI,ATR with the external parameters of Trend Detector. I've got version 1 of TD and that indi doesn't have any parameters...so you only have to delete CCI and ATR

Try it...it's really simple

 

edit: But don't forget that you have to save the file with an other name!!!

(File/Save As)

Edited by iwjw
Link to comment
Share on other sites

Sorry, my fault

didn't notice that the indi is running in a separate window and uses histogram instead of line

here you go

http://[email protected]/file/ZVcDB8Hb/TD2_MTF.html

 

I see you have sent the ex4 file not the mq4, I wanted to see what you did differently to what I was doing. The 4 TF version is a nice touch. Thanks for both indi's

Link to comment
Share on other sites

After the close of each candle would be enough I think, what do you say ?

 

One way to get the open of a new candle is to add a function:

 

bool IsNewBar(int theBar, int myPeriod)

{

static datetime barTime=0;

 

if(barTime<iTime(Symbol(),myPeriod,theBar))

{

barTime=iTime(Symbol(),myPeriod,theBar);

return(true);

}

return(false);

}

 

 

 

then you have to change this part:

 

MTFshift=iBarShift(NULL,HigherTF,Time[shift]);

bufferUp[shift]=iCustom(NULL,HigherTF,"Trend Detector2",0,MTFshift);

bufferDn[shift]=iCustom(NULL,HigherTF,"Trend Detector2",1,MTFshift);

 

into this and call NewBar Function:

 

if(NewBar(shift,PERIOD_M5)

{

MTFshift=iBarShift(NULL,HigherTF,Time[shift]);

bufferUp[shift]=iCustom(NULL,HigherTF,"Trend Detector2",0,MTFshift);

bufferDn[shift]=iCustom(NULL,HigherTF,"Trend Detector2",1,MTFshift);

}

you can replace PERIOD_M5 with any period you want...you could make a new parameter like the existing HigherTF and use that

Simply replace PERIOD_M5 with the name of the parameter

Link to comment
Share on other sites

Where does the first part of the code go ?

and the second part only the line if(NewBar(shift,PERIOD_M5) is added ?

and does this mean the indicator refreshes every 5 minutes ?

and can be changed to refresh at any other interval by changing PERIOD_M5 ?

 

I am a real newbie with MQL4

Link to comment
Share on other sites

Where does the first part of the code go ?

and the second part only the line if(NewBar(shift,PERIOD_M5) is added ?

and does this mean the indicator refreshes every 5 minutes ?

and can be changed to refresh at any other interval by changing PERIOD_M5 ?

 

I am a real newbie with MQL4

 

I know that it doesn't help you to improve your MQL skills if I code it, but it's easier for me:

http://[email protected]/file/wD9ZMcxK/TD2_MTFR.html

 

There's a new parameter: RefreshPeriod...if you set it to 5, the indi will refresh on open of a M5 candle

Link to comment
Share on other sites

Hi iwjw,

 

When I open MT4 platform after a while that it has been shut down, the trend detector MTF bars are missing from the point where it was closed to the current time point. If I open the indicator inputs & press ok, it will refresh & the missing data reappears. Is this because it is set to refresh per close of bar than per tick ?

 

Can we modify it so, the data loads up automatically on restart of MT4 ?

 

Thanks again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...