MTF_OsMA_Lc_v1
Download scriptThis tool is designed to provide traders with a multi-timeframe analysis of market momentum and trend direction by blending data from different periods into a single visual display. Instead of forcing you to switch back and forth between different charts (like moving from a 1-hour chart to a 4-hour chart), this script pulls the relevant information automatically to help you see the "big picture" while looking at your current timeframe.
Core Functionality
The logic operates by acting as a bridge between two timeframes. It identifies specific trend signals from a higher timeframe—which you can choose in the settings—and maps those results onto your active chart. This allows you to identify whether the broader market trend is moving in your favor before you make a trade on a smaller, more detailed scale.
How the Logic Works
- Data Retrieval: The script looks for a specific underlying indicator (the "OsMA_Lc") that calculates moving averages. It specifically tracks two different data streams: one representing the primary trend movement and another representing a signal line.
- Timeframe Synchronization: The tool is built to handle the complexity of time alignment. It calculates where each bar on your current chart matches up with the historical bars of the higher timeframe you have selected. This ensures that the information displayed is accurate and synchronized with the correct moment in time.
- Visual Representation: The results are plotted as two distinct lines in a separate window below your main price chart.
- The first line typically represents the smoothed trend data.
- The second line represents the signal component.
Practical Application
By using this logic, you can stay on your preferred trading screen while visually monitoring the momentum of a larger time period. If the lines on the indicator window show a specific direction, it tells you what the "larger" market is doing. This helps filter out "noise" and ensures that your trades are aligned with the dominant price action across multiple layers of the market.
//+-----------------------------------------------------------------------+
//| MTF_OsMA_Lc |
//| Copyright © 2007, SOK |
//| http://SOK.LiteForex.net |
//| www.metaquotes.net/mtf / www.forex-tsd.com ik |
//+-----------------------------------------------------------------------+
#property copyright "Copyright © 2007, SOK"
#property link "http://sok.liteforex.net"
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_color2 Magenta
#property indicator_width1 2
#property indicator_width2 2
//----
extern int TimeFrame=0;
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
extern int AplyingPrice=0;
//----
double ExtMapBuffer0[];
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0, DRAW_LINE, 0, 2);
SetIndexBuffer(0, ExtMapBuffer0);
SetIndexStyle(1, DRAW_LINE, 0, 2);
SetIndexBuffer(1, ExtMapBuffer1);
IndicatorShortName("MTF_OsMA_Lc[" + FastEMA + ", " + SlowEMA + ", " + SignalSMA + "]TF ("+TimeFrame+")");
SetIndexLabel(0,"MTF_OsMA_Lc,[" + FastEMA + ", " + SlowEMA + ", " + SignalSMA + "]TF ("+TimeFrame+")");
SetIndexLabel(1,"MTF_OsMA_Lc,[" + FastEMA + ", " + SlowEMA + ", " + SignalSMA + "] TF ("+TimeFrame+")");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator start function |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,shift,limit,y=0,counted_bars=IndicatorCounted();
//----
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
//----
limit=Bars-counted_bars+TimeFrame/Period();
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) {y++;}
ExtMapBuffer0[i]=iCustom(NULL, TimeFrame, "OsMA_Lc",FastEMA, SlowEMA, SignalSMA,AplyingPrice, 0,y);
ExtMapBuffer1[i]=iCustom(NULL, TimeFrame, "OsMA_Lc",FastEMA, SlowEMA, SignalSMA,AplyingPrice, 1,y);
}
return(0);
}
//+------------------------------------------------------------------+
Comments