1. "Если цвет индикатора А - зеленый"
iCustom(.."A".......) ?
2. "Если цвет индикатора А - Красный"
iCustom(.."A".......) ?
3. "Если цвет индикатора B - зеленый"
iCustom(.."B".......) ?
4. "Если цвет индикатора B - Красный"
iCustom(.."B".......) ?
\\\------------------------------------
Индикатор A
#property copyright "Copyright ForexFunnel"
#property link ""
#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 1.0
#property indicator_buffers 2
#property indicator_color1 DarkGreen
#property indicator_color2 Red
extern int SSP = 7;
extern double Kmax = 50.6;
extern int CountBars = 300;
double g_ibuf_152[];
double g_ibuf_156[];
double g_ibuf_160[];
double g_ibuf_164[];
int init() {
IndicatorBuffers(4);
SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 4);
SetIndexBuffer(0, g_ibuf_160);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 4);
SetIndexBuffer(1, g_ibuf_164);
SetIndexBuffer(2, g_ibuf_152);
SetIndexBuffer(3, g_ibuf_156);
IndicatorShortName("goldminer");
SetIndexLabel(0, "");
SetIndexLabel(1, "");
return (0);
}
int deinit() {
return (0);
}
int start() {
double ld_8;
double ld_16;
double ld_32;
if (CountBars >= Bars) CountBars = Bars;
SetIndexDrawBegin(0, Bars - CountBars + SSP);
SetIndexDrawBegin(1, Bars - CountBars + SSP);
int l_ind_counted_4 = IndicatorCounted();
if (Bars <= SSP + 1) return (0);
if (l_ind_counted_4 < SSP + 1) {
for (int li_0 = 1; li_0 <= SSP; li_0++) g_ibuf_152[CountBars - li_0] = 0.0;
for (li_0 = 1; li_0 <= SSP; li_0++) g_ibuf_156[CountBars - li_0] = 0.0;
}
for (li_0 = CountBars - SSP; li_0 >= 0; li_0--) {
ld_8 = High[iHighest(NULL, 0, MODE_HIGH, SSP, li_0 - SSP + 1)];
ld_16 = Low[iLowest(NULL, 0, MODE_LOW, SSP, li_0 - SSP + 1)];
ld_32 = ld_8 - (ld_8 - ld_16) * Kmax / 100.0;
g_ibuf_152[li_0 - SSP + 6] = ld_32;
g_ibuf_156[li_0 - SSP - 1] = ld_32;
}
for (int li_40 = CountBars - SSP; li_40 >= 0; li_40--) {
if (g_ibuf_152[li_40] > g_ibuf_156[li_40]) {
g_ibuf_160[li_40] = 1;
g_ibuf_164[li_40] = 0;
} else {
g_ibuf_160[li_40] = 0;
g_ibuf_164[li_40] = 1;
}
}
return (0);
}
----------------------------------------------------
Индикатор B
//+------------------------------------------------------------------+
//| indic to see if RSI is above or under 2 valors |
//| Copyright © 2008,
[email protected] |
//|
http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
// you are asking if RSI is above/under 45/55 ?
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
//---- indicator settings
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 1
#property indicator_buffers 3
#property indicator_color1 DarkGreen
#property indicator_color2 Crimson
#property indicator_color3 Yellow
//---- indicator parameters
extern int RSI=8;
extern int valeur1=55;
extern int valeur2=45;
//---- indicator buffers
double ExtBuffer1[];
double ExtBuffer2[];
double ExtBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle (0,DRAW_HISTOGRAM, EMPTY,4,DarkGreen);
SetIndexBuffer(0,ExtBuffer1);
SetIndexStyle (1,DRAW_HISTOGRAM, EMPTY,4,Crimson);
SetIndexBuffer(1,ExtBuffer2);
SetIndexStyle (2,DRAW_HISTOGRAM, EMPTY,4,Yellow);
SetIndexBuffer(2,ExtBuffer3);
//---- names
IndicatorShortName("RSI above/under 45/55");
SetIndexLabel(0,"RSI"+RSI +" is above 55");
SetIndexLabel(1,"RSI"+RSI +" is under 45");
SetIndexLabel(2,"RSI is in the mid zone ");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- macd counted in the 1st buffer
for(int i=0; i<limit; i++)
if (iRSI(NULL,0,RSI,PRICE_CLOSE,i)<=valeur2)
{
ExtBuffer2
=1;
}
else
if (iRSI(NULL,0,RSI,PRICE_CLOSE,i)>=valeur1)
{
ExtBuffer1=1;
}
else
ExtBuffer3=1;
return(0);
}
//+------------------------------------------------------------------+