MEGATREND SITELITE 1.7
Download scriptThe SiteLite™ indicator is designed to provide visual signals on a trading chart, helping users identify potential buying and selling opportunities by analyzing price action relative to moving averages. Here is a breakdown of how the logic functions:
Core Logic and Calculation
The tool primarily operates by comparing the current closing price of an asset against two specific types of Simple Moving Averages (SMA). These averages are calculated based on a "Lookback Period" (which defaults to 18 units) and focus on the highest highs and lowest lows of previous price candles.
- Bullish Logic (Buying Signals): The script checks if the current closing price is trading above the moving average derived from the previous period's high prices. When this condition is met, it signifies a bullish trend or momentum.
- Bearish Logic (Selling Signals): Conversely, the script checks if the current closing price has fallen below the moving average derived from the previous period's low prices. This indicates bearish momentum.
Visual Representation
The indicator translates these mathematical conditions into clear visual cues on your screen:
- Signal Arrows: It places specific markers (arrows) to highlight where the trend shifts. These are color-coded to distinguish between "Long" (buying) and "Short" (selling) opportunities.
- Dynamic Levels: The script uses a designated "Bar Level" to display these signals clearly in a separate window, making it easier for traders to see the strength or timing of a move without cluttering the main price chart.
Multi-Timeframe Compatibility
One of the key features of this logic is its ability to handle different timeframes. The script is designed to recognize various intervals (from 1-minute charts up to Monthly charts). It has a smart switching mechanism:
- Automatic Alignment: If you set the indicator to a specific timeframe, it will pull data from that higher timeframe and align it with your current view.
- Synchronization: It ensures that if you are viewing a smaller timeframe (like a 5-minute chart) but want to see signals based on a larger one (like an Hourly chart), the signals remain synchronized and accurate to the broader trend.
Summary for the User
In short, this tool automates the process of watching how price reacts to historical highs and lows. Instead of you having to manually calculate where the "average high" or "average low" is, the script does this instantly and places a visual signal on your screen whenever the price breaks through those levels in a significant way.
/*
Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
Website: http://purebeam.biz
E-mail : purebeam@gmail.com
*/
#property copyright "MegaTrendFX"
#property link "http://megatrendfx.com"
#property indicator_separate_window
#property indicator_minimum 10.0
#property indicator_maximum 90.0
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
extern int LookbackPeriod = 18;
extern int SITELITE_BarLevel = 45;
extern int TimeFrame = 0;
extern string TimeFramesAvailable = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
double g_ibuf_96[];
double g_ibuf_100[];
double g_ibuf_104[];
string gs_108;
int init() {
string ls_0;
if (TimeFrame < Period()) TimeFrame = Period();
switch (TimeFrame) {
case 1:
ls_0 = "M1";
break;
case 5:
ls_0 = "M5";
break;
case 15:
ls_0 = "M15";
break;
case 30:
ls_0 = "M30";
break;
case 60:
ls_0 = "H1";
break;
case 240:
ls_0 = "H4";
break;
case 1440:
ls_0 = "D1";
break;
case 10080:
ls_0 = "W1";
break;
case 43200:
ls_0 = "MN1";
break;
default:
ls_0 = "TF0";
}
IndicatorBuffers(3);
SetIndexBuffer(0, g_ibuf_96);
SetIndexStyle(0, DRAW_ARROW);
SetIndexArrow(0, 167);
SetIndexLabel(0, "siteLONG " + LookbackPeriod + " [" + TimeFrame + "]");
SetIndexBuffer(1, g_ibuf_100);
SetIndexStyle(1, DRAW_ARROW);
SetIndexArrow(1, 167);
SetIndexLabel(1, "siteSHORT " + LookbackPeriod + " [" + TimeFrame + "]");
SetIndexBuffer(2, g_ibuf_104);
IndicatorShortName(":::::::SiteLite 1.7 " + LookbackPeriod + "[" + ls_0 + "]");
gs_108 = WindowExpertName();
return (0);
}
int deinit() {
return (0);
}
int start() {
int l_index_4;
int lia_12[];
int l_index_16;
int li_0 = IndicatorCounted();
if (li_0 < 0) return (-1);
if (li_0 > 0) li_0--;
int li_8 = Bars - li_0;
if (TimeFrame != Period()) {
li_8 = MathMax(li_8, TimeFrame / Period());
ArrayCopySeries(lia_12, 5, NULL, TimeFrame);
l_index_4 = 0;
l_index_16 = 0;
while (l_index_4 < li_8) {
if (Time[l_index_4] < lia_12[l_index_16]) l_index_16++;
g_ibuf_96[l_index_4] = iCustom(NULL, TimeFrame, gs_108, LookbackPeriod, SITELITE_BarLevel, 0, l_index_16);
g_ibuf_100[l_index_4] = iCustom(NULL, TimeFrame, gs_108, LookbackPeriod, SITELITE_BarLevel, 1, l_index_16);
l_index_4++;
}
return (0);
}
for (l_index_4 = li_8; l_index_4 >= 0; l_index_4--) {
g_ibuf_104[l_index_4] = g_ibuf_104[l_index_4 + 1];
if (Close[l_index_4] > iMA(Symbol(), 0, LookbackPeriod, 0, MODE_SMA, PRICE_HIGH, l_index_4 + 1)) g_ibuf_104[l_index_4] = 1;
if (Close[l_index_4] < iMA(Symbol(), 0, LookbackPeriod, 0, MODE_SMA, PRICE_LOW, l_index_4 + 1)) g_ibuf_104[l_index_4] = -1;
if (g_ibuf_104[l_index_4] == -1.0) {
g_ibuf_100[l_index_4] = SITELITE_BarLevel;
g_ibuf_96[l_index_4] = EMPTY_VALUE;
} else {
g_ibuf_100[l_index_4] = EMPTY_VALUE;
g_ibuf_96[l_index_4] = SITELITE_BarLevel;
}
}
return (0);
}
Comments