Hozzászólások
-
SzerzőBejegyzés
-
Hozzászólás: BringToTop #4102
Szia Radu !
Időközben nekem is elkezdett működni ebben a formában igaz nem értem a ResetLastError();-tol mi változott,de hát én még nem régóta foglalkozom ezzel:void DoAlerts(string msgText, string eMailSub)
{
if (MsgAlerts) Alert(msgText);
if (eMailAlerts) SendMail(eMailSub, msgText);ResetLastError();
long chartID=ChartID();ChartSetInteger(chartID,ChartBringToTop() , true);
————————————————————————————————-
a DoAlerts lefut és felugrik az Alerts ablak is az eddig is lefutott.Köszönöm a segítséget.
Üdv Mozes
Hozzászólás: BringToTop #4097Átküldöm a teljes kódot.
Ez az IchimokuAlert.Nem én csináltam csak itt ott beleírtam ,hogy magyarul kommunikáljon,és szabványosan írja ki az idősíkokat.
Nem rég kezdtem ezt a nyelvet tanulni,igy nem teljesen látom át a teljes struktúrátÜdv Mozes
//+------------------------------------------------------------------+ //| IchimokuAlert_v2.mq4 | //| Copyright © 2006, Forex-TSD.com | //| Written by IgorAD,igorad2003@yahoo.co.uk | //| Adapted and improved by Snowski © 2009 | //+------------------------------------------------------------------+ #property copyright "*** " #property link "http://www.forex-tsd.com/" #include <Chart.mqh> #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 Red #property indicator_color2 Blue #property indicator_color3 SandyBrown #property indicator_color4 Thistle #property indicator_color5 Violet #property indicator_color6 SandyBrown #property indicator_color7 Thistle #property indicator_color8 Crimson //---- input parameters extern int MA100 =100; extern int Tenkan = 9; extern int Kijun = 26; extern int Senkou = 52; extern bool UseAlerts = true; extern bool MsgAlerts = true; extern bool SoundAlerts = true; extern bool eMailAlerts = false; extern int AlertType = 3; extern string Alert_Setting = "--- Alert Type:---"; extern string A_S0 = "0 = no alert"; extern string A_S1 = "1 = Tenkan crosses Kjiun"; extern string A_S2 = "2 = Chikou crosses Price:"; extern string A_S3 = "3 = both"; extern bool Show_Tenkan = true; extern bool Show_Kijun = true; extern bool Show_Senkou = true; extern bool Show_Kumo = true; extern bool Show_MA100 = true; //---- buffers double MA100_Buffer[]; double Tenkan_Buffer[]; double Kijun_Buffer[]; double SpanA_Buffer[]; double SpanB_Buffer[]; double Chikou_Buffer[]; double SpanA2_Buffer[]; double SpanB2_Buffer[]; //--------------------- int a_begin; bool UptrendAlert1,DntrendAlert1,UptrendAlert2,DntrendAlert2,UptrendAlert3,DntrendAlert3,BringToTop; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- if(Show_MA100==true){ // SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); // SetIndexBuffer(0,MA100_Buffer); // SetIndexDrawBegin(0,MA100-1); // SetIndexLabel(0,"MA100"); } //---- if(Show_Tenkan==true){ SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(0,Tenkan_Buffer); SetIndexDrawBegin(0,Tenkan-1); SetIndexLabel(0,"Tenkan Sen"); } //---- if(Show_Kijun==true){ SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(1,Kijun_Buffer); SetIndexDrawBegin(1,Kijun-1); SetIndexLabel(1,"Kijun Sen"); } //---- if(Show_Kumo==true){ a_begin=Kijun; if(a_begin<Tenkan) a_begin=Tenkan; SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_DOT); SetIndexBuffer(2,SpanA_Buffer); SetIndexDrawBegin(2,Kijun+a_begin-1); SetIndexShift(2,Kijun); SetIndexLabel(2,NULL); SetIndexStyle(5,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(5,SpanA2_Buffer); SetIndexDrawBegin(5,Kijun+a_begin-1); SetIndexShift(5,Kijun); SetIndexLabel(5,"Senkou Span A"); } //---- if(Show_Kumo==true){ SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_DOT); SetIndexBuffer(3,SpanB_Buffer); SetIndexDrawBegin(3,Kijun+Senkou-1); SetIndexShift(3,Kijun); SetIndexLabel(3,NULL); SetIndexStyle(6,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(6,SpanB2_Buffer); SetIndexDrawBegin(6,Kijun+Senkou-1); SetIndexShift(6,Kijun); SetIndexLabel(6,"Senkou Span B"); } //---- if(Show_Senkou==true){ SetIndexStyle(4,DRAW_LINE); SetIndexBuffer(4,Chikou_Buffer); SetIndexShift(4,-Kijun); SetIndexLabel(4,"Chikou Span"); } //---- return(0); } //+------------------------------------------------------------------+ //| Ichimoku Kinko Hyo | //+------------------------------------------------------------------+ int start() { int i,k; int counted_bars=IndicatorCounted(); double high,low,price; //---- if(Bars<=Tenkan || Bars<=Kijun || Bars<=Senkou) return(0); //---- initial zero if(counted_bars<1) { for(i=1;i<=Tenkan;i++) Tenkan_Buffer[Bars-i]=0; for(i=1;i<=Kijun;i++) Kijun_Buffer[Bars-i]=0; for(i=1;i<=a_begin;i++) { SpanA_Buffer[Bars-i]=0; SpanA2_Buffer[Bars-i]=0; } for(i=1;i<=Senkou;i++) { SpanB_Buffer[Bars-i]=0; SpanB2_Buffer[Bars-i]=0; } } //---- Tenkan Sen i=Bars-Tenkan; if(counted_bars>Tenkan) i=Bars-counted_bars-1; while(i>=0) { high=High[i]; low=Low[i]; k=i-1+Tenkan; while(k>=i) { price=High[k]; if(high<price) high=price; price=Low[k]; if(low>price) low=price; k--; } Tenkan_Buffer[i]=(high+low)/2; i--; } //---- Kijun Sen i=Bars-Kijun; if(counted_bars>Kijun) i=Bars-counted_bars-1; while(i>=0) { high=High[i]; low=Low[i]; k=i-1+Kijun; while(k>=i) { price=High[k]; if(high<price) high=price; price=Low[k]; if(low>price) low=price; k--; } Kijun_Buffer[i]=(high+low)/2; i--; } //---- Senkou Span A i=Bars-a_begin+1; if(counted_bars>a_begin-1) i=Bars-counted_bars-1; while(i>=0) { price=(Kijun_Buffer[i]+Tenkan_Buffer[i])/2; SpanA_Buffer[i]=price; SpanA2_Buffer[i]=price; i--; } //---- Senkou Span B i=Bars-Senkou; if(counted_bars>Senkou) i=Bars-counted_bars-1; while(i>=0) { high=High[i]; low=Low[i]; k=i-1+Senkou; while(k>=i) { price=High[k]; if(high<price) high=price; price=Low[k]; if(low>price) low=price; k--; } price=(high+low)/2; SpanB_Buffer[i]=price; SpanB2_Buffer[i]=price; i--; } //---- Chikou Span i=Bars-1; if(counted_bars>1) i=Bars-counted_bars-1; while(i>=0) { Chikou_Buffer[i]=Close[i]; i--; } //---- string Msg,Subj,Idosik; if (Period() ==1){Idosik = " ID.SÍK: M1 ";} if (Period() ==5){Idosik = " ID.SÍK: M5 ";} if (Period() ==15){Idosik = " ID.SÍK: M15 ";} if (Period() ==30){Idosik = " ID.SÍK: M30 ";} if (Period() ==60){Idosik = " ID.SÍK: H1 ";} if (Period() ==240){Idosik = " ID.SÍK: H4 ";} if (Period() ==1440){Idosik = " ID.SÍK: D1 ";} if (Period() ==10080){Idosik = " ID.SÍK: W1 ";} if (Period() >100801){Idosik = " ID.SÍK: MN ";} if (AlertType == 1 || AlertType == 3) { if (Tenkan_Buffer[1]>Kijun_Buffer[1] && Tenkan_Buffer[2]<Kijun_Buffer[2] && !UptrendAlert1) { Subj = Symbol()+Idosik+" Tenkan_9 crosses Kijun_26 "; Msg = "VÉTEL - : "+Subj+ " ZÁR:"+DoubleToStr(Close[1],Digits) + ", IDŐ:" + TimeToStr(TimeLocal(),TIME_SECONDS); UptrendAlert1 = true; DntrendAlert1 = false; DoAlerts(Msg,Subj); } if ( Tenkan_Buffer[1]<Kijun_Buffer[1] && Tenkan_Buffer[2]>Kijun_Buffer[2] && !DntrendAlert1) { Subj = Symbol()+Idosik+" Tenkan_9 crosses Kijun_26 "; Msg = "ELADÁS- : "+Subj+ " ZÁR:"+DoubleToStr(Close[1],Digits) + ", IDŐ:" + TimeToStr(TimeLocal(),TIME_SECONDS); UptrendAlert1 = false; DntrendAlert1 = true; DoAlerts(Msg,Subj); } } if (AlertType == 2 || AlertType == 3) { if (Close[1]>Close[1+Kijun] && Close[2]<Close[2+Kijun] && !UptrendAlert2) { Subj = "Viszatolt Árf.Görbe crosses Ár: "+Symbol()+" ID.SÍK: M"+Period(); Msg = "VÉTELI JELZÉS --- : "+Subj+ " , ZÁR:"+DoubleToStr(Close[1],Digits) + ", IDŐ" + TimeToStr((TimeLocal()+1),TIME_SECONDS); DntrendAlert2 = false; UptrendAlert2 = true; //DoAlerts(Msg,Subj); } if (Close[1]<Close[1+Kijun] && Close[2]>Close[2+Kijun] && !DntrendAlert2) { Subj = "Viszatolt Árf.Görbe crosses Ár: "+Symbol()+" ID.SÍK: M"+Period(); Msg = "ELADÁS- : "+Subj+ " , ZÁR:"+DoubleToStr(Close[1],Digits) + ", IDŐ:" + TimeToStr((TimeLocal()+1),TIME_SECONDS); DntrendAlert2 = true; UptrendAlert2 = false; // DoAlerts(Msg,Subj); } } if (AlertType == 2 || AlertType == 3) { if ((Close[1]>SpanA_Buffer[1+Kijun] && Low[1]<SpanA_Buffer[1+Kijun] && SpanA_Buffer[1+Kijun]>SpanB_Buffer[1+Kijun] && !UptrendAlert3) || (Close[1]>SpanB_Buffer[1+Kijun] && Low[1]<SpanB_Buffer[1+Kijun] && SpanB_Buffer[1+Kijun]>SpanA_Buffer[1+Kijun] && !UptrendAlert3)) { Subj = Symbol()+Idosik+" FELHŐ KITÖRÉS "; Msg = "VÉTEL- : "+Subj+ " ZÁR:"+DoubleToStr(Close[1],Digits) + ", IDŐ:" + TimeToStr(TimeLocal(),TIME_SECONDS); DntrendAlert3 = false; UptrendAlert3 = true; DoAlerts(Msg,Subj); } if ((Close[1]<SpanA_Buffer[1+Kijun] && High[1]>SpanA_Buffer[1+Kijun] && SpanA_Buffer[1+Kijun]<SpanB_Buffer[1+Kijun] && !DntrendAlert3) || (Close[1]<SpanB_Buffer[1+Kijun] && High[1]>SpanB_Buffer[1+Kijun] && SpanB_Buffer[1+Kijun]<SpanA_Buffer[1+Kijun] && !DntrendAlert3)) { Subj = Symbol()+Idosik+" FELHŐ KITÖRÉS "; Msg = "ELADÁS- : "+Subj+ " ZÁR:"+DoubleToStr(Close[1],Digits) + ", IDŐ:" + TimeToStr(TimeLocal(),TIME_SECONDS); DntrendAlert3 = true; UptrendAlert3 = false; DoAlerts(Msg,Subj); } } return(0); } void DoAlerts(string msgText, string eMailSub) { if (MsgAlerts) Alert(msgText); if (eMailAlerts) SendMail(eMailSub, msgText); long chartID=ChartID();ChartSetInteger(chartID, CHART_BRING_TO_TOP, true); } //+------------------------------------------------------------------+
Hozzászólás: BringToTop #4095Köszönöm Válaszod !
Igy csináltam meg de nem működik.
void DoAlerts(string msgText, string eMailSub)
{
if (MsgAlerts) Alert(msgText);
if (eMailAlerts) SendMail(eMailSub, msgText);long chartID=ChartID();ChartSetInteger(chartID, CHART_BRING_TO_TOP, true);
}
Próbáltam a start() fgv.belsejében is elhelyezni,úgy sem jóÜdv Mozes
-
SzerzőBejegyzés