_2523MTF_DeMarker
Download scriptThis tool is a specialized technical analysis indicator designed to help traders identify market momentum and potential overbought or oversold conditions by looking across different time horizons simultaneously.
Core Functionality
The primary purpose of this script is to provide a "Multi-Timeframe" view of the DeMarker Oscillator. While most standard indicators only show you data based on the specific chart you are currently viewing (e.g., if you are looking at a 5-minute chart, you only see 5-minute data), this tool allows you to overlay the momentum data from a different, larger time period onto your current screen.
How it Works
The logic follows a three-step process to translate market data into a visual signal:
- Timeframe Synchronization: The script takes a specific timeframe that you choose (such as H1, H4, or Daily) and "maps" its data onto your current active chart. This allows you to see the "big picture" trends without having to constantly switch back and forth between different windows.
- Momentum Calculation: It utilizes the DeMarker Oscillator logic, which measures the relationship between the closing prices and the highs/lows of a candle. Essentially, it tells you if the current price is moving with strength or if it is becoming exhausted.
- Visual Representation: The result is displayed as a smooth line in a separate window at the bottom of your trading platform.
Key Features for Traders
- Overbought/Oversold Reference: The tool includes built-in visual levels (0.3 and 0.7). When the line moves toward these boundaries, it provides a visual cue regarding whether the market might be reaching an extreme point in its current move.
- Seamless Integration: The script automatically calculates the correct historical data points to ensure that the multi-timeframe data aligns perfectly with the candles on your current screen.
- Customizable Sensitivity: You can adjust the "Period" settings to change how many bars of data are used to calculate the momentum, allowing you to tailor the sensitivity of the tool to your specific trading style.
By using this logic, traders can better identify when a short-term move is supported by a larger long-term trend, helping to filter out "market noise" and focus on more significant price movements.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//---------------------------------------------------------------
//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, 13, iBarShift(NULL, TimeFramePeriod, Time[aShift])));
}
int start() {
for(int shift=Bars-1;shift>=0;shift--)
{
buff[shift] = getDeMarker(shift);
}
return(0);
}
Comments