커뮤니티
수식
2015-06-08 21:42:19
458
글번호 86950
안녕하세요.
아래수식은 메타4지표인데요 이걸 사용할수있게 바꿔줄수 있나요?
메타로 보니 좋은데 수식은 머가먼지 하나도 모르겟네요.
시간이 걸린다면 마지박 세번째라도 부탁합니다.
첫번째
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 Black
#property indicator_color2 Lime
#property indicator_color3 Red
#property indicator_color4 Yellow
#property indicator_color5 Lime
#property indicator_color6 Red
extern bool ALERTS = TRUE;
extern bool SoundAlerts = TRUE;
extern string SoundAlertFile = "alert.wave";
extern bool eMailAlerts = TRUE;
int G_bars_96;
int Gi_100 = 21;
double G_ibuf_104[];
double G_ibuf_108[];
double G_ibuf_112[];
double G_ibuf_116[];
double G_ibuf_120[];
double G_ibuf_124[];
// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
SetIndexStyle(0, DRAW_NONE);
SetIndexStyle(1, DRAW_LINE, EMPTY, 3);
SetIndexStyle(2, DRAW_LINE, EMPTY, 3);
SetIndexStyle(3, DRAW_LINE, EMPTY, 3);
SetIndexStyle(4, DRAW_ARROW, EMPTY, 2);
SetIndexArrow(4, 225);
SetIndexStyle(5, DRAW_ARROW, EMPTY, 2);
SetIndexArrow(5, 226);
IndicatorDigits(Digits + 0);
SetIndexBuffer(0, G_ibuf_104);
SetIndexBuffer(1, G_ibuf_108);
SetIndexBuffer(2, G_ibuf_112);
SetIndexBuffer(3, G_ibuf_116);
SetIndexBuffer(4, G_ibuf_120);
SetIndexBuffer(5, G_ibuf_124);
IndicatorShortName("MEGAFXPROFIT ?www.megafxprofit.com");
SetIndexLabel(0, NULL);
SetIndexLabel(1, NULL);
SetIndexLabel(2, NULL);
SetIndexLabel(3, NULL);
SetIndexLabel(4, NULL);
return (0);
}
// EA2B2676C28C0DB26D39331A336C6B92
int start() {
double Ld_0;
double Ld_8;
double Ld_16;
string Ls_104;
string Ls_112;
string Ls_120;
int Li_24 = IndicatorCounted();
double Ld_28 = 0;
double Ld_36 = 0;
double Ld_unused_44 = 0;
double Ld_unused_52 = 0;
double Ld_60 = 0;
double Ld_unused_68 = 0;
double low_76 = 0;
double high_84 = 0;
if (Li_24 > 0) Li_24--;
int Li_92 = Bars - Li_24;
for (int Li_96 = 0; Li_96 < Li_92; Li_96++) {
high_84 = High[iHighest(NULL, 0, MODE_HIGH, Gi_100, Li_96)];
low_76 = Low[iLowest(NULL, 0, MODE_LOW, Gi_100, Li_96)];
Ld_16 = (High[Li_96] + Low[Li_96]) / 2.0;
Ld_28 = 0.66 * ((Ld_16 - low_76) / (high_84 - low_76) - 0.5) + 0.67 * Ld_36;
Ld_28 = MathMin(MathMax(Ld_28, -0.999), 0.999);
G_ibuf_104[Li_96] = MathLog((Ld_28 + 1.0) / (1 - Ld_28)) / 2.0 + Ld_60 / 2.0;
Ld_36 = Ld_28;
Ld_60 = G_ibuf_104[Li_96];
}
bool Li_100 = TRUE;
for (Li_96 = Li_92 - 2; Li_96 >= 0; Li_96--) {
G_ibuf_116[Li_96] = 0;
Ld_8 = G_ibuf_104[Li_96 + 1];
Ld_0 = G_ibuf_104[Li_96 + 2];
if ((Ld_8 < 0.0 && Ld_0 > 0.0) || Ld_8 < 0.0) {
Li_100 = FALSE;
if (Ld_8 < 0.0 && Ld_0 > 0.0) {
Ls_104 = Symbol() + ", TF:" + f0_0(Period());
Ls_112 = Ls_104 + ", MEGAFXPROFIT SELL SIGNAL for Level: " + Ld_8;
Ls_120 = Ls_112 + " @ " + TimeToStr(TimeLocal(), TIME_SECONDS);
if (Bars > G_bars_96) {
G_bars_96 = Bars;
f0_1(Ls_120, Ls_112);
}
}
}
if ((Ld_8 > 0.0 && Ld_0 < 0.0) || Ld_8 > 0.0) {
Li_100 = TRUE;
if (Ld_8 > 0.0 && Ld_0 < 0.0) {
Ls_104 = Symbol() + ", TF:" + f0_0(Period());
Ls_112 = Ls_104 + ", MEGAFXPROFIT BUY SIGNAL for Level: " + Ld_8;
Ls_120 = Ls_112 + " @ " + TimeToStr(TimeLocal(), TIME_SECONDS);
if (Bars > G_bars_96) {
G_bars_96 = Bars;
f0_1(Ls_120, Ls_112);
}
}
}
if (!Li_100) {
G_ibuf_112[Li_96] = Ld_8;
G_ibuf_108[Li_96] = 0.0;
} else {
G_ibuf_108[Li_96] = Ld_8;
G_ibuf_112[Li_96] = 0.0;
}
}
for (Li_96 = 0; Li_96 < Li_92; Li_96++) {
if (G_ibuf_108[Li_96] > 0.0 && G_ibuf_108[Li_96 + 1] == 0.0) G_ibuf_120[Li_96] = G_ibuf_108[Li_96];
if (G_ibuf_112[Li_96] < 0.0 && G_ibuf_112[Li_96 + 1] == 0.0) G_ibuf_124[Li_96] = G_ibuf_112[Li_96];
}
return (0);
}
// FF3DED0DF4360E36577F1A7C4D36796A
void f0_1(string As_0, string As_8) {
if (ALERTS) Alert(As_0);
if (SoundAlerts) PlaySound(SoundAlertFile);
if (eMailAlerts) SendMail(As_8, As_0);
}
// A9BA851E539886467D4ECFDDCA93F414
string f0_0(int Ai_0) {
switch (Ai_0) {
case 1:
return ("M1");
case 5:
return ("M5");
case 15:
return ("M15");
case 30:
return ("M30");
case 60:
return ("H1");
case 240:
return ("H4");
case 1440:
return ("D1");
case 10080:
return ("W1");
case 43200:
return ("MN1");
}
WindowRedraw();
return (Period());
}
두번째
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color2 Aqua
#property indicator_color3 Red
#property indicator_style2 STYLE_SOLID
#property indicator_style3 STYLE_SOLID
#property indicator_width2 2
#property indicator_width3 2
//-------------------------------------------------------------------
extern int period=8;
extern bool alarm=true;
extern bool EhlersFormula = true;
//-------------------------------------------------------------------
double ExtBuffer0[];
double ExtBuffer1[];
double ExtBuffer2[];
double alertBar;
double last;
int init()
{
SetIndexStyle(0,DRAW_NONE);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexStyle(2,DRAW_HISTOGRAM);
IndicatorDigits(Digits+1);
SetIndexBuffer(0,ExtBuffer0);
SetIndexBuffer(1,ExtBuffer1);
SetIndexBuffer(2,ExtBuffer2);
IndicatorShortName("smFisherTransform3" +" ("+period+")");
SetIndexLabel(1,NULL);
SetIndexLabel(2,NULL);
return(0);
}
int start()
{
int limit;
int counted_bars=IndicatorCounted();
double prev,current,old;
double Value=0,Value1=0,Value2=0,Fish=0,Fish1=0,Fish2=0;
double price;
double MinL=0;
double MaxH=0;
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//for(int i=0; i<Bars; i++)
for(int i=0; i<limit; i++)
{
MaxH = High[Highest(NULL,0,MODE_HIGH,period,i)];
MinL = Low[Lowest(NULL,0,MODE_LOW,period,i)];
price = (High[i]+Low[i])/2;
if (EhlersFormula == false) {
if(MaxH-MinL == 0) Value = 0.33*2*(0-0.5) + 0.67*Value1;
else Value = 0.33*2*((price-MinL)/(MaxH-MinL)-0.5) + 0.67*Value1;
}
else
{
if(MaxH-MinL == 0) Value = 0.5*2*(0-0.5) + 0.5*Value1;
else Value = 0.25*2*((price-MinL)/(MaxH-MinL)-0.5) + 0.75*Value1;
//else Value = 0.5*2*((price-MinL)/(MaxH-MinL)-0.5) + 0.5*Value1; //original Ehlers
}
if (EhlersFormula == false)
Value=MathMin(MathMax(Value,-0.999),0.999);
else
if (EhlersFormula == true) {
if (Value > 0.9999) Value = 0.9999;
if (Value < -0.9999) Value = -0.9999;
}
if (EhlersFormula == false) {
if(1-Value == 0) ExtBuffer0[i]=0.5+0.5*Fish1;
else ExtBuffer0[i]=0.5*MathLog((1+Value)/(1-Value))+0.5*Fish1;
}
else
{
if(1-Value == 0) ExtBuffer0[i]=0.25+0.75*Fish1;
else ExtBuffer0[i]=0.25*MathLog((1+Value)/(1-Value))+0.75*Fish1; //original Ehlers is 0.25/0.5...?
}
Value1=Value;
Fish1=ExtBuffer0[i];
}
bool up=true;
//for(i=Bars; i>=0; i--) {
for(i=limit; i>=0; i--) {
current=ExtBuffer0[i];
prev=ExtBuffer0[i+1];
if (((current<0)&&(prev>0))||(current<0)) up= false;
if (((current>0)&&(prev<0))||(current>0)) up= true;
if(!up) {
ExtBuffer2[i]=current;
ExtBuffer1[i]=0.0;
if (alarm == true) {
if (i==0 && prev != 2 && ExtBuffer1[i] == 0 && Bars>alertBar) {
Alert("ForexTrend Changing Down on ",Period()," ",Symbol());
alertBar = Bars;
last = 2;
}
}
}
else {
ExtBuffer1[i]=current;
ExtBuffer2[i]=0.0;
if (alarm == true) {
if (i==0 && last != 1 && ExtBuffer2[i] == 0 && Bars>alertBar) {
Alert("ForexTrend Changing Up on ",Period()," ",Symbol());
alertBar = Bars;
last = 1;
}
}
}
}
return(0);
}
세번째
#property copyright "Alksnis Gatis"
#property link "2xpoint@gmail.com"
//----
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 White
#property indicator_width2 2
//---- input parameters
extern int RangePeriod=25;
extern int SmoothPeriod=3;
extern int SmoothMode=MODE_SMA;
extern int Per=5;
//---- buffers
double ExtMapBuffer0[];
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//double ExtMapBuffer5[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(5);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexDrawBegin(0,SmoothPeriod);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexDrawBegin(1,SmoothPeriod);
SetIndexBuffer(2,ExtMapBuffer0);
SetIndexBuffer(3,ExtMapBuffer3);
SetIndexBuffer(4,ExtMapBuffer4);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
int limit,limit1,cnt,n_max,n_min;
if (counted_bars==0)
{
limit=Bars-RangePeriod;
limit1=limit-SmoothPeriod;
}
if (counted_bars>0)
{
limit=Bars-counted_bars;
limit1=limit;
}
limit--;
limit1--;
for(cnt=limit; cnt>=0;cnt--)
{
ExtMapBuffer0[cnt]=iCustom(NULL,0,"METRO",1,cnt);
}
for(cnt=limit; cnt>=0;cnt--)
{
n_max=ArrayMaximum(ExtMapBuffer0,RangePeriod,cnt);
n_min=ArrayMinimum(ExtMapBuffer0,RangePeriod,cnt);
ExtMapBuffer3[cnt]=ExtMapBuffer0[n_max];
ExtMapBuffer4[cnt]=ExtMapBuffer0[n_min];
}
for(cnt=limit1; cnt>=0;cnt--)
{
ExtMapBuffer1[cnt]=iMAOnArray(ExtMapBuffer3,0,SmoothPeriod,0,SmoothMode,cnt);
ExtMapBuffer2[cnt]=iMAOnArray(ExtMapBuffer4,0,SmoothPeriod,0,SmoothMode,cnt);
}
//----
return(0);
}
//+----------------------------------------------------
수고하십시요.
답변 1
예스스탁 예스스탁 답변
2015-06-09 10:28:46
안녕하세요
예스스탁입니다.
해당 언어를 사용해본 경험이 없어
예스랭귀지로 변경이 가능하지 않습니다.
도움을 드르지 못해 죄송합니다.
종목검색식의 내용
> 바닥차기 님이 쓴 글입니다.
> 제목 : 수식
> 안녕하세요.
아래수식은 메타4지표인데요 이걸 사용할수있게 바꿔줄수 있나요?
메타로 보니 좋은데 수식은 머가먼지 하나도 모르겟네요.
시간이 걸린다면 마지박 세번째라도 부탁합니다.
첫번째
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 Black
#property indicator_color2 Lime
#property indicator_color3 Red
#property indicator_color4 Yellow
#property indicator_color5 Lime
#property indicator_color6 Red
extern bool ALERTS = TRUE;
extern bool SoundAlerts = TRUE;
extern string SoundAlertFile = "alert.wave";
extern bool eMailAlerts = TRUE;
int G_bars_96;
int Gi_100 = 21;
double G_ibuf_104[];
double G_ibuf_108[];
double G_ibuf_112[];
double G_ibuf_116[];
double G_ibuf_120[];
double G_ibuf_124[];
// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
SetIndexStyle(0, DRAW_NONE);
SetIndexStyle(1, DRAW_LINE, EMPTY, 3);
SetIndexStyle(2, DRAW_LINE, EMPTY, 3);
SetIndexStyle(3, DRAW_LINE, EMPTY, 3);
SetIndexStyle(4, DRAW_ARROW, EMPTY, 2);
SetIndexArrow(4, 225);
SetIndexStyle(5, DRAW_ARROW, EMPTY, 2);
SetIndexArrow(5, 226);
IndicatorDigits(Digits + 0);
SetIndexBuffer(0, G_ibuf_104);
SetIndexBuffer(1, G_ibuf_108);
SetIndexBuffer(2, G_ibuf_112);
SetIndexBuffer(3, G_ibuf_116);
SetIndexBuffer(4, G_ibuf_120);
SetIndexBuffer(5, G_ibuf_124);
IndicatorShortName("MEGAFXPROFIT ?www.megafxprofit.com");
SetIndexLabel(0, NULL);
SetIndexLabel(1, NULL);
SetIndexLabel(2, NULL);
SetIndexLabel(3, NULL);
SetIndexLabel(4, NULL);
return (0);
}
// EA2B2676C28C0DB26D39331A336C6B92
int start() {
double Ld_0;
double Ld_8;
double Ld_16;
string Ls_104;
string Ls_112;
string Ls_120;
int Li_24 = IndicatorCounted();
double Ld_28 = 0;
double Ld_36 = 0;
double Ld_unused_44 = 0;
double Ld_unused_52 = 0;
double Ld_60 = 0;
double Ld_unused_68 = 0;
double low_76 = 0;
double high_84 = 0;
if (Li_24 > 0) Li_24--;
int Li_92 = Bars - Li_24;
for (int Li_96 = 0; Li_96 < Li_92; Li_96++) {
high_84 = High[iHighest(NULL, 0, MODE_HIGH, Gi_100, Li_96)];
low_76 = Low[iLowest(NULL, 0, MODE_LOW, Gi_100, Li_96)];
Ld_16 = (High[Li_96] + Low[Li_96]) / 2.0;
Ld_28 = 0.66 * ((Ld_16 - low_76) / (high_84 - low_76) - 0.5) + 0.67 * Ld_36;
Ld_28 = MathMin(MathMax(Ld_28, -0.999), 0.999);
G_ibuf_104[Li_96] = MathLog((Ld_28 + 1.0) / (1 - Ld_28)) / 2.0 + Ld_60 / 2.0;
Ld_36 = Ld_28;
Ld_60 = G_ibuf_104[Li_96];
}
bool Li_100 = TRUE;
for (Li_96 = Li_92 - 2; Li_96 >= 0; Li_96--) {
G_ibuf_116[Li_96] = 0;
Ld_8 = G_ibuf_104[Li_96 + 1];
Ld_0 = G_ibuf_104[Li_96 + 2];
if ((Ld_8 < 0.0 && Ld_0 > 0.0) || Ld_8 < 0.0) {
Li_100 = FALSE;
if (Ld_8 < 0.0 && Ld_0 > 0.0) {
Ls_104 = Symbol() + ", TF:" + f0_0(Period());
Ls_112 = Ls_104 + ", MEGAFXPROFIT SELL SIGNAL for Level: " + Ld_8;
Ls_120 = Ls_112 + " @ " + TimeToStr(TimeLocal(), TIME_SECONDS);
if (Bars > G_bars_96) {
G_bars_96 = Bars;
f0_1(Ls_120, Ls_112);
}
}
}
if ((Ld_8 > 0.0 && Ld_0 < 0.0) || Ld_8 > 0.0) {
Li_100 = TRUE;
if (Ld_8 > 0.0 && Ld_0 < 0.0) {
Ls_104 = Symbol() + ", TF:" + f0_0(Period());
Ls_112 = Ls_104 + ", MEGAFXPROFIT BUY SIGNAL for Level: " + Ld_8;
Ls_120 = Ls_112 + " @ " + TimeToStr(TimeLocal(), TIME_SECONDS);
if (Bars > G_bars_96) {
G_bars_96 = Bars;
f0_1(Ls_120, Ls_112);
}
}
}
if (!Li_100) {
G_ibuf_112[Li_96] = Ld_8;
G_ibuf_108[Li_96] = 0.0;
} else {
G_ibuf_108[Li_96] = Ld_8;
G_ibuf_112[Li_96] = 0.0;
}
}
for (Li_96 = 0; Li_96 < Li_92; Li_96++) {
if (G_ibuf_108[Li_96] > 0.0 && G_ibuf_108[Li_96 + 1] == 0.0) G_ibuf_120[Li_96] = G_ibuf_108[Li_96];
if (G_ibuf_112[Li_96] < 0.0 && G_ibuf_112[Li_96 + 1] == 0.0) G_ibuf_124[Li_96] = G_ibuf_112[Li_96];
}
return (0);
}
// FF3DED0DF4360E36577F1A7C4D36796A
void f0_1(string As_0, string As_8) {
if (ALERTS) Alert(As_0);
if (SoundAlerts) PlaySound(SoundAlertFile);
if (eMailAlerts) SendMail(As_8, As_0);
}
// A9BA851E539886467D4ECFDDCA93F414
string f0_0(int Ai_0) {
switch (Ai_0) {
case 1:
return ("M1");
case 5:
return ("M5");
case 15:
return ("M15");
case 30:
return ("M30");
case 60:
return ("H1");
case 240:
return ("H4");
case 1440:
return ("D1");
case 10080:
return ("W1");
case 43200:
return ("MN1");
}
WindowRedraw();
return (Period());
}
두번째
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color2 Aqua
#property indicator_color3 Red
#property indicator_style2 STYLE_SOLID
#property indicator_style3 STYLE_SOLID
#property indicator_width2 2
#property indicator_width3 2
//-------------------------------------------------------------------
extern int period=8;
extern bool alarm=true;
extern bool EhlersFormula = true;
//-------------------------------------------------------------------
double ExtBuffer0[];
double ExtBuffer1[];
double ExtBuffer2[];
double alertBar;
double last;
int init()
{
SetIndexStyle(0,DRAW_NONE);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexStyle(2,DRAW_HISTOGRAM);
IndicatorDigits(Digits+1);
SetIndexBuffer(0,ExtBuffer0);
SetIndexBuffer(1,ExtBuffer1);
SetIndexBuffer(2,ExtBuffer2);
IndicatorShortName("smFisherTransform3" +" ("+period+")");
SetIndexLabel(1,NULL);
SetIndexLabel(2,NULL);
return(0);
}
int start()
{
int limit;
int counted_bars=IndicatorCounted();
double prev,current,old;
double Value=0,Value1=0,Value2=0,Fish=0,Fish1=0,Fish2=0;
double price;
double MinL=0;
double MaxH=0;
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//for(int i=0; i<Bars; i++)
for(int i=0; i<limit; i++)
{
MaxH = High[Highest(NULL,0,MODE_HIGH,period,i)];
MinL = Low[Lowest(NULL,0,MODE_LOW,period,i)];
price = (High[i]+Low[i])/2;
if (EhlersFormula == false) {
if(MaxH-MinL == 0) Value = 0.33*2*(0-0.5) + 0.67*Value1;
else Value = 0.33*2*((price-MinL)/(MaxH-MinL)-0.5) + 0.67*Value1;
}
else
{
if(MaxH-MinL == 0) Value = 0.5*2*(0-0.5) + 0.5*Value1;
else Value = 0.25*2*((price-MinL)/(MaxH-MinL)-0.5) + 0.75*Value1;
//else Value = 0.5*2*((price-MinL)/(MaxH-MinL)-0.5) + 0.5*Value1; //original Ehlers
}
if (EhlersFormula == false)
Value=MathMin(MathMax(Value,-0.999),0.999);
else
if (EhlersFormula == true) {
if (Value > 0.9999) Value = 0.9999;
if (Value < -0.9999) Value = -0.9999;
}
if (EhlersFormula == false) {
if(1-Value == 0) ExtBuffer0[i]=0.5+0.5*Fish1;
else ExtBuffer0[i]=0.5*MathLog((1+Value)/(1-Value))+0.5*Fish1;
}
else
{
if(1-Value == 0) ExtBuffer0[i]=0.25+0.75*Fish1;
else ExtBuffer0[i]=0.25*MathLog((1+Value)/(1-Value))+0.75*Fish1; //original Ehlers is 0.25/0.5...?
}
Value1=Value;
Fish1=ExtBuffer0[i];
}
bool up=true;
//for(i=Bars; i>=0; i--) {
for(i=limit; i>=0; i--) {
current=ExtBuffer0[i];
prev=ExtBuffer0[i+1];
if (((current<0)&&(prev>0))||(current<0)) up= false;
if (((current>0)&&(prev<0))||(current>0)) up= true;
if(!up) {
ExtBuffer2[i]=current;
ExtBuffer1[i]=0.0;
if (alarm == true) {
if (i==0 && prev != 2 && ExtBuffer1[i] == 0 && Bars>alertBar) {
Alert("ForexTrend Changing Down on ",Period()," ",Symbol());
alertBar = Bars;
last = 2;
}
}
}
else {
ExtBuffer1[i]=current;
ExtBuffer2[i]=0.0;
if (alarm == true) {
if (i==0 && last != 1 && ExtBuffer2[i] == 0 && Bars>alertBar) {
Alert("ForexTrend Changing Up on ",Period()," ",Symbol());
alertBar = Bars;
last = 1;
}
}
}
}
return(0);
}
세번째
#property copyright "Alksnis Gatis"
#property link "2xpoint@gmail.com"
//----
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 White
#property indicator_width2 2
//---- input parameters
extern int RangePeriod=25;
extern int SmoothPeriod=3;
extern int SmoothMode=MODE_SMA;
extern int Per=5;
//---- buffers
double ExtMapBuffer0[];
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//double ExtMapBuffer5[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(5);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexDrawBegin(0,SmoothPeriod);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexDrawBegin(1,SmoothPeriod);
SetIndexBuffer(2,ExtMapBuffer0);
SetIndexBuffer(3,ExtMapBuffer3);
SetIndexBuffer(4,ExtMapBuffer4);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
int limit,limit1,cnt,n_max,n_min;
if (counted_bars==0)
{
limit=Bars-RangePeriod;
limit1=limit-SmoothPeriod;
}
if (counted_bars>0)
{
limit=Bars-counted_bars;
limit1=limit;
}
limit--;
limit1--;
for(cnt=limit; cnt>=0;cnt--)
{
ExtMapBuffer0[cnt]=iCustom(NULL,0,"METRO",1,cnt);
}
for(cnt=limit; cnt>=0;cnt--)
{
n_max=ArrayMaximum(ExtMapBuffer0,RangePeriod,cnt);
n_min=ArrayMinimum(ExtMapBuffer0,RangePeriod,cnt);
ExtMapBuffer3[cnt]=ExtMapBuffer0[n_max];
ExtMapBuffer4[cnt]=ExtMapBuffer0[n_min];
}
for(cnt=limit1; cnt>=0;cnt--)
{
ExtMapBuffer1[cnt]=iMAOnArray(ExtMapBuffer3,0,SmoothPeriod,0,SmoothMode,cnt);
ExtMapBuffer2[cnt]=iMAOnArray(ExtMapBuffer4,0,SmoothPeriod,0,SmoothMode,cnt);
}
//----
return(0);
}
//+----------------------------------------------------
수고하십시요.