Alternative_Ichimoku_v1
Download scriptThis script is a specialized technical analysis tool designed to identify price trends and potential reversal points by analyzing historical price extremes. It functions as an "Alternative Ichimoku" system, meaning it uses the core principles of momentum and equilibrium to provide traders with visual cues on a chart.
Core Logic and Functionality
The tool works by scanning specific windows of past price data to calculate various equilibrium levels. Rather than just looking at the current price, it identifies the highest highs and lowest lows within defined periods to determine where the "fair value" of the market sits.
Key Components of the Analysis:
- Dynamic Equilibrium Lines: The script calculates two primary lines based on different time offsets. One line tracks the midpoint of recent price extremes, while the second line acts as a smoothed "overdue" reference. By comparing these two, traders can see how quickly the market is moving relative to its recent history.
- Trend and Volatility Mapping: The script evaluates historical data to calculate the average range of the price action. This helps in understanding whether the current market environment is stable or experiencing high volatility.
- Stop-Order Reference: A specific "stop-order" line is generated by scanning a larger window of price history. This serves as a structural boundary, helping to identify significant zones where price might encounter resistance or support.
- Visual Representation:
- The primary data is displayed using a combination of lines and histograms.
- The Histogram elements provide a visual representation of the relationship between the different equilibrium levels.
- The Stop-Order Line provides a clear boundary for risk management or identifying major trend shifts.
How it Assists the User
Instead of requiring the user to manually calculate complex averages, this script automates the identification of support and resistance zones. By plotting these "midpoint" levels automatically, it allows you to see:
- Where the price is currently balanced compared to recent history.
- The visual strength of a trend based on how the histograms interact with the equilibrium lines.
- A specific reference point (the stop-order line) to help define potential exit zones or significant structural breaks in the market.
The script also provides a real-time calculation of the average price range, which is displayed as a comment on the chart, giving you an immediate sense of the current market's "stretch" in points.
//+----------------------------------------------------------+
//| Alternative Ichimoku .mq4 |
//| Copyright © february 2007 |
//| Lukashuk Victor Gennadievich aka lukas1 |
//+----------------------------------------------------------+
#property copyright "Copyright © 2007, lukas1"
#property link ""
//----
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 LightPink
#property indicator_color2 LightSteelBlue
#property indicator_color3 LightPink
#property indicator_color4 LightSteelBlue
#property indicator_width3 2
#property indicator_width4 2
#property indicator_color5 Blue
//---- input parameters
extern int SSP = 34; // áàðîâ - ðàñ÷¸òíûé ïåðèîä; calculating period
extern int SSK = 29; // çàìåäëåíèå âòîðîé ëèíèè; tolerance of second line
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double Wal1[];
double Wal2[];
double ExtMapBuffer4[];
int i, i1, i2, shift;
double SsMax, SsMin, SsMax05, SsMin05, Rsmin, Rsmax, Tsmin, Tsmax;
int val1, val2, AvgRange;
bool uptrend, old;
//----
bool gSellAlertGiven = false; // Used to stop constant alerts
bool gBuyAlertGiven = false; // Used to stop constant alerts
string comm, st_AvgRange, st_Buy_Sell, st_text, st_level;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(5);
//----
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexDrawBegin(0, SSP*2);
SetIndexLabel(0,"îïåðåæàþùàÿ ëèíèÿ"); // priority line
//----
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexDrawBegin(1, SSP*2);
SetIndexLabel(1,"çàïàçäûâþùàÿ ëèíèÿ"); // overdue line
//----
SetIndexStyle(2, DRAW_HISTOGRAM);
SetIndexBuffer(2, Wal1);
SetIndexDrawBegin(2, SSP*2);
//----
SetIndexStyle(3, DRAW_HISTOGRAM);
SetIndexBuffer(3, Wal2);
SetIndexDrawBegin(3, SSP*2);
//----
SetIndexStyle(4, DRAW_LINE);
SetIndexBuffer(4, ExtMapBuffer4);
SetIndexDrawBegin(4, SSP*2);
SetIndexLabel(4, "ëèíèÿ ñòîï-îðäåðà"); // stop-order line
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
void deinit()
{
Comment("");
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars = IndicatorCounted();
if(Bars <= SSP + 1)
return(0);
i = Bars - counted_bars;
if(counted_bars==0) i-=(MathMax(SSP,SSK)+1);
while(i >= 0)
{
// maximum of previous SSP bars period
SsMax = High[iHighest(NULL, 0, MODE_HIGH, SSP, i)];
// minimum of previous SSP bars period
SsMin = Low[iLowest(NULL, 0, MODE_LOW, SSP, i)];
// maximum of SSP bars period for SSK bars from begin
SsMax05 = High[iHighest(NULL, 0, MODE_HIGH, SSP, i + SSK)];
// maximum of SSP bars period for SSK bars from begin
SsMin05 = Low[iLowest(NULL, 0, MODE_LOW, SSP, i + SSK)];
ExtMapBuffer1[i] = (SsMax + SsMin) / 2;
ExtMapBuffer2[i] = (SsMax05+SsMin05) / 2;
val1 = ExtMapBuffer1[1] / Point;
val2 = ExtMapBuffer2[1] / Point;
//----
Rsmax = High[iHighest(NULL, 0, MODE_HIGH, SSP*2, i)];
Rsmin = Low[iLowest(NULL, 0, MODE_LOW, SSP*2, i)];
AvgRange = (Rsmax / Point) - (Rsmin / Point);
Wal1[i] = ExtMapBuffer1[i];
Wal2[i] = ExtMapBuffer2[i];
//----
Tsmax = High[iHighest(NULL, 0, MODE_HIGH, SSP*1.62, i)];
Tsmin = Low[iLowest(NULL, 0, MODE_LOW, SSP*1.62, i)];
ExtMapBuffer4[i] = (Tsmax + Tsmin) / 2;
i--;
}
st_AvgRange=AvgRange;
comm = " âîëàòèëüíîñòü: " + st_AvgRange + " ïóíêòîâ" + "\n";
Comment(comm);
//----
return(0);
}
//+------------------------------------------------------------------+
Comments