Fixed Signal("Current Trend: UP"); as follows.
Signal(GetTimeFrameString(Period()) + " : " + StringSubstr(Symbol(), 0, 6) + " : Trend UP");
Add the following functions.
//+------------------------------------------------------------------+ string GetTimeFrameString(int timeFrame) { string TimeFrameStr; if (timeFrame == PERIOD_CURRENT) timeFrame = Period(); switch(timeFrame) { case PERIOD_M1 : TimeFrameStr = "M1"; break; case PERIOD_M5 : TimeFrameStr = "M5"; break; case PERIOD_M15 : TimeFrameStr = "M15"; break; case PERIOD_M30 : TimeFrameStr = "M30"; break; case PERIOD_H1 : TimeFrameStr = "H1"; break; case PERIOD_H4 : TimeFrameStr = "H4"; break; case PERIOD_D1 : TimeFrameStr = "D1"; break; case PERIOD_W1 : TimeFrameStr = "W1"; break; case PERIOD_MN1 : TimeFrameStr = "MN1"; break; } return(TimeFrameStr); } //+------------------------------------------------------------------+
Thanks Nagisa Unada. Its working. I did notice one issue. If use the notification on indice like the SPX500 or If add a crypto pair: BTC/USD. It will send an alert or issue a push notification to my phone. Thanks again for the help.
Here are the updated code:
#property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Yellow #property indicator_color2 Lime #property indicator_color3 OrangeRed #property indicator_color4 Chartreuse #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 extern int BarsHistory =10000; extern int PeriodCCI =50; extern int PeriodATR =5; extern bool alert = true; extern bool sendnotification = true; extern bool email = false; extern bool fractals =true; double Trend[]; double TrendUp[]; double TrendDown[]; double fr[]; double CCI,ATR,Bf; int tr=0; int tm; //+------------------------------------------------------------------+ int init(){ SetIndexBuffer(0,Trend); SetIndexBuffer(1,TrendUp); SetIndexBuffer(2,TrendDown); SetIndexBuffer(3,fr);SetIndexStyle(3,DRAW_ARROW);SetIndexArrow(3,108); } //+------------------------------------------------------------------+ void mail(string c){ if(IsTesting()==false&&IsOptimization()==false&&IsVisualMode()==false){ SendMail(WindowExpertName(),c);}} //+------------------------------------------------------------------+ void Signal(string c){ if(IsTesting()==false&&IsOptimization()==false&&IsVisualMode()==false){ if(alert)Alert("New signal "+c); if(sendnotification)SendNotification("New signal "+c); if(email)mail("New signal "+c);}} //+------------------------------------------------------------------+ void object(string Nm,string Tx,int Sz,string Shr,color Col,int Y,int X,int W) { ObjectCreate(Nm,OBJ_LABEL,0,0,0); //ñîçäàåì îáúåêò ObjectSetText(Nm,Tx,Sz,Shr,Col); //óêàçûâàåì ÷òî ýòî òåêñòîâûé è ââîäèì ïàðàìåòðû ObjectSet(Nm,OBJPROP_YDISTANCE,Y); //óñòàíàâëèâàåì Y -êîîðäèíàòó ObjectSet(Nm,OBJPROP_XDISTANCE,X); //óñòàíàâëèâàåì X -êîîðäèíàòó ObjectSet(Nm,OBJPROP_CORNER,W); //óñòàíàâëèâàåì óãîë ïðèâÿçêè if(Shr!="Arial")ObjectSet(Nm,OBJPROP_BACK,true); //óñòàíàâëèâàåì ôîí èëè îáû÷íûé îáúåêò } //+------------------------------------------------------------------+ int start() { object("Time",TimeToStr(TimeCurrent()),9,"Arial",White ,20,20,1); if(TimeCurrent()<tm+5)return(0);tm=TimeCurrent(); //static int time;if(iTime(NULL,0,0)==time)return(0);time=iTime(NULL,0,0); //+---------- for(int i=BarsHistory+MathMax(PeriodCCI,PeriodATR)*2;i>0;i--) { CCI=iCCI(NULL,0,PeriodCCI,PRICE_TYPICAL,i); ATR=iATR(NULL,0,PeriodATR,i); //+---------- if(CCI>0&&Low[i]-ATR>Bf)Bf=Low[i]-ATR; if(CCI<0&&High[i]+ATR<Bf)Bf=High[i]+ATR; if(fractals&&iFractals(NULL,0,1,i)>0)fr[i]=iFractals(NULL,0,1,i); if(fractals&&iFractals(NULL,0,2,i)>0)fr[i]=iFractals(NULL,0,2,i); //+---------- if(i<BarsHistory){ Trend[i]=Bf; if(CCI>0){TrendUp[i]=Bf;} if(CCI<0){TrendDown[i]=Bf;} }} if(TrendUp[1]<1000)if(tr==2||tr==0){tr=1;Signal(GetTimeFrameString(Period()) + " : " + StringSubstr(Symbol(), 0, 6) + " : Trend UP");ObjectDelete("Trend");object("Trend","Current Trend: UP",9,"Arial",LawnGreen ,40,20,1);} if(TrendDown[1]<1000)if(tr==1||tr==0){tr=2;Signal(GetTimeFrameString(Period()) + " : " + StringSubstr(Symbol(), 0, 6) + " : Trend DW");ObjectDelete("Trend");object("Trend","Current Trend: DW",9,"Arial",OrangeRed ,40,20,1);} } //+------------------------------------------------------------------+ string GetTimeFrameString(int timeFrame) { string TimeFrameStr; if (timeFrame == PERIOD_CURRENT) timeFrame = Period(); switch(timeFrame) { case PERIOD_M1 : TimeFrameStr = "M1"; break; case PERIOD_M5 : TimeFrameStr = "M5"; break; case PERIOD_M15 : TimeFrameStr = "M15"; break; case PERIOD_M30 : TimeFrameStr = "M30"; break; case PERIOD_H1 : TimeFrameStr = "H1"; break; case PERIOD_H4 : TimeFrameStr = "H4"; break; case PERIOD_D1 : TimeFrameStr = "D1"; break; case PERIOD_W1 : TimeFrameStr = "W1"; break; case PERIOD_MN1 : TimeFrameStr = "MN1"; break; } return(TimeFrameStr); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ void deinit(){ObjectDelete("Time");ObjectDelete("Trend");} //+------------------------------------------------------------------+
Simplified
Thanks. That make sence.
Hi Nagisa Unada. I made a typo in my last post. I meant to say...
If use the indicator on indice like the (SPX500) or a crypto pair: (BTC/USD). It will not send a desktop alert or mobile push alert.
Also I truly appreciate all the help. Do you have a cash app or a paypal link. I'd like to give you something for taking time out of your day to help me out. Thanks.
If use the indicator on indice like the (SPX500) or a crypto pair: (BTC/USD). It will not send a desktop alert or mobile push alert.
I don't accept that kind of request because the broker I use doesn't deal in the SPX500 or cryptocurrencies, so that I can't check the indicator that I made work or not.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Everyone.
I have been using an indicator lately that I really like. Essentially the indicator Tracks Price Action and Volume and notifies you of trend changes. The only problem that I have is with the alerts. When it alerts you of a trend it literally states: "New Signal Current Trend Up" or "New Signal Current Trend DW"
I would like to have like to have alerts in this format: Chart Hour : Currency Pair : Trend UP
IE. H1 : USD/CAD : Trend UP
If that's not possible at least: Currency Pair : Trend UP
I have been playing with the code. I was able to add push notifications to it. But passed that, Im stumped. I tried googling, but im at a standstill for the moment. I dont know much about coding. Any help would be greatly appreciated.
Here is the code.
If anyone can help me figure this out I'd really appreciate.