// Îáú¸ì ðàñ÷èòûâàòñÿ îò Low äî High. Ñ÷èòàåòñÿ ÷òî â "õâîñòèêàõ" ñîñðåäîòî÷åí äâîéíîé îáú¸ì (òóäà-ñþäà) #property indicator_chart_window extern int Period_ind = 240; // 3000 - 10000 int Amplitude = 100; double Hist[]; datetime OpenTime = 0; datetime CountTime = 0; int init() { ObjectCreate("Line_Goriz", OBJ_VLINE, 0, Time[Period_ind], 0); ObjectSet("Line_Goriz", OBJPROP_COLOR, Red); return(0); } int start() { if (OpenTime != Open[0]) { ObjectSet( "Line_Goriz", OBJPROP_TIME1, Time[Period_ind]); OpenTime = Open[0]; double max = High[iHighest( NULL , 0, MODE_HIGH, Period_ind, 0)]; double min = Low[ iLowest( NULL , 0, MODE_LOW, Period_ind, 0)]; int items = MathRound((max - min) / Point); ArrayResize(Hist, items); ArrayInitialize(Hist, 0); int n; for (int i = 1; i <= Period_ind; i++) { double t1 = Low[i], t2 = Open[i], t3 = Close[i], t4 = High[i]; if (t2 > t3) {t3 = Open[i]; t2 = Close[i];} double znamen = 2*(t4 - t1) - t3 + t2; if (znamen != 0.0) { for (double Price_i = t1; Price_i <= t4; Price_i += Point) { n = MathRound((Price_i - min) / Point); if (t1 <= Price_i && Price_i < t2) { Hist[n] += MathRound(Volume[i]*2*(t2-t1)/znamen); } if (t2 <= Price_i && Price_i <= t3) { Hist[n] += MathRound(Volume[i]*(t3-t2)/znamen); } if (t3 < Price_i && Price_i <= t4) { Hist[n] += MathRound(Volume[i]*2*(t4-t3)/znamen); } } } } for (i = 0; i < 3000; i++) ObjectDelete("VH"+i); int MaxVolume = Hist[ArrayMaximum(Hist)]; for (i = 0; i <= items; i++) { if (MaxVolume != 0) Hist[i] = MathRound(Amplitude * Hist[i] / MaxVolume ); if (Hist[i] > 0) { int time_i = Period_ind-Hist[i]; ObjectCreate("VH"+i, OBJ_RECTANGLE, 0, Time[Period_ind], min + i*Point, Time[time_i], min + (i+1)*Point); ObjectSet("VH"+i, OBJPROP_STYLE, DRAW_HISTOGRAM); ObjectSet("VH"+i, OBJPROP_COLOR, Red); ObjectSet("VH"+i, OBJPROP_BACK, true); } } } return(0); } int deinit() { for (int i = 0; i < 3000; i++) ObjectDelete("VH"+i); ObjectDelete("Line_Goriz"); return(0); }
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Series array that contains open prices of each bar
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Series array that contains close prices for each bar
Series array that contains tick volumes of each bar
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: