MaksiGen_Range_Move_v3
Download scriptThe MaksiGen_Range_Move script is a technical analysis tool designed to help traders visualize market structure, identify key price boundaries, and automatically project potential breakout levels. By analyzing historical price action over specific timeframes, it provides a clear visual map of the current market "range."
Core Functionality
The logic operates by identifying two different layers of price extremes:
- Short-Term Range: The script looks at a very recent set of candles (defined by the "Fast" parameter) to find the highest and lowest points reached.
- Long-Term Range: Simultaneously, it scans a slightly wider set of historical candles (defined by the "Slow" parameter) to establish a broader boundary of price movement.
Visual Logic and Market Mapping
As the market moves, the script dynamically updates several visual elements on your chart:
- Dynamic Boundaries: It draws horizontal lines that represent these high and low extremes. This allows you to see at a glance where the "ceiling" and "floor" of the current price action are located.
- Vertical Reference Points: The script marks specific historical candles (the most recent, the "Fast" point, and the "Slow" point) with vertical lines. These act as anchor points for the analysis.
- Trend Analysis: It automatically generates trend lines connecting the short-term highs/lows to the long-term highs/lows. This helps traders visualize the trajectory of the price movement between these two different time horizons.
Breakout Identification (The Range Logic)
One of the primary features of this script is its ability to identify "balanced" markets. The logic performs a specific check: If the height of the short-term range is exactly equal to the height of the long-term range, it signals a period of significant price consolidation.
When this balance is detected, the script performs two automated actions:
- Projection: It calculates a "Range" value based on a multiplier and projects potential entry points.
- Stop Levels: It automatically draws a Buy Stop line above the current high and a Sell Stop line below the current low.
Summary for the Trader
Essentially, this tool simplifies complex price action into a geometric map. Instead of manually calculating where the market might break out, the script does the heavy lifting by identifying consistent ranges. When the market is "symmetrical" across different timeframes, the script highlights exactly where you might want to look for a breakout, providing clear visual cues for potential trade opportunities.
//+------------------------------------------------------------------+
//| MaksiGen_Range_Move.mq4 |
//| MaksiGen - MT3 by OlegVS ( olegvs2003@yahoo.com ) |
//| |
//+------------------------------------------------------------------+
#property copyright "MaksiGen - MT3 by OlegVS ( olegvs2003@yahoo.com )"
#property link ""
//----
#property indicator_chart_window
//---- input parameters
extern int Pfast=5;
extern int Pslow=8;
extern double K_RangeOpen=1.4;
double hi1,lo1,hi2,lo2,Range;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- Object
ObjectCreate("hi1",OBJ_HLINE,0,0,0,0,0,0,0); ObjectSet("hi1",OBJPROP_COLOR,Silver); ObjectSet("hi1",OBJPROP_STYLE,STYLE_DOT);
ObjectCreate("lo1",OBJ_HLINE,0,0,0,0,0,0,0); ObjectSet("lo1",OBJPROP_COLOR,Silver); ObjectSet("lo1",OBJPROP_STYLE,STYLE_DOT);
ObjectCreate("hi2",OBJ_HLINE,0,0,0,0,0,0,0); ObjectSet("hi2",OBJPROP_COLOR,Silver); ObjectSet("hi2",OBJPROP_STYLE,STYLE_DASH);
ObjectCreate("lo2",OBJ_HLINE,0,0,0,0,0,0,0); ObjectSet("lo2",OBJPROP_COLOR,Silver); ObjectSet("lo2",OBJPROP_STYLE,STYLE_DASH);
ObjectCreate("Bar#1", OBJ_VLINE,0,0,0,0,0,0,0); ObjectSet("Bar#1", OBJPROP_COLOR,OliveDrab); ObjectSet("Bar#1", OBJPROP_STYLE,STYLE_DOT);
ObjectCreate("Bar#Pfast",OBJ_VLINE,0,0,0,0,0,0,0); ObjectSet("Bar#Pfast",OBJPROP_COLOR,LightSkyBlue); ObjectSet("Bar#Pfast",OBJPROP_STYLE,STYLE_DOT);
ObjectCreate("Bar#Pslow",OBJ_VLINE,0,0,0,0,0,0,0); ObjectSet("Bar#Pslow",OBJPROP_COLOR,Blue); ObjectSet("Bar#Pslow",OBJPROP_STYLE,STYLE_DOT);
ObjectCreate("TrendHIGH",OBJ_TREND,0,0,0,0,0,0); ObjectSet("TrendHIGH",OBJPROP_COLOR,Gold); ObjectSet("TrendHIGH",OBJPROP_STYLE,STYLE_SOLID);
ObjectCreate("Trend_LOW",OBJ_TREND,0,0,0,0,0,0); ObjectSet("Trend_LOW",OBJPROP_COLOR,Gold); ObjectSet("Trend_LOW",OBJPROP_STYLE,STYLE_SOLID);
ObjectCreate("SELLSTOP",OBJ_HLINE,0,0,0,0,0,0,0); ObjectSet("SELLSTOP",OBJPROP_COLOR,Red); ObjectSet("SELLSTOP",OBJPROP_STYLE,STYLE_DOT);
ObjectCreate("BUY_STOP",OBJ_HLINE,0,0,0,0,0,0,0); ObjectSet("BUY_STOP",OBJPROP_COLOR,Blue); ObjectSet("BUY_STOP",OBJPROP_STYLE,STYLE_DOT);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectDelete("hi1"); ObjectDelete("lo1");
ObjectDelete("hi2"); ObjectDelete("lo2");
ObjectDelete("Bar#1"); ObjectDelete("Bar#Pfast"); ObjectDelete("Bar#Pslow");
ObjectDelete("TrendHIGH"); ObjectDelete("Trend_LOW");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
hi1=High[Highest(Symbol(),0,MODE_HIGH,Pfast,1)];
lo1=Low[Lowest(Symbol(),0,MODE_LOW,Pfast,1)];
hi2=High[Highest(Symbol(),0,MODE_HIGH,Pslow,1)];
lo2=Low[Lowest(Symbol(),0,MODE_LOW,Pslow,1)];
//---- horizontal lines
ObjectMove("hi1",0,Time[Pfast-1],hi1);
ObjectMove("lo1",0,Time[Pfast-1],lo1);
ObjectMove("hi2",0,Time[Pslow-1],hi2);
ObjectMove("lo2",0,Time[Pslow-1],lo2);
//---- vertical lines
ObjectMove("Bar#1", 0,Time[1], High[1]);
ObjectMove("Bar#Pfast",0,Time[Pfast],High[1]);
ObjectMove("Bar#Pslow",0,Time[Pslow],High[1]);
//---- trend lines
ObjectSet("TrendHIGH",OBJPROP_TIME1,Time[Pslow]); ObjectSet("TrendHIGH",OBJPROP_PRICE1,hi2);
ObjectSet("TrendHIGH",OBJPROP_TIME2,Time[Pfast]); ObjectSet("TrendHIGH",OBJPROP_PRICE2,hi1);
ObjectSet("Trend_LOW",OBJPROP_TIME1,Time[Pslow]); ObjectSet("Trend_LOW",OBJPROP_PRICE1,lo2);
ObjectSet("Trend_LOW",OBJPROP_TIME2,Time[Pfast]); ObjectSet("Trend_LOW",OBJPROP_PRICE2,lo1);
//----
if (hi1-lo1==hi2-lo2)
{
Range=(hi1-lo1)*K_RangeOpen;
ObjectMove("SELLSTOP",0,Time[Pfast-1],lo1-Range);
ObjectMove("BUY_STOP",0,Time[Pfast-1],hi1+Range);
ObjectSet("TrendHIGH",OBJPROP_TIME1,Time[Pslow-1]); ObjectSet("TrendHIGH",OBJPROP_PRICE1,hi2);
ObjectSet("TrendHIGH",OBJPROP_TIME2,Time[Pfast-1]); ObjectSet("TrendHIGH",OBJPROP_PRICE2,hi1);
ObjectSet("Trend_LOW",OBJPROP_TIME1,Time[Pslow]-1); ObjectSet("Trend_LOW",OBJPROP_PRICE1,lo2);
ObjectSet("Trend_LOW",OBJPROP_TIME2,Time[Pfast]-1); ObjectSet("Trend_LOW",OBJPROP_PRICE2,lo1);
}
ObjectsRedraw();
//----
return(0);
}
//+------------------------------------------------------------------+
Comments