Indicators Used
0
Views
0
Downloads
0
Favorites
cci_wcci_iGentorLSMAEMAm4L_overlay_mtf
//+------------------------------------------------------------------+
//| i-GentorLSMA&EMA_v.0.2.mq4 |
//| FX Sniper, KimIV |
//| 2005.08.20 KimIV v.0.0 |
//| Ñîåäèíèë â LSMA è EMA |
//| 2005.08.20 KimIV v.0.2 |
//| Ñèíõðîíèçèðîâàë íóìåðàöèþ âåðñèé ñ i-GentorCCIM_v.0.2.mq4 |
//+------------------------------------------------------------------+
// mod2008txtsd 4 levels mtf ki
#property copyright "FX Sniper, KimIV"
#property link "http://www.kimiv.ru"
//----
#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Maroon
#property indicator_color2 RoyalBlue
#property indicator_color3 Red
#property indicator_color4 Lime
#property indicator_color5 Maroon
#property indicator_color6 RoyalBlue
#property indicator_color7 Red
#property indicator_color8 Lime
#property indicator_maximum 300
#property indicator_minimum -300
//---- Âíåøíèå ïàðàìåòðû ---------------------------------------------
extern int EMAPeriod =34; // Ïåðèîä ÅÌÀ
extern int LSMAPeriod=25; // Ïåðèîä LSMA
extern int EMA_Level =198;
extern int LSMA_Level=58;
extern bool UseDoubleLevels = true;
extern int timeFrame = 0;
extern string timeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
string IndicatorFileName;
//---- Áóôåðû èíäèêàòîðà ---------------------------------------------
double LineHighEMA[];
double LineLowEMA[];
double LSMABuffer1[];
double LSMABuffer2[];
double LineHighEMAa[];
double LineLowEMAa[];
double LSMABuffer1a[];
double LSMABuffer2a[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init()
{
IndicatorDigits(2);
SetIndexBuffer(0, LineHighEMA);
SetIndexBuffer(1, LineLowEMA);
SetIndexBuffer(2, LSMABuffer1);
SetIndexBuffer(3, LSMABuffer2);
SetIndexStyle (0, DRAW_LINE);
SetIndexStyle (1, DRAW_LINE);
SetIndexStyle (2, DRAW_LINE);
SetIndexStyle (3, DRAW_LINE);
SetIndexBuffer(4, LineHighEMAa);
SetIndexBuffer(5, LineLowEMAa);
SetIndexBuffer(6, LSMABuffer1a);
SetIndexBuffer(7, LSMABuffer2a);
SetIndexLabel (0, "");
SetIndexLabel (1, "price over EMA("+EMAPeriod+")");
SetIndexLabel (2, "");
SetIndexLabel (3, "price over LSMA("+LSMAPeriod+")");
if (UseDoubleLevels)
{
SetIndexStyle (4, DRAW_LINE);
SetIndexStyle (5, DRAW_LINE);
SetIndexStyle (6, DRAW_LINE);
SetIndexStyle (7, DRAW_LINE);
SetIndexLabel (4, "price under EMA("+EMAPeriod+")");
SetIndexLabel (5, "");
SetIndexLabel (6, "price under LSMA ("+LSMAPeriod+")");
SetIndexLabel (7, "");
}
else
{
SetIndexStyle (4, DRAW_NONE);
SetIndexStyle (5, DRAW_NONE);
SetIndexStyle (6, DRAW_NONE);
SetIndexStyle (7, DRAW_NONE);
}
IndicatorShortName("LSMA&EMA [" + timeFrame + "] ("+LSMAPeriod+"|"+EMAPeriod+")");
IndicatorFileName = WindowExpertName();
timeFrame = MathMax(timeFrame,Period());
}
//------
int start()
{
int i, shift, counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
if (timeFrame != Period())
{
datetime TimeArray[];
limit = MathMax(limit,timeFrame/Period());
ArrayCopySeries(TimeArray ,MODE_TIME ,NULL,timeFrame);
for(i=0,int y=0; i<limit; i++)
{
if(Time[i]<TimeArray[y]) y++;
LineHighEMA[i] = iCustom(NULL,timeFrame,IndicatorFileName,EMAPeriod, LSMAPeriod,
EMA_Level,LSMA_Level,UseDoubleLevels,0,y);
LineLowEMA[i] = iCustom(NULL,timeFrame,IndicatorFileName,EMAPeriod, LSMAPeriod,
EMA_Level,LSMA_Level,UseDoubleLevels,1,y);
LSMABuffer1[i] = iCustom(NULL,timeFrame,IndicatorFileName,EMAPeriod, LSMAPeriod,
EMA_Level,LSMA_Level,UseDoubleLevels,2,y);
LSMABuffer2[i] = iCustom(NULL,timeFrame,IndicatorFileName,EMAPeriod, LSMAPeriod,
EMA_Level,LSMA_Level,UseDoubleLevels,3,y);
LineHighEMAa[i] = iCustom(NULL,timeFrame,IndicatorFileName,EMAPeriod, LSMAPeriod,
EMA_Level,LSMA_Level,UseDoubleLevels,4,y);
LineLowEMAa[i] = iCustom(NULL,timeFrame,IndicatorFileName,EMAPeriod, LSMAPeriod,
EMA_Level,LSMA_Level,UseDoubleLevels,5,y);
LSMABuffer1a[i] = iCustom(NULL,timeFrame,IndicatorFileName,EMAPeriod, LSMAPeriod,
EMA_Level,LSMA_Level,UseDoubleLevels,6,y);
LSMABuffer2a[i] = iCustom(NULL,timeFrame,IndicatorFileName,EMAPeriod, LSMAPeriod,
EMA_Level,LSMA_Level,UseDoubleLevels,7,y);
}
return(0);
}
int Draw4HowLong, loopbegin;
double sum, lengthvar, tmp, wt;
//----
if (counted_bars<0) return;
if (counted_bars>0) counted_bars--;
counted_bars=Bars - counted_bars;
for(shift=0; shift<counted_bars; shift++)
{
if (UseDoubleLevels)
{
LineLowEMA[shift] =EMA_Level;
LineHighEMA[shift]=EMA_Level;
LineLowEMAa[shift] =-EMA_Level;
LineHighEMAa[shift]=-EMA_Level;
}
else
{
LineLowEMA[shift]=EMA_Level;
LineHighEMA[shift]=EMA_Level;
}
//----
double EmaValue=iMA(NULL, 0, EMAPeriod, 0, MODE_EMA, PRICE_TYPICAL, shift);
if (Close[shift] > EmaValue) {LineHighEMA[shift]=EMPTY_VALUE; LineHighEMAa[shift]=EMPTY_VALUE;}
else
if (Close[shift] < EmaValue) {LineLowEMA[shift]=EMPTY_VALUE; LineLowEMAa[shift]=EMPTY_VALUE;}
}
Draw4HowLong=Bars-LSMAPeriod - 5;
loopbegin=Draw4HowLong - LSMAPeriod - 1;
//----
for(shift=loopbegin; shift>=0; shift--)
{
sum=0;
for(i=LSMAPeriod; i>=1; i--)
{
lengthvar=LSMAPeriod + 1;
lengthvar/=3;
tmp=0;
tmp=(i - lengthvar)*Close[LSMAPeriod-i+shift];
sum+=tmp;
}
wt=sum*6/(LSMAPeriod*(LSMAPeriod+1));
//----
if (UseDoubleLevels)
{
LSMABuffer1[shift]=LSMA_Level;
LSMABuffer2[shift]=LSMA_Level;
LSMABuffer1a[shift]=-LSMA_Level;
LSMABuffer2a[shift]=-LSMA_Level;
}
else
{
LSMABuffer1[shift]=LSMA_Level;
LSMABuffer2[shift]=LSMA_Level;
}
//----
if (wt > Close[shift]) {LSMABuffer2[shift]=EMPTY_VALUE; LSMABuffer2a[shift]=EMPTY_VALUE;}
else
if (wt < Close[shift]) {LSMABuffer1[shift]=EMPTY_VALUE; LSMABuffer1a[shift]=EMPTY_VALUE;}
}
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---