Forex
Google

Go Back   Forex Trading > Downloads > Indicators - Metatrader 4
Forex Forum Register FAQ Members List Calendar Today's Posts


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack (214) Thread Tools Display Modes
  91 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 02-20-2006, 09:54 PM
keris2112's Avatar
keris2112 keris2112 is offline
Senior Member
 
Join Date: Dec 2005
Location: California, US
Posts: 129
keris2112 is on a distinguished road
Multi Timeframe Indicators

Hi all,
I've been wanting to have the ability to plot indicators from different timeframes on my chart, but MT doesn't have this capability built in. (Does anyone know of any charting programs that do this natively?) As an example, if you're following the IWCR system, it'd be nice to be able to plot the Daily RSI on your 5 Min. chart.

When I put together the Daily Volitily Breakout indicator, that sorta did what I wanted in that it allowed you to add it to any timeframe (Daily or less) and see where the daily breakout point would be. The problem was that it was limited to only showing the Daily value.

About 2 weeks ago I came across Igorad's Price Channel Stop indicator and it seemed to do what I wanted (with regard to mulitiple timeframes). I started trying to use the Price Channel indicator as a template, adding code from other indicators and tweaking it to work within the new structure, but they never seemed to work. (I'm still not a very good coder.) Then last night I had a "breakthrough": If I can't figure out how to properly add the code from the other indicators, why not just Reference them, with their iName or iCustom? So, that's what I did. And, it works great.

Here are a few things to keep in mind when using these:
1) TimeFrame is the input you use to specify what timeframe to pull the data from.
2) You must set TimeFrame in minutes (1,5,15,30,60,240,1440,10080,43200)
3) By default, TimeFrame is set to 0, which means that it will use whatever the current timeframe is, i.e it will act as the original indicator.
4) If you set TimeFrame to anything other than 0, it must be >= current timeframe. (In other words, don't use a M15 PSar on an H1 chart. The values won't be correct. An H1 PSar on an M15 chart works properly.)

I've setup 5 Multi-TimeFrame (MTF) indicators to use as examples. You can open them up and use the code as a template so that you can make any existing indicator MTF. Please don't post asking for other indicators to be made, as the thread will soon turn into one big 'please do this for every MT4 indicator'. It's really, really simple to do, and if you don't know how to code, spend a week reading Coder Guru's MT4 programming guide and you'll be able to do it.

If I have time, I'll add more. Hopefully others will add their MTF conversions to the thread.

Multi-TimeFrame set 1 contains:
#MTF_MovingAverage.mq4
#MTF_PSar.mq4
#MTF_RSI.mq4
#MTF_MACD.mq4
#MTF_CCI.mq4

The attached chart is the following:
M5 Chart with LimeGreen PSar
M15 PSar
M60 SMA(13)
H4 CCI
M30 MACD
H1 RSI

Well, I hope these come in handy for some of you. Thanks Igor, for your fantastic coding skills. I've learned a lot just by studying your code.

Keris

EDIT:
Added #MTF Set 2.zip on 3/4/06 ---- (Bollinger Bands, Juice, Linear Price Bar, Price, Stochastic)
Attached Images
File Type: gif #mtf example.gif (17.0 KB, 29081 views)
Attached Files
File Type: zip #MTF Set 1.zip (6.6 KB, 5701 views)
File Type: zip #MTF Set 2.zip (9.2 KB, 4863 views)

Last edited by keris2112 : 03-05-2006 at 02:11 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-20-2006, 11:12 PM
keris2112's Avatar
keris2112 keris2112 is offline
Senior Member
 
Join Date: Dec 2005
Location: California, US
Posts: 129
keris2112 is on a distinguished road
Linear Price Bar

Here's one more MTF indicator. It's based on a custom indicator (you can view the code to make your own).

It's called #MTF_LPB.mq4 (Linear Price Bar) Here's the link to the thread for info on the indicator: Linear Price Bar

Attached are 2 indicators. You need both in your indicators folder as the MTF version references the original indicator.

Linear Price Bar.mq4
#MTF_LPB.mq4

Keris
Attached Files
File Type: mq4 Linear Price Bar.mq4 (2.7 KB, 2123 views)
File Type: mq4 #MTF_LPB.mq4 (3.8 KB, 1999 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-21-2006, 03:49 AM
sailor sailor is offline
Senior Member
 
Join Date: Oct 2005
Posts: 223
sailor is on a distinguished road
thanks for info very usefull for me :-)

Sailor
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-21-2006, 06:13 AM
TheShanghai's Avatar
TheShanghai TheShanghai is offline
Junior Member
 
Join Date: Dec 2005
Posts: 23
TheShanghai is on a distinguished road
Just wanted to say thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-21-2006, 02:27 PM
schwager schwager is offline
Member
 
Join Date: Oct 2005
Location: Germany
Posts: 62
schwager is on a distinguished road
Mtf

Hello!
one of me!
Attached Files
File Type: mq4 MTF-Dinapoli_Target.mq4 (2.3 KB, 2422 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-21-2006, 05:14 PM
keris2112's Avatar
keris2112 keris2112 is offline
Senior Member
 
Join Date: Dec 2005
Location: California, US
Posts: 129
keris2112 is on a distinguished road
Quote:
Originally Posted by schwager
Hello!
one of me!
Thanks schwager!

Also, since Dinapoli Targets is a custom indicator, could you add the original DinapoliTargets.mq4 file to your post. People are going to need both files to make the MTF version work.

Keris
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-21-2006, 06:26 PM
schwager schwager is offline
Member
 
Join Date: Oct 2005
Location: Germany
Posts: 62
schwager is on a distinguished road
Dinapoli

ups sorry.........

http://www.forex-tsd.com/attachments...4?d=1129363521
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-22-2006, 01:39 AM
ycomp's Avatar
ycomp ycomp is offline
Member
 
Join Date: Jan 2006
Posts: 93
ycomp is on a distinguished road
maybe this is helpful to you

I wrote one for demarker the other day. I think I scrutinized it but can't remember exactly. Anyhow easy enough to check, just compare it with a real demarker on another chart.

Just change the getDeMarker function to getRSI() or getCustomIndicator() (and use iCustom in that function) or whatever, if you want to base it on another indicator.
Attached Files
File Type: mq4 MTF_DeMarker.mq4 (2.6 KB, 1735 views)

Last edited by ycomp : 02-22-2006 at 12:49 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-22-2006, 07:07 PM
vimpson vimpson is offline
Junior Member
 
Join Date: Nov 2005
Posts: 10
vimpson is on a distinguished road
Thanx Keris, you put well!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-22-2006, 08:08 PM
ycomp's Avatar
ycomp ycomp is offline
Member
 
Join Date: Jan 2006
Posts: 93
ycomp is on a distinguished road
small bug in MTF_DeMarker

code I posted works but DeMarker is displayed as a period of 13 only. Here is the fixed copy that actually uses the DeMarkerPeriod variable.

can't seem to upload a file anymore though... it just says page not found.. therefore here are the instructions to change it:

just open in notepad and paste this text below and save it as "MTF_DeMarker_v1.mq4"

Code:
//---------------------------------------------------------------
//PARAMS:
//- TimeFramePeriod: # of minutes in TF. 
//  NOTE: I did not test non-standard TFs or a TimeFramePeriod
//        value less than that of current chart. So they probably
//        won't work.
// - DeMarkerPeriod: self explanatory
//---------------------------------------------------------------

#property copyright "Copyright  2006 ycomp"
#property link      "ycomp"

#define MIN_BARS_REQUIRED 200 // Just a safe amount here. Probably needs much less.


//--- Indicator Settings
#property indicator_separate_window

#property indicator_level1 0.3
#property indicator_level2 0.7

#property indicator_buffers 1

#property indicator_color1 DodgerBlue
#property indicator_width1 2

#property indicator_maximum 1
#property indicator_minimum 0

//---- input parameters

extern int TimeFramePeriod;

extern int DeMarkerPeriod = 14;

//---- buffers
double buff[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  if (Bars < MIN_BARS_REQUIRED) return (-1);

  IndicatorDigits(Digits);
    
  SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
  SetIndexBuffer(0, buff);  
  
  string paramDesc =
    "(" +
      getPeriodDesc(TimeFramePeriod) + ", " +
      DeMarkerPeriod +
    ")";
                      
  IndicatorShortName("MTF_DeMarker" + paramDesc);

  // Set Index Labels
  SetIndexLabel(0, "MTF_DeM" + paramDesc);   

  return(0);
 }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }

string getPeriodDesc(int aNumMinutes) {
  switch (aNumMinutes) {
    case PERIOD_M1 : return("M1");
    case PERIOD_M15: return("M15");
    case PERIOD_M30: return("M30");
    case PERIOD_H1 : return("H1");
    case PERIOD_H4 : return("H4");
    case PERIOD_D1 : return("D1");
    case PERIOD_W1 : return("W1");
    case PERIOD_MN1: return("MN1");
    case 0: return ("Chart");
    default: return ("M" + aNumMinutes);
  }
}


double getDeMarker(int aShift) {
  return (iDeMarker(NULL, TimeFramePeriod, DeMarkerPeriod, iBarShift(NULL, TimeFramePeriod, Time[aShift])));
}


int start() {

  for(int shift=Bars-1;shift>=0;shift--)
  {
  
    buff[shift] = getDeMarker(shift);
    
  }

  return(0);
 
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/indicators-metatrader-4/1077-multi-timeframe-indicators.html
Posted By For Type Date
MTF BB-Squeeze - MQL4 Code Base Post #1870 Refback 07-03-2008 03:32 AM
Weekly_HILO. - MQL4 Code Base Post #2066 Refback 06-25-2008 05:45 AM
ڳΥMetaTrader鿴ѣڤȤѡ - MetaTraderޤȤWiki Post #1124 Refback 06-22-2008 01:31 PM
My MT4 modified indicators and collection - Page 7 Post #1177 Refback 06-22-2008 11:30 AM
Weekly_HILO. - MQL4 Code Base Post #2066 Refback 06-20-2008 04:56 AM
EESFX This thread Refback 06-19-2008 02:17 PM
Signal_Bars_MFI - MQL4 Code Base Post #2210 Refback 06-18-2008 10:24 PM
Signal_Bars_MFI - MQL4 Code Base Post #2210 Refback 06-17-2008 06:18 PM
Signal_Bars_MFI - MQL4 Code Base Post #2210 Refback 06-16-2008 10:29 PM
RSS-: Post #1652 Refback 06-15-2008 03:06 PM
4 - Forex This thread Refback 06-13-2008 06:00 PM
Блог Post #1652 Refback 06-12-2008 02:17 PM
eNjJɂ‚Č낤Part4 Post #977 Refback 06-11-2008 12:15 PM
Все индикаторы Форекс: Май 2008 Post #1684 Refback 06-09-2008 10:47 AM
LinearRegSlope_v1 - MQL4 代码基地 Post #1901 Refback 06-09-2008 08:52 AM
My MT4 modified indicators and collection - Page 7 Post #1177 Refback 06-08-2008 08:54 PM
My MT4 modified indicators and collection - Page 7 Post #1177 Refback 06-08-2008 04:15 PM
Tro_Range - MQL4 Code Base Post #1652 Refback 06-08-2008 07:06 AM
Tro_Range - MQL4 代码基地 Post #1652 Refback 06-07-2008 09:40 PM
Все индикаторы Форекс: Индикатор Tro_Range Post #1652 Refback 06-07-2008 06:32 PM
4 - Forex This thread Refback 06-06-2008 09:38 AM
MTF Stochastic 4TF Post #2168 Refback 05-31-2008 02:26 PM
My MT4 modified indicators and collection - Page 7 Post #1177 Refback 05-31-2008 05:41 AM
LinearRegSlope_v1 - MQL4 Code Base Post #1901 Refback 05-30-2008 01:42 PM
LinearRegSlope_v1 - MQL4 Code Base Post #1901 Refback 05-30-2008 09:32 AM
LinearRegSlope_v1 - MQL4 Code Base Post #1901 Refback 05-30-2008 05:21 AM
Otcfx_b-clock modified V3.2 - MQL4 Code Base Post #1786 Refback 05-27-2008 08:21 AM
BZ_TL_SkylineM - MQL4 代码基地 Post #1684 Refback 05-24-2008 05:49 AM
BZ_TL_SkylineM - MQL4 Code Base Post #1684 Refback 05-22-2008 06:16 AM
CCI Woodies Post #2086 Refback 05-08-2008 01:35 PM
MTF BB-Squeeze - MQL4 代 基地 This thread Refback 05-03-2008 09:52 AM
sr ZIGZAG indicator - Forex Trade swicki - powered by eurekster This thread Refback 04-29-2008 08:49 AM
MTF BB-Squeeze - MQL4 Code Base This thread Refback 04-29-2008 07:45 AM
MTF BB-Squeeze - MQL4 Code Base This thread Refback 04-29-2008 07:28 AM
CCI Woodies Post #2086 Refback 04-28-2008 02:59 PM
CCI Woodies Post #2086 Refback 04-27-2008 04:01 PM
FanSimple8_4MEn - MQL4 Code Base Post #2087 Refback 04-26-2008 10:29 PM
MTF Macd_Bars - MQL4 Code Base Post #432 Refback 04-25-2008 01:25 PM
MTF Macd_Bars - MQL4 Code Base Post #432 Refback 04-25-2008 06:34 AM
AMA Slope - MQL4 代 基地 Post #901 Refback 04-24-2008 05:36 PM
MTF_HI_LOW_v1 - MQL4 Code Base Post #471 Refback 04-24-2008 03:08 PM
MTF_HI_LOW_v1 - MQL4 Code Base Post #471 Refback 04-24-2008 10:24 AM
AMA Slope - MQL4 Code Base Post #901 Refback 04-23-2008 07:01 AM
All ADX, RSI, CCI. - MQL4 Code Base Post #950 Refback 04-23-2008 05:54 AM
AMA Slope - MQL4 Code Base Post #901 Refback 04-22-2008 06:43 PM
AMA Slope - MQL4 Code Base Post #901 Refback 04-22-2008 05:55 PM
MTF Macd_Bars - MQL4 代 基地 Post #432 Refback 04-20-2008 01:54 PM
MTF_HI_LOW_v1 - MQL4 代 基地