Indicators Used
0
Views
0
Downloads
0
Favorites
cm-Level
//+------------------------------------------------------------------+
//| cm-Level.mq4 |
//| Copyright © 2012, Khlystov Vladimir |
//| http://cmillion.narod.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, cmillion@narod.ru"
#property link "http://cmillion.narod.ru"
#property indicator_chart_window
//Èíäèêàòîð ïîêàçûâàåò ãäå áûëà öåíà çà ïåðèîä âðåìåíè ñ TimeStart
//êîë-âî ôðàêòàëîâ îáîçíà÷åíî êðàñíûì öâåòîì
//êîë-âî ýêñòðåìóìîâ - çåëåíûì
//--------------------------------------------------------------------
extern datetime TimeStart = D'2012.04.25 00:00'; //Âðåìÿ ñòàðòà àíàëèçà
double PriceFr[30000],PriceB[30000],Price[30000],PriceMax[30000];
double min,max;
int Pr;
datetime TimeSt;
string txt;
//--------------------------------------------------------------------
int init()
{
int TSt = WindowFirstVisibleBar();
TimeSt = Time[TSt];
int Bar = iBarShift(NULL,0,TimeStart,FALSE);
int BarMax = iHighest(NULL,0,MODE_HIGH,Bar,0);
max = High[BarMax];
int BarMin = iLowest(NULL,0,MODE_LOW,Bar,0);
min = Low[BarMin];
txt = StringConcatenate("Áàð â èñòîðèè ",Bar," ñ ",TimeToStr(Time[Bar],TIME_DATE),"\nÌàêñèìóì ",DoubleToStr(max,Digits),"\nÌèíèìóì ",DoubleToStr(min,Digits));
Comment("Ñòàðò ðàñ÷åòà ",TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS));
ObjectsDeleteAll(0,OBJ_TREND);
//---
Pr = (max - min)/Point;
if (Pr>30000) Pr=29999;
for(int i=1; i<=Bar; i++)
{
for(int j=0; j<Pr; j++)
{
double P=NormalizeDouble(min+j*Point,Digits);
if (P>=Low[i] && P<=High[i]) Price[j]++;
if (iFractals(NULL,0,MODE_UPPER,i)==P || iFractals(NULL,0,MODE_LOWER,i)==P) PriceFr[j]++;
if (Low[i]==P || High[i]==P) PriceB[j]++;
}
}
//---
int K,Maximum1,Maximum2;
for(j=0; j<Pr; j++)
{
P=NormalizeDouble(min+j*Point,Digits);
Trend(StringConcatenate("2 fr",P),P, PriceFr[j],3, Red);
Trend(StringConcatenate("1 b ",P),P, PriceB[j], 2, Green);
Trend(StringConcatenate("0 p ",P),P, Price[j], 1,LightSkyBlue);
PriceMax[j]=PriceFr[j]+PriceB[j];
}
return;
}
//--------------------------------------------------------------------
int start()
{
Comment(txt,"\n",TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS));
return;
}
//-------------------------------------------------------------------------------
void Trend(string NameLine, double price, int i, int w, color col)
{
ObjectDelete(NameLine);
ObjectCreate(NameLine, OBJ_TREND, 0, TimeSt, price, TimeSt + i*60*Period(), price);
ObjectSet(NameLine, OBJPROP_COLOR, col);
ObjectSet(NameLine, OBJPROP_WIDTH, w);
ObjectSet(NameLine, OBJPROP_RAY, false);
ObjectSet(NameLine, OBJPROP_BACK, true);
}
//-------------------------------------------------------------------------------
int deinit()
{
ObjectsDeleteAll(0,OBJ_TREND);
return;
}
//--------------------------------------------------------------------
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
---