Hi everyone, does this indicator repaint? (High-Low trend) Thanks for your answer in advance.
Re: MT4 Indicators with alerts/signals
2491Probability is Key!
Hi everyone, does this indicator repaint? (High-Low trend) Thanks for your answer in advance.
If you're looking for a Moving Average Cross alerts indicator, have a look at this one: MA Cross Alerts indicatoracinmavi 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.
Why are you yelling bro?moey_dw wrote: Fri Oct 11, 2019 5:36 pm HOW WE DO USE THIS MOMENTUM SCALPER??? LOOKS GOOD BUT DUNNO ALL THE COLORS![]()
thxxx jimba................. sorry just exciting!!!!Jimmy wrote: Fri Oct 11, 2019 5:40 pm
Why are you yelling bro?
How to use Momentum Scalper's colors:
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);
}
Have you seen this version? viewtopic.php?p=1295351863#p1295351863nickbyniel1541 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