코딩 도움말 - 페이지 514 1...507508509510511512513514515516517518519520521...786 새 코멘트 Triip 2015.08.05 15:37 #5131 mladen: 여행 이것을 확인하십시오 : https://www.mql5.com/en/forum/general 빠른 ma 기간을 1로 설정하면 가격이 이동 평균(슬로 마)을 교차하는 것과 동일합니다. 훌륭한! 감사 합니다 ms03-039 2015.08.05 17:14 #5132 이러한 표시기는 오류입니다. 어떻게 고치는 지 ? 파일: xxc.jpg 188 kb Mladen Rakic 2015.08.05 17:40 #5133 popej30: 표시등은 오류입니다. 어떻게 고치는 지 ? 그 사진에서 오류가 어디에 있는지 볼 수 없습니다 ms03-039 2015.08.05 18:23 #5134 smartfone 에 경고를 추가 하는 방법은 무엇입니까? 코드 : .... .... 하지만 경고는 이제 촛불을 각각 보여줍니다 !!! '푸시' MetaQuotes ID가 있습니다. 테스트 확인. 뭐가 잘못 되었 니 ?? 파일: xxc_1.jpg 97 kb xxv.jpg 115 kb Mladen Rakic 2015.08.05 18:52 #5135 popej30: smartfone에 경고를 추가하는 방법은 무엇입니까? 코드 : .... .... 하지만 경고는 이제 촛불을 각각 보여줍니다 !!! '푸시' MetaQuotes ID가 있습니다. 테스트 확인. 뭐가 잘못 되었 니 ?? 알림을 보내야 하는 시기를 결정할 기준이 없습니다(예: "if (condition==true) SentNotification("alert");). 언제 실행해야 하는지 "if" 기준을 추가하세요. 그리고 deinit가 아닌 시작 프로시저에 있어야 합니다(deinit은 어떤 이유로든 표시기가 중지된 경우에만 실행되기 때문에) ms03-039 2015.08.05 19:00 #5136 열린 촛불에 경고 - 오류! 색상 촛불만 변경하도록 경고합니다. #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_width1 4 #property indicator_color2 Red #property indicator_width2 4 #property indicator_minimum 0 #property indicator_maximum 1 //---- input parameters extern string TimeFrame = "Current time frame"; extern int Price = 12; extern int Length = 4; extern int Displace = 0; extern int Filter = 1; extern double Deviation = 0; extern string _ = "alerts settings"; extern bool alertsOn = true; extern bool alertsOnCurrent = true; extern bool alertsMessage = true; extern bool alertsSound = false; extern bool alertsEmail = false; double Cycle = 4; //---- indicator buffers double MABuffer[]; double UpBuffer[]; double DnBuffer[]; double price[]; double trend[]; string indicatorFileName; bool returnBars; bool calculateValue; int timeFrame; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SendNotification("smartfon alert"); int ft=0; string short_name; //---- indicator line IndicatorBuffers(5); SetIndexBuffer(0,UpBuffer); SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexBuffer(1,DnBuffer); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexBuffer(2,MABuffer); SetIndexBuffer(3,price); SetIndexBuffer(4,trend); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); //---- name for DataWindow and indicator subwindow label SetIndexLabel(0,"NLMA"); SetIndexLabel(1,"Up"); SetIndexLabel(2,"Dn"); //---- SetIndexShift(0,Displace); SetIndexShift(1,Displace); SetIndexShift(2,Displace); SetIndexDrawBegin(0,Length*Cycle+Length); SetIndexDrawBegin(1,Length*Cycle+Length); SetIndexDrawBegin(2,Length*Cycle+Length); //---- indicatorFileName = WindowExpertName(); returnBars = (TimeFrame=="returnBars"); if (returnBars) return(0); calculateValue = (TimeFrame=="calculateValue"); if (calculateValue) return(0); timeFrame = stringToTimeFrame(TimeFrame); short_name=timeFrameToString(timeFrame)+" XXX ("+Length+")"; IndicatorShortName(short_name); return(0); } //+------------------------------------------------------------------+ //| NonLagMA_v4 | //+------------------------------------------------------------------+ int start() { int i,shift, counted_bars=IndicatorCounted(),limit; double alfa, beta, t, Sum, Weight, g; double pi = 3.1415926535; double Coeff = 3*pi; int Phase = Length-1; double Len = Length*Cycle + Phase; if ( counted_bars > 0 ) limit=Bars-counted_bars; if ( counted_bars < 0 ) return(0); if ( counted_bars ==0 ) limit=Bars-Len-1; if ( returnBars) { UpBuffer[0] = limit+1; return(0); } if (calculateValue || timeFrame==Period()) { if ( counted_bars < 1 ) for(i=1;i<Length*Cycle+Length;i++) { MABuffer=0; UpBuffer=0; DnBuffer=0; } for(shift=limit;shift>=0;shift--) { Weight=0; Sum=0; t=0; for (i=0;i<=Len-1;i++) { g = 1.0/(Coeff*t+1); if (t <= 0.5 ) g = 1; beta = MathCos(pi*t); alfa = g * beta; //if (shift>=1) price = iMA(NULL,0,Per,Displace,Mode,Price,shift+i); //else price = iMA(NULL,0,1,0,MODE_SMA,Price,shift+i); Sum += alfa*price; Weight += alfa; if ( t < 1 ) t += 1.0/(Phase-1); else if ( t < Len-1 ) t += (2*Cycle-1)/(Cycle*Length-1); } if (Weight > 0) MABuffer[shift] = (1.0+Deviation/100)*Sum/Weight; if (Filter>0) { if( MathAbs(MABuffer[shift]-MABuffer[shift+1]) < Filter*Point ) MABuffer[shift]=MABuffer[shift+1]; } trend[shift]=trend[shift+1]; if (MABuffer[shift]-MABuffer[shift+1] > Filter*Point) trend[shift]= 1; if (MABuffer[shift+1]-MABuffer[shift] > Filter*Point) trend[shift]=-1; if (trend[shift]>0) { UpBuffer[shift] = 1; DnBuffer[shift] = EMPTY_VALUE; } if (trend[shift]<0) { DnBuffer[shift] = 1; UpBuffer[shift] = EMPTY_VALUE; } } manageAlerts(); return(0); } // // // // // for(i = limit; i >=0; i--) { int y = iBarShift(NULL,timeFrame,Time); UpBuffer = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",Price,Length,Displace,Filter,Deviation,0,y); DnBuffer = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",Price,Length,Displace,Filter,Deviation,1,y); trend = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",Price,Length,Displace,Filter,Deviation,4,y); } manageAlerts(); return(0); } //+------------------------------------------------------------------- //| //+------------------------------------------------------------------- // // // // // string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"}; int iTfTable[] = {1,5,15,30,60,240,1440,10080,43200}; int stringToTimeFrame(string tfs) { tfs = stringUpperCase(tfs); for (int i=ArraySize(iTfTable)-1; i>=0; i--) if (tfs==sTfTable || tfs==""+iTfTable) return(MathMax(iTfTable,Period())); return(Period()); } string timeFrameToString(int tf) { for (int i=ArraySize(iTfTable)-1; i>=0; i--) if (tf==iTfTable) return(sTfTable); return(""); } // // // // // string stringUpperCase(string str) { string s = str; for (int length=StringLen(str)-1; length>=0; length--) { int tchar = StringGetChar(s, length); if((tchar > 96 && tchar 223 && tchar < 256)) s = StringSetChar(s, length, tchar - 32); else if(tchar > -33 && tchar < 0) s = StringSetChar(s, length, tchar + 224); } return(s); } // // // // // void manageAlerts() { if (!calculateValue && alertsOn) { if (alertsOnCurrent) int whichBar = 0; else whichBar = 1; whichBar = iBarShift(NULL,0,iTime(NULL,timeFrame,whichBar)); if (trend[whichBar] != trend[whichBar+1]) { if (trend[whichBar] == 1) doAlert(whichBar,"buy"); if (trend[whichBar] == -1) doAlert(whichBar,"sell"); } } } // // // // // void doAlert(int forBar, string doWhat) { static string previousAlert="nothing"; static datetime previousTime; string message; if (previousAlert != doWhat || previousTime != Time[forBar]) { previousAlert = doWhat; previousTime = Time[forBar]; // // // // // message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," - ",timeFrameToString(timeFrame)+" NonLagMa slope ",doWhat); if (alertsMessage) Alert(message); if (alertsEmail) SendMail(StringConcatenate(Symbol()," XXX "),message); if (alertsSound) PlaySound("alert2.wav"); } } Coding help Multi Timeframe Indicators [WARNING CLOSED!] Any newbie Mladen Rakic 2015.08.05 19:26 #5137 popej30: 열린 촛불에 경고 - 오류! 색상 촛불만 변경하도록 경고합니다. #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_width1 4 #property indicator_color2 Red #property indicator_width2 4 #property indicator_minimum 0 #property indicator_maximum 1 //---- input parameters extern string TimeFrame = "Current time frame"; extern int Price = 12; extern int Length = 4; extern int Displace = 0; extern int Filter = 1; extern double Deviation = 0; extern string _ = "alerts settings"; extern bool alertsOn = true; extern bool alertsOnCurrent = true; extern bool alertsMessage = true; extern bool alertsSound = false; extern bool alertsEmail = false; double Cycle = 4; //---- indicator buffers double MABuffer[]; double UpBuffer[]; double DnBuffer[]; double price[]; double trend[]; string indicatorFileName; bool returnBars; bool calculateValue; int timeFrame; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SendNotification("smartfon alert"); int ft=0; string short_name; //---- indicator line IndicatorBuffers(5); SetIndexBuffer(0,UpBuffer); SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexBuffer(1,DnBuffer); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexBuffer(2,MABuffer); SetIndexBuffer(3,price); SetIndexBuffer(4,trend); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); //---- name for DataWindow and indicator subwindow label SetIndexLabel(0,"NLMA"); SetIndexLabel(1,"Up"); SetIndexLabel(2,"Dn"); //---- SetIndexShift(0,Displace); SetIndexShift(1,Displace); SetIndexShift(2,Displace); SetIndexDrawBegin(0,Length*Cycle+Length); SetIndexDrawBegin(1,Length*Cycle+Length); SetIndexDrawBegin(2,Length*Cycle+Length); //---- indicatorFileName = WindowExpertName(); returnBars = (TimeFrame=="returnBars"); if (returnBars) return(0); calculateValue = (TimeFrame=="calculateValue"); if (calculateValue) return(0); timeFrame = stringToTimeFrame(TimeFrame); short_name=timeFrameToString(timeFrame)+" XXX ("+Length+")"; IndicatorShortName(short_name); return(0); } //+------------------------------------------------------------------+ //| NonLagMA_v4 | //+------------------------------------------------------------------+ int start() { int i,shift, counted_bars=IndicatorCounted(),limit; double alfa, beta, t, Sum, Weight, g; double pi = 3.1415926535; double Coeff = 3*pi; int Phase = Length-1; double Len = Length*Cycle + Phase; if ( counted_bars > 0 ) limit=Bars-counted_bars; if ( counted_bars < 0 ) return(0); if ( counted_bars ==0 ) limit=Bars-Len-1; if ( returnBars) { UpBuffer[0] = limit+1; return(0); } if (calculateValue || timeFrame==Period()) { if ( counted_bars < 1 ) for(i=1;i<Length*Cycle+Length;i++) { MABuffer=0; UpBuffer=0; DnBuffer=0; } for(shift=limit;shift>=0;shift--) { Weight=0; Sum=0; t=0; for (i=0;i<=Len-1;i++) { g = 1.0/(Coeff*t+1); if (t <= 0.5 ) g = 1; beta = MathCos(pi*t); alfa = g * beta; //if (shift>=1) price = iMA(NULL,0,Per,Displace,Mode,Price,shift+i); //else price = iMA(NULL,0,1,0,MODE_SMA,Price,shift+i); Sum += alfa*price; Weight += alfa; if ( t < 1 ) t += 1.0/(Phase-1); else if ( t < Len-1 ) t += (2*Cycle-1)/(Cycle*Length-1); } if (Weight > 0) MABuffer[shift] = (1.0+Deviation/100)*Sum/Weight; if (Filter>0) { if( MathAbs(MABuffer[shift]-MABuffer[shift+1]) < Filter*Point ) MABuffer[shift]=MABuffer[shift+1]; } trend[shift]=trend[shift+1]; if (MABuffer[shift]-MABuffer[shift+1] > Filter*Point) trend[shift]= 1; if (MABuffer[shift+1]-MABuffer[shift] > Filter*Point) trend[shift]=-1; if (trend[shift]>0) { UpBuffer[shift] = 1; DnBuffer[shift] = EMPTY_VALUE; } if (trend[shift]<0) { DnBuffer[shift] = 1; UpBuffer[shift] = EMPTY_VALUE; } } manageAlerts(); return(0); } // // // // // for(i = limit; i >=0; i--) { int y = iBarShift(NULL,timeFrame,Time); UpBuffer = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",Price,Length,Displace,Filter,Deviation,0,y); DnBuffer = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",Price,Length,Displace,Filter,Deviation,1,y); trend = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",Price,Length,Displace,Filter,Deviation,4,y); } manageAlerts(); return(0); } //+------------------------------------------------------------------- //| //+------------------------------------------------------------------- // // // // // string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"}; int iTfTable[] = {1,5,15,30,60,240,1440,10080,43200}; int stringToTimeFrame(string tfs) { tfs = stringUpperCase(tfs); for (int i=ArraySize(iTfTable)-1; i>=0; i--) if (tfs==sTfTable || tfs==""+iTfTable) return(MathMax(iTfTable,Period())); return(Period()); } string timeFrameToString(int tf) { for (int i=ArraySize(iTfTable)-1; i>=0; i--) if (tf==iTfTable) return(sTfTable); return(""); } // // // // // string stringUpperCase(string str) { string s = str; for (int length=StringLen(str)-1; length>=0; length--) { int tchar = StringGetChar(s, length); if((tchar > 96 && tchar 223 && tchar < 256)) s = StringSetChar(s, length, tchar - 32); else if(tchar > -33 && tchar < 0) s = StringSetChar(s, length, tchar + 224); } return(s); } // // // // // void manageAlerts() { if (!calculateValue && alertsOn) { if (alertsOnCurrent) int whichBar = 0; else whichBar = 1; whichBar = iBarShift(NULL,0,iTime(NULL,timeFrame,whichBar)); if (trend[whichBar] != trend[whichBar+1]) { if (trend[whichBar] == 1) doAlert(whichBar,"buy"); if (trend[whichBar] == -1) doAlert(whichBar,"sell"); } } } // // // // // void doAlert(int forBar, string doWhat) { static string previousAlert="nothing"; static datetime previousTime; string message; if (previousAlert != doWhat || previousTime != Time[forBar]) { previousAlert = doWhat; previousTime = Time[forBar]; // // // // // message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," - ",timeFrameToString(timeFrame)+" NonLagMa slope ",doWhat); if (alertsMessage) Alert(message); if (alertsEmail) SendMail(StringConcatenate(Symbol()," XXX "),message); if (alertsSound) PlaySound("alert2.wav"); } } 이미 올바르게 코딩된 비 지연 질량을 단순히 사용하지 않는 이유는 무엇입니까? t 변수 값에는 적절한 값이 할당되지 않습니다. 나머지 dU는 확인 하지 않았습니다. 그것만으로도 모든 것이 제대로 계산되지 않을 수 있기 때문입니다. Mladen Rakic 2015.08.06 12:29 #5138 triip: 훌륭한! 감사 합니다 행복한 거래 ms03-039 2015.08.06 18:49 #5139 mladen: 이미 올바르게 코딩된 비 지연 질량을 단순히 사용하지 않는 이유는 무엇입니까? t 변수 값에는 적절한 값이 할당되지 않습니다. 나머지 dU는 확인하지 않았습니다. 그것만으로도 모든 것이 제대로 계산되지 않을 수 있기 때문입니다. 당신은 내 "푸시 smartfon"을 도와줍니다. Mladen Rakic 2015.08.06 20:02 #5140 popej30: 당신은 내 "푸시 smartfon"을 도와줍니다. 나머지(MetQuotesID 및 나머지)가 모두 정상적으로 설정되었으면 SendNotificaton()만 있으면 작동하며 작동해야 합니다. 1...507508509510511512513514515516517518519520521...786 새 코멘트 트레이딩 기회를 놓치고 있어요: 무료 트레이딩 앱 복사용 8,000 이상의 시그널 금융 시장 개척을 위한 경제 뉴스 등록 로그인 공백없는 라틴 문자 비밀번호가 이 이메일로 전송될 것입니다 오류 발생됨 Google으로 로그인 웹사이트 정책 및 이용약관에 동의합니다. 계정이 없으시면, 가입하십시오 MQL5.com 웹사이트에 로그인을 하기 위해 쿠키를 허용하십시오. 브라우저에서 필요한 설정을 활성화하시지 않으면, 로그인할 수 없습니다. 사용자명/비밀번호를 잊으셨습니까? Google으로 로그인
여행
이것을 확인하십시오 : https://www.mql5.com/en/forum/general
빠른 ma 기간을 1로 설정하면 가격이 이동 평균(슬로 마)을 교차하는 것과 동일합니다.훌륭한! 감사 합니다![](https://c.mql5.com/forextsd/smiles/regular_smile.png)
이러한 표시기는 오류입니다. 어떻게 고치는 지 ?
표시등은 오류입니다. 어떻게 고치는 지 ?
그 사진에서 오류가 어디에 있는지 볼 수 없습니다
smartfone 에 경고를 추가 하는 방법은 무엇입니까?
코드 : ....
.... 하지만 경고는 이제 촛불을 각각 보여줍니다 !!!
'푸시' MetaQuotes ID가 있습니다.
테스트 확인.
뭐가 잘못 되었 니 ??
smartfone에 경고를 추가하는 방법은 무엇입니까?
코드 : ....
.... 하지만 경고는 이제 촛불을 각각 보여줍니다 !!!
'푸시' MetaQuotes ID가 있습니다.
테스트 확인.
뭐가 잘못 되었 니 ??알림을 보내야 하는 시기를 결정할 기준이 없습니다(예: "if (condition==true) SentNotification("alert");). 언제 실행해야 하는지 "if" 기준을 추가하세요.
그리고 deinit가 아닌 시작 프로시저에 있어야 합니다(deinit은 어떤 이유로든 표시기가 중지된 경우에만 실행되기 때문에)
열린 촛불에 경고 - 오류!
색상 촛불만 변경하도록 경고합니다.
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_width1 4
#property indicator_color2 Red
#property indicator_width2 4
#property indicator_minimum 0
#property indicator_maximum 1
//---- input parameters
extern string TimeFrame = "Current time frame";
extern int Price = 12;
extern int Length = 4;
extern int Displace = 0;
extern int Filter = 1;
extern double Deviation = 0;
extern string _ = "alerts settings";
extern bool alertsOn = true;
extern bool alertsOnCurrent = true;
extern bool alertsMessage = true;
extern bool alertsSound = false;
extern bool alertsEmail = false;
double Cycle = 4;
//---- indicator buffers
double MABuffer[];
double UpBuffer[];
double DnBuffer[];
double price[];
double trend[];
string indicatorFileName;
bool returnBars;
bool calculateValue;
int timeFrame;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SendNotification("smartfon alert");
int ft=0;
string short_name;
//---- indicator line
IndicatorBuffers(5);
SetIndexBuffer(0,UpBuffer); SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(1,DnBuffer); SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(2,MABuffer);
SetIndexBuffer(3,price);
SetIndexBuffer(4,trend);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//---- name for DataWindow and indicator subwindow label
SetIndexLabel(0,"NLMA");
SetIndexLabel(1,"Up");
SetIndexLabel(2,"Dn");
//----
SetIndexShift(0,Displace);
SetIndexShift(1,Displace);
SetIndexShift(2,Displace);
SetIndexDrawBegin(0,Length*Cycle+Length);
SetIndexDrawBegin(1,Length*Cycle+Length);
SetIndexDrawBegin(2,Length*Cycle+Length);
//----
indicatorFileName = WindowExpertName();
returnBars = (TimeFrame=="returnBars"); if (returnBars) return(0);
calculateValue = (TimeFrame=="calculateValue"); if (calculateValue) return(0);
timeFrame = stringToTimeFrame(TimeFrame);
short_name=timeFrameToString(timeFrame)+" XXX ("+Length+")";
IndicatorShortName(short_name);
return(0);
}
//+------------------------------------------------------------------+
//| NonLagMA_v4 |
//+------------------------------------------------------------------+
int start()
{
int i,shift, counted_bars=IndicatorCounted(),limit;
double alfa, beta, t, Sum, Weight, g;
double pi = 3.1415926535;
double Coeff = 3*pi;
int Phase = Length-1;
double Len = Length*Cycle + Phase;
if ( counted_bars > 0 ) limit=Bars-counted_bars;
if ( counted_bars < 0 ) return(0);
if ( counted_bars ==0 ) limit=Bars-Len-1;
if ( returnBars) { UpBuffer[0] = limit+1; return(0); }
if (calculateValue || timeFrame==Period())
{
if ( counted_bars < 1 )
for(i=1;i<Length*Cycle+Length;i++)
{
MABuffer=0;
UpBuffer=0;
DnBuffer=0;
}
for(shift=limit;shift>=0;shift--)
{
Weight=0; Sum=0; t=0;
for (i=0;i<=Len-1;i++)
{
g = 1.0/(Coeff*t+1);
if (t <= 0.5 ) g = 1;
beta = MathCos(pi*t);
alfa = g * beta;
//if (shift>=1) price = iMA(NULL,0,Per,Displace,Mode,Price,shift+i);
//else
price = iMA(NULL,0,1,0,MODE_SMA,Price,shift+i);
Sum += alfa*price;
Weight += alfa;
if ( t < 1 ) t += 1.0/(Phase-1);
else if ( t < Len-1 ) t += (2*Cycle-1)/(Cycle*Length-1);
}
if (Weight > 0) MABuffer[shift] = (1.0+Deviation/100)*Sum/Weight;
if (Filter>0)
{
if( MathAbs(MABuffer[shift]-MABuffer[shift+1]) < Filter*Point ) MABuffer[shift]=MABuffer[shift+1];
}
trend[shift]=trend[shift+1];
if (MABuffer[shift]-MABuffer[shift+1] > Filter*Point) trend[shift]= 1;
if (MABuffer[shift+1]-MABuffer[shift] > Filter*Point) trend[shift]=-1;
if (trend[shift]>0)
{
UpBuffer[shift] = 1;
DnBuffer[shift] = EMPTY_VALUE;
}
if (trend[shift]<0)
{
DnBuffer[shift] = 1;
UpBuffer[shift] = EMPTY_VALUE;
}
}
manageAlerts();
return(0);
}
//
//
//
//
//
for(i = limit; i >=0; i--)
{
int y = iBarShift(NULL,timeFrame,Time);
UpBuffer = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",Price,Length,Displace,Filter,Deviation,0,y);
DnBuffer = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",Price,Length,Displace,Filter,Deviation,1,y);
trend = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",Price,Length,Displace,Filter,Deviation,4,y);
}
manageAlerts();
return(0);
}
//+-------------------------------------------------------------------
//|
//+-------------------------------------------------------------------
//
//
//
//
//
string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"};
int iTfTable[] = {1,5,15,30,60,240,1440,10080,43200};
int stringToTimeFrame(string tfs)
{
tfs = stringUpperCase(tfs);
for (int i=ArraySize(iTfTable)-1; i>=0; i--)
if (tfs==sTfTable || tfs==""+iTfTable) return(MathMax(iTfTable,Period()));
return(Period());
}
string timeFrameToString(int tf)
{
for (int i=ArraySize(iTfTable)-1; i>=0; i--)
if (tf==iTfTable) return(sTfTable);
return("");
}
//
//
//
//
//
string stringUpperCase(string str)
{
string s = str;
for (int length=StringLen(str)-1; length>=0; length--)
{
int tchar = StringGetChar(s, length);
if((tchar > 96 && tchar 223 && tchar < 256))
s = StringSetChar(s, length, tchar - 32);
else if(tchar > -33 && tchar < 0)
s = StringSetChar(s, length, tchar + 224);
}
return(s);
}
//
//
//
//
//
void manageAlerts()
{
if (!calculateValue && alertsOn)
{
if (alertsOnCurrent)
int whichBar = 0;
else whichBar = 1; whichBar = iBarShift(NULL,0,iTime(NULL,timeFrame,whichBar));
if (trend[whichBar] != trend[whichBar+1])
{
if (trend[whichBar] == 1) doAlert(whichBar,"buy");
if (trend[whichBar] == -1) doAlert(whichBar,"sell");
}
}
}
//
//
//
//
//
void doAlert(int forBar, string doWhat)
{
static string previousAlert="nothing";
static datetime previousTime;
string message;
if (previousAlert != doWhat || previousTime != Time[forBar]) {
previousAlert = doWhat;
previousTime = Time[forBar];
//
//
//
//
//
message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," - ",timeFrameToString(timeFrame)+" NonLagMa slope ",doWhat);
if (alertsMessage) Alert(message);
if (alertsEmail) SendMail(StringConcatenate(Symbol()," XXX "),message);
if (alertsSound) PlaySound("alert2.wav");
}
}열린 촛불에 경고 - 오류!
색상 촛불만 변경하도록 경고합니다.
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_width1 4
#property indicator_color2 Red
#property indicator_width2 4
#property indicator_minimum 0
#property indicator_maximum 1
//---- input parameters
extern string TimeFrame = "Current time frame";
extern int Price = 12;
extern int Length = 4;
extern int Displace = 0;
extern int Filter = 1;
extern double Deviation = 0;
extern string _ = "alerts settings";
extern bool alertsOn = true;
extern bool alertsOnCurrent = true;
extern bool alertsMessage = true;
extern bool alertsSound = false;
extern bool alertsEmail = false;
double Cycle = 4;
//---- indicator buffers
double MABuffer[];
double UpBuffer[];
double DnBuffer[];
double price[];
double trend[];
string indicatorFileName;
bool returnBars;
bool calculateValue;
int timeFrame;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SendNotification("smartfon alert");
int ft=0;
string short_name;
//---- indicator line
IndicatorBuffers(5);
SetIndexBuffer(0,UpBuffer); SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(1,DnBuffer); SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(2,MABuffer);
SetIndexBuffer(3,price);
SetIndexBuffer(4,trend);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//---- name for DataWindow and indicator subwindow label
SetIndexLabel(0,"NLMA");
SetIndexLabel(1,"Up");
SetIndexLabel(2,"Dn");
//----
SetIndexShift(0,Displace);
SetIndexShift(1,Displace);
SetIndexShift(2,Displace);
SetIndexDrawBegin(0,Length*Cycle+Length);
SetIndexDrawBegin(1,Length*Cycle+Length);
SetIndexDrawBegin(2,Length*Cycle+Length);
//----
indicatorFileName = WindowExpertName();
returnBars = (TimeFrame=="returnBars"); if (returnBars) return(0);
calculateValue = (TimeFrame=="calculateValue"); if (calculateValue) return(0);
timeFrame = stringToTimeFrame(TimeFrame);
short_name=timeFrameToString(timeFrame)+" XXX ("+Length+")";
IndicatorShortName(short_name);
return(0);
}
//+------------------------------------------------------------------+
//| NonLagMA_v4 |
//+------------------------------------------------------------------+
int start()
{
int i,shift, counted_bars=IndicatorCounted(),limit;
double alfa, beta, t, Sum, Weight, g;
double pi = 3.1415926535;
double Coeff = 3*pi;
int Phase = Length-1;
double Len = Length*Cycle + Phase;
if ( counted_bars > 0 ) limit=Bars-counted_bars;
if ( counted_bars < 0 ) return(0);
if ( counted_bars ==0 ) limit=Bars-Len-1;
if ( returnBars) { UpBuffer[0] = limit+1; return(0); }
if (calculateValue || timeFrame==Period())
{
if ( counted_bars < 1 )
for(i=1;i<Length*Cycle+Length;i++)
{
MABuffer=0;
UpBuffer=0;
DnBuffer=0;
}
for(shift=limit;shift>=0;shift--)
{
Weight=0; Sum=0; t=0;
for (i=0;i<=Len-1;i++)
{
g = 1.0/(Coeff*t+1);
if (t <= 0.5 ) g = 1;
beta = MathCos(pi*t);
alfa = g * beta;
//if (shift>=1) price = iMA(NULL,0,Per,Displace,Mode,Price,shift+i);
//else
price = iMA(NULL,0,1,0,MODE_SMA,Price,shift+i);
Sum += alfa*price;
Weight += alfa;
if ( t < 1 ) t += 1.0/(Phase-1);
else if ( t < Len-1 ) t += (2*Cycle-1)/(Cycle*Length-1);
}
if (Weight > 0) MABuffer[shift] = (1.0+Deviation/100)*Sum/Weight;
if (Filter>0)
{
if( MathAbs(MABuffer[shift]-MABuffer[shift+1]) < Filter*Point ) MABuffer[shift]=MABuffer[shift+1];
}
trend[shift]=trend[shift+1];
if (MABuffer[shift]-MABuffer[shift+1] > Filter*Point) trend[shift]= 1;
if (MABuffer[shift+1]-MABuffer[shift] > Filter*Point) trend[shift]=-1;
if (trend[shift]>0)
{
UpBuffer[shift] = 1;
DnBuffer[shift] = EMPTY_VALUE;
}
if (trend[shift]<0)
{
DnBuffer[shift] = 1;
UpBuffer[shift] = EMPTY_VALUE;
}
}
manageAlerts();
return(0);
}
//
//
//
//
//
for(i = limit; i >=0; i--)
{
int y = iBarShift(NULL,timeFrame,Time);
UpBuffer = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",Price,Length,Displace,Filter,Deviation,0,y);
DnBuffer = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",Price,Length,Displace,Filter,Deviation,1,y);
trend = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",Price,Length,Displace,Filter,Deviation,4,y);
}
manageAlerts();
return(0);
}
//+-------------------------------------------------------------------
//|
//+-------------------------------------------------------------------
//
//
//
//
//
string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"};
int iTfTable[] = {1,5,15,30,60,240,1440,10080,43200};
int stringToTimeFrame(string tfs)
{
tfs = stringUpperCase(tfs);
for (int i=ArraySize(iTfTable)-1; i>=0; i--)
if (tfs==sTfTable || tfs==""+iTfTable) return(MathMax(iTfTable,Period()));
return(Period());
}
string timeFrameToString(int tf)
{
for (int i=ArraySize(iTfTable)-1; i>=0; i--)
if (tf==iTfTable) return(sTfTable);
return("");
}
//
//
//
//
//
string stringUpperCase(string str)
{
string s = str;
for (int length=StringLen(str)-1; length>=0; length--)
{
int tchar = StringGetChar(s, length);
if((tchar > 96 && tchar 223 && tchar < 256))
s = StringSetChar(s, length, tchar - 32);
else if(tchar > -33 && tchar < 0)
s = StringSetChar(s, length, tchar + 224);
}
return(s);
}
//
//
//
//
//
void manageAlerts()
{
if (!calculateValue && alertsOn)
{
if (alertsOnCurrent)
int whichBar = 0;
else whichBar = 1; whichBar = iBarShift(NULL,0,iTime(NULL,timeFrame,whichBar));
if (trend[whichBar] != trend[whichBar+1])
{
if (trend[whichBar] == 1) doAlert(whichBar,"buy");
if (trend[whichBar] == -1) doAlert(whichBar,"sell");
}
}
}
//
//
//
//
//
void doAlert(int forBar, string doWhat)
{
static string previousAlert="nothing";
static datetime previousTime;
string message;
if (previousAlert != doWhat || previousTime != Time[forBar]) {
previousAlert = doWhat;
previousTime = Time[forBar];
//
//
//
//
//
message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," - ",timeFrameToString(timeFrame)+" NonLagMa slope ",doWhat);
if (alertsMessage) Alert(message);
if (alertsEmail) SendMail(StringConcatenate(Symbol()," XXX "),message);
if (alertsSound) PlaySound("alert2.wav");
}
}이미 올바르게 코딩된 비 지연 질량을 단순히 사용하지 않는 이유는 무엇입니까? t 변수 값에는 적절한 값이 할당되지 않습니다. 나머지 dU는 확인 하지 않았습니다. 그것만으로도 모든 것이 제대로 계산되지 않을 수 있기 때문입니다.
훌륭한! 감사 합니다
행복한 거래![](https://c.mql5.com/forextsd/smiles/smile.png)
이미 올바르게 코딩된 비 지연 질량을 단순히 사용하지 않는 이유는 무엇입니까? t 변수 값에는 적절한 값이 할당되지 않습니다. 나머지 dU는 확인하지 않았습니다. 그것만으로도 모든 것이 제대로 계산되지 않을 수 있기 때문입니다.
당신은 내 "푸시 smartfon"을 도와줍니다.
당신은 내 "푸시 smartfon"을 도와줍니다.
나머지(MetQuotesID 및 나머지)가 모두 정상적으로 설정되었으면 SendNotificaton()만 있으면 작동하며 작동해야 합니다.