Re: MT4 Indicators with alerts/signals

2493
acinmavi wrote: Fri Oct 11, 2019 4:45 am Hi mrtools, Hi mntiwana,
I wonder you could provide an script or ea could alert (if have notifcation and email also are awesome) when EMA 200 cross EMA 50 ? If possible could you make it to scan multi-timeframe and multi-symbol ?
Thanks.
If you're looking for a Moving Average Cross alerts indicator, have a look at this one: MA Cross Alerts indicator :)
These users thanked the author ChuChu Rocket for the post:
acinmavi
Important: The worst forex brokers of all time 👎

Re: MT4 Indicators with alerts/signals

2495
moey_dw wrote: Fri Oct 11, 2019 5:36 pm HOW WE DO USE THIS MOMENTUM SCALPER??? LOOKS GOOD BUT DUNNO ALL THE COLORS :oops:
Why are you yelling bro?

How to use Momentum Scalper for MT4


The height and colour of the bars tells us the strength of the scalping trend.

  • Red bars represent market moves to the downside.
  • Blue bars represent market moves to the upside.
  • Grey bars represent ranging (quiet) markets.
  • White bars represent the market running out of steam.
  • Orange bars represent retracement is due.

Chart background colors

  • Green chart background means the overall trend is UP (Look for entries to the upside).
    • Pink chart background means the overall trend is DOWN (look for entries to the downside).

    The colour of the bars will change despite the market trend shown by the chart background colour. So for instance, a red bar can appear whilst the chart background is green which indicates a short-term downtrend (or pullback) within a general uptrend.

    Just like the CCI, the -100 and 100 areas are considered Oversold/Overbought.

    PS: Link to the Momentum Scalper for MT4 updated by Mrtools, Momentum Scalper.
    These users thanked the author Jimmy for the post (total 5):
    moey_dw, rijay, pandpand, 太虚一毫, Jedidiah
    Are you looking for a Forex broker? FBS cuts spreads by up to 58%. Click here to begin your trading journey, today.
    No commissions are earned by Forex-station.


    Guide to the "All Averages" Filters (ADXvma, Laguerre etc.) 🆕
    Use Fibonacci numbers for indicator settings + How to draw Fibonacci Extensions
    An easy trick for drawing Support & Resistance


    Re: MT4 Indicators with alerts/signals

    2496
    Wonderful work you guys are doing....so i have been playing with the idea of using moving averages from multiple time frames - when they crossover as a potential signal using the (averages - mtf - alert 8.8) indicator. What i would like to know is would it be possible to create an indicator that give an alert when these crossovers occur rather that have to constantly be checking my chart to see if it happened. As you can see on the chart the 1h triangular MA has crossed the 4h triangular MA a few time providing potential opportunities for a trade. There is also a possibility to see potential trend continuation when price action bounces of the higher time frame MA. Of course these would only be potential trade opportunities as you would still need to check for other confluence.
    Mtf moving average crossover.png

    CodeRe: MT4 Indicators with alerts/signals

    2499
    I don't know if this is possible but I am looking to make the slow line wider. mt4 only goes up to a line width of 5. would it be possible to make a line wider in the code than mt4s maximum line width? I was also thinking of maybe having the line widen by standard deviation. I think that might be overkill though. The SD would have to have upper and lower bounds so the fast line would break free from the band. Im trying to understand the code. It looks as though it is using a mean of two fast and two slow EMAs to produce a trigger. Is that correct? The reasoning behind the thick line is to filter out false breakouts. I want to see if anything above a 5 width will help filter out the breakouts. Like the trigger line of TDFI. But maybe even make it form fitting to the ATR? I might be over thinking it with that.

    Code: Select all

    //------------------------------------------------------------------
    #property link      "www.forex-station.com"
    #property copyright "www.forex-station.com"
    //------------------------------------------------------------------
    #property indicator_separate_window
    #property indicator_buffers 2
    #property indicator_color1  clrLimeGreen
    #property indicator_color2  clrPaleVioletRed
    #property indicator_width1  2
    #property indicator_style2  STYLE_DOT
    #property strict
    
    //
    //
    //
    //
    //
    extern ENUM_TIMEFRAMES   TimeFrame             = PERIOD_CURRENT;    // Time frame to use
    input int                r                     = 2;                 // First ema period
    input int                s                     = 10;                // Second ema period
    input int                u                     = 5;                 // Third ema period
    input int                trigger               = 3;                 // Signal ema period
    input ENUM_APPLIED_PRICE Price                 = PRICE_CLOSE;       // Price to use
    input bool               alertsOn              = true;              // Alerts on true/false?
    input bool               alertsOnCurrent       = false;             // Alerts on open bar true/false?
    input bool               alertsMessage         = true;              // Alerts popup message true/false?
    input bool               alertsSound           = false;             // Alerts sound true/false?
    input bool               alertsEmail           = false;             // Alerts email true/false?
    input bool               alertsPushNotif       = false;             // Alerts notification true/false?
    input bool               arrowsVisible         = false;             // Arrows visible true/false?
    input bool               arrowsOnNewest        = false;             // Arrows drawn on newest bar of higher time frame bar true/false?
    input string             arrowsIdentifier      = "erg Arrows1";     // Unique ID for arrows
    input double             arrowsUpperGap        = 0.1;               // Upper arrow gap
    input double             arrowsLowerGap        = 0.1;               // Lower arrow gap
    input color              arrowsUpColor         = clrBlue;           // Up arrow color
    input color              arrowsDnColor         = clrCrimson;        // Down arrow color
    input int                arrowsUpCode          = 116;               // Up arrow code
    input int                arrowsDnCode          = 116;               // Down arrow code
    input int                arrowsUpSize          = 2;                 // Up arrow size
    input int                arrowsDnSize          = 2;                 // Down arrow size
    input bool               Interpolate           = true;              // Interpolate true/false?
    
    double tsi[],sig[],trend[],count[];
    string indicatorFileName;
    #define _mtfCall(_buff,_ind) iCustom(NULL,TimeFrame,indicatorFileName,PERIOD_CURRENT,r,s,u,trigger,Price,alertsOn,alertsOnCurrent,alertsMessage,alertsSound,alertsEmail,alertsPushNotif,arrowsVisible,arrowsOnNewest,arrowsIdentifier,arrowsUpperGap,arrowsLowerGap,arrowsUpColor,arrowsDnColor,arrowsUpCode,arrowsDnCode,arrowsUpSize,arrowsDnSize,_buff,_ind)
    
    //------------------------------------------------------------------
    //
    //------------------------------------------------------------------
    //
    //
    //
    //
    //
    
    int OnInit()
    {
       IndicatorBuffers(4);
       SetIndexBuffer(0,tsi,INDICATOR_DATA); SetIndexStyle(0, DRAW_LINE);
       SetIndexBuffer(1,sig,INDICATOR_DATA); SetIndexStyle(1, DRAW_LINE);
       SetIndexBuffer(2,trend,INDICATOR_CALCULATIONS);
       SetIndexBuffer(3,count,INDICATOR_CALCULATIONS);
       
       indicatorFileName = WindowExpertName();
       TimeFrame         = fmax(TimeFrame,_Period);
       
       IndicatorShortName(timeFrameToString(TimeFrame)+" BH ergodic ("+ (string)r +","+ (string)s +","+ (string)u +") Trigger"+ (string)trigger +")");
    return(INIT_SUCCEEDED);
    }
    void OnDeinit(const int reason)
    { 
        string lookFor       = arrowsIdentifier+":";
        int    lookForLength = StringLen(lookFor);
        for (int i=ObjectsTotal()-1; i>=0; i--)
        {
           string objectName = ObjectName(i);
           if (StringSubstr(objectName,0,lookForLength) == lookFor) ObjectDelete(objectName);
        }
    }
    
    //------------------------------------------------------------------
    //
    //------------------------------------------------------------------
    //
    //
    //
    //
    //
    
       int OnCalculate(const int rates_total,const int prev_calculated,const datetime &time[],
                       const double &open[],
                       const double &high[],
                       const double &low[],
                       const double &close[],
                       const long &tick_volume[],
                       const long &volume[],
                       const int &spread[])
    {
      
       int i,counted_bars = prev_calculated;
          if(counted_bars < 0) return(-1);
          if(counted_bars > 0) counted_bars--;
                int limit=fmin(rates_total-counted_bars,rates_total-2); count[0] = limit;
                if (TimeFrame!=_Period)
                {
                   limit = (int)fmax(limit,fmin(rates_total-1,_mtfCall(3,0)*TimeFrame/Period()));
                   for (i=limit; i>=0; i--)
                   {
                      int y = iBarShift(NULL,TimeFrame,Time[i]);
                         tsi[i] = _mtfCall(0,y);
                         sig[i] = _mtfCall(1,y); 
                      
                         //
                         //
                         //
                         //
                         //
                      
                         if (!Interpolate || (i>0 && y==iBarShift(NULL,TimeFrame,Time[i-1]))) continue;
                          #define _interpolate(buff) buff[i+k] = buff[i]+(buff[i+n]-buff[i])*k/n
                          int n,k; datetime btime = iTime(NULL,TimeFrame,y);
                             for(n = 1; (i+n)<rates_total && Time[i+n] >= btime; n++) continue;	
                             for(k = 1; k<n && (i+n)<rates_total && (i+k)<rates_total; k++)
                             {
                               _interpolate(tsi);
                               _interpolate(sig);
                             }
                  }          
       return(rates_total);
       } 
                  
       //
       //
       //
       //
       //
    
       for(i=limit; i>= 0; i--)
       {
          double priceDiff=0;
          if (i<rates_total-1) priceDiff = iMA(NULL,0,1,0,MODE_EMA,Price,i)-iMA(NULL,0,1,0,MODE_EMA,Price,i+1);
          double avg = iEma(iEma(iEma(     priceDiff ,r,i,rates_total,0),s,i,rates_total,1),u,i,rates_total,2);
          double ava = iEma(iEma(iEma(fabs(priceDiff),r,i,rates_total,3),s,i,rates_total,4),u,i,rates_total,5);
          tsi[i] = (ava != 0) ? 100.0*avg/ava : 0;
          sig[i] = iEma(tsi[i],trigger,i,rates_total,6);
          trend[i] = (i<rates_total-1) ? (tsi[i]>sig[i]) ? 1 : (tsi[i]<sig[i]) ? -1 : trend[i+1] : 0; 
          
          //
          //
          //
          //
          //
          
          if (arrowsVisible)
          {
             string lookFor = arrowsIdentifier+":"+(string)Time[i]; ObjectDelete(lookFor);            
             if (i<(rates_total-1) && trend[i] != trend[i+1])
             {
                if (trend[i] == 1) drawArrow(i,arrowsUpColor,arrowsUpCode,arrowsUpSize,false);
                if (trend[i] ==-1) drawArrow(i,arrowsDnColor,arrowsDnCode,arrowsDnSize, true);
             }
          }  
       }
       
       //
       //
       //
       //
       //
          
       if (alertsOn)
       {
          int whichBar = 1; if (alertsOnCurrent) whichBar = 0;
          if (trend[whichBar] != trend[whichBar+1])
          if (trend[whichBar] == 1)
                doAlert("crossing signal up");
          else  doAlert("crossing signal down");       
       }  
    return(rates_total);
    }
    
    //------------------------------------------------------------------
    //
    //------------------------------------------------------------------
    //
    //
    //
    //
    //
    
    double workEma[][7];
    double iEma(double price, double period, int i, int bars, int instanceNo=0)
    {
       if (ArrayRange(workEma,0)!= bars) ArrayResize(workEma,bars); i = bars-i-1;
    
       //
       //
       //
       //
       //
          
       double alpha = 2.0 / (1.0+period);
              workEma[i][instanceNo] = workEma[i-1][instanceNo]+alpha*(price-workEma[i-1][instanceNo]);
       return(workEma[i][instanceNo]);
    }
    
    //-------------------------------------------------------------------
    //                                                                  
    //-------------------------------------------------------------------
    //
    //
    //
    //
    //
    
    string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"};
    int    iTfTable[] = {1,5,15,30,60,240,1440,10080,43200};
    
    string timeFrameToString(int tf)
    {
       for (int i=ArraySize(iTfTable)-1; i>=0; i--) 
             if (tf==iTfTable[i]) return(sTfTable[i]);
                                  return("");
    }
    
    //------------------------------------------------------------------
    //                                                                  
    //------------------------------------------------------------------
    //
    //
    //
    //
    //
    
    void doAlert(string doWhat)
    {
       static string   previousAlert="nothing";
       static datetime previousTime;
       string message;
       
          if (previousAlert != doWhat || previousTime != Time[0]) {
              previousAlert  = doWhat;
              previousTime   = Time[0];
    
              //
              //
              //
              //
              //
    
              message = timeFrameToString(_Period)+" "+_Symbol+" at "+TimeToStr(TimeLocal(),TIME_SECONDS)+" BH - ergodic "+doWhat;
                 if (alertsMessage)   Alert(message);
                 if (alertsPushNotif) SendNotification(message);
                 if (alertsEmail)     SendMail(_Symbol+" BH - ergodic ",message);
                 if (alertsSound)     PlaySound("alert2.wav");
          }
    }
    
    
    //-------------------------------------------------------------------
    //                                                                  
    //-------------------------------------------------------------------
    //
    //
    //
    //
    //
    
    void drawArrow(int i,color theColor,int theCode, int theSize, bool up)
    {
       string name = arrowsIdentifier+":"+(string)Time[i];
       double gap  = iATR(NULL,0,20,i);   
       
          //
          //
          //
          //
          //
    
          datetime atime = Time[i]; if (arrowsOnNewest) atime += _Period*60-1;      
          ObjectCreate(name,OBJ_ARROW,0,atime,0);
             ObjectSet(name,OBJPROP_ARROWCODE,theCode);
             ObjectSet(name,OBJPROP_COLOR,theColor);
             ObjectSet(name,OBJPROP_WIDTH,theSize);
             if (up)
                   ObjectSet(name,OBJPROP_PRICE1,High[i] + arrowsUpperGap * gap);
             else  ObjectSet(name,OBJPROP_PRICE1,Low[i]  - arrowsLowerGap * gap);
    }
    
    

    Re: MT4 Indicators with alerts/signals

    2500
    nickbyniel1541 wrote: Fri Oct 11, 2019 5:43 pm Wonderful work you guys are doing....so i have been playing with the idea of using moving averages from multiple time frames - when they crossover as a potential signal using the (averages - mtf - alert 8.8) indicator. What i would like to know is would it be possible to create an indicator that give an alert when these crossovers occur rather that have to constantly be checking my chart to see if it happened. As you can see on the chart the 1h triangular MA has crossed the 4h triangular MA a few time providing potential opportunities for a trade. There is also a possibility to see potential trend continuation when price action bounces of the higher time frame MA. Of course these would only be potential trade opportunities as you would still need to check for other confluence.
    Mtf moving average crossover.png
    Have you seen this version? viewtopic.php?p=1295351863#p1295351863


    Who is online

    Users browsing this forum: Facebook [Crawler], Krunal Gajjar, Majestic-12 [Bot], NotInPortland, PaperLi [Bot], Samoth, Telegram [Bot] and 88 guests