• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 10:34pm
  • Search
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 10:34pm
Search
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Search

Bookmark Thread

First Page First Unread Last Page Last Post

Printable Version

Similar Threads

Sweet, sweet Oil 678 replies

Sweet Spot Indicator 17 replies

Sweet spot indicator, lines disappearing - help 9 replies

Sweet Spot finder indicator 9 replies

Sweet spot trading 78 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 3
Attachments: add alerts to Sweet Spot Indicator
Exit Attachments

add alerts to Sweet Spot Indicator

  • Post #1
  • Quote
  • First Post: Nov 27, 2019 11:26am Nov 27, 2019 11:26am
  •  yamin2000
  • | Joined Apr 2018 | Status: Member | 15 Posts
hi
can any one add alerts to the SWEET SPOT INDICATOR ,if the price reach the sweet spot for specific amount i set .

Quote
Disliked
//+------------------------------------------------------------------+
//| SweetSpots.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
//| SweetSpotsGOLD_TRO_MODIFIED_VERSION |
//| MODIFIED BY AVERY T. HORTON, JR. AKA THERUMPLEDONE@GMAIL.COM |
//| I am NOT the ORIGINAL author
// and I am not claiming authorship of this indicator.
// All I did was modify it. I hope you find my modifications useful.|
//| |
//+------------------------------------------------------------------+

#property copyright "Copyright Shimodax"
#property link "http://www.strategybuilderfx.com"
#property indicator_chart_window
/* Introduction:
This indicator shows lines at sweet spots (50 and 100
pips levels). It is recommended to turn off the grid.

Enjoy!
Markus
*/
extern bool TURN_OFF = false ;
extern bool AutoAdjust = true;
extern bool Show_Labels = true ;
extern int ShiftLabel = 2 ;
extern int NumLinesAboveBelow = 100;
extern int SweetSpotMainLevels = 100;
extern color LineColorMain= Yellow;
extern int LineStyleMain= STYLE_DOT;
extern bool ShowSubLevels= true;
extern int sublevels= 10;
extern color LineColorSub= Yellow;
extern int LineStyleSub= STYLE_DOT;

string symbol, tChartPeriod, tShortName, pricelabel ;
int digits, period, digits2, mult = 1 ;
double point ;

//+------------------------------------------------------------------+
int init()
{
period = Period() ;
symbol = Symbol() ;
digits = Digits ;
point = Point ;

if(digits == 5 || digits == 3) { mult = 10; digits = digits - 1 ; point = point * 10 ; }

if(AutoAdjust && period > PERIOD_H1 && period < PERIOD_MN1) { mult = mult * 10; }
if(AutoAdjust && period == PERIOD_MN1) { mult = mult * 100; }

SweetSpotMainLevels = SweetSpotMainLevels * mult;

sublevels = sublevels * mult;

deinit();

return(0);
}
//+------------------------------------------------------------------+
int deinit()
{
int obj_total= ObjectsTotal();

for (int i= obj_total; i>=0; i--) {
string name= ObjectName(i);

if (StringSubstr(name,0,11)=="[SweetSpot]")
ObjectDelete(name);
}
TRO();
return(0);
}

//+------------------------------------------------------------------+
int start()
{
if( TURN_OFF ) { return(0) ; }
static datetime timelastupdate= 0;
static datetime lasttimeframe= 0;


// no need to update these buggers too often
if (CurTime()-timelastupdate < 600 && Period()==lasttimeframe)
return (0);

deinit(); // delete all previous lines

int i, ssp1, style, ssp, thickness; //sublevels= 50;
double ds1;
color linecolor;

if (!ShowSubLevels)
sublevels*= 2;

ssp1= Bid / Point;
ssp1= ssp1 - ssp1%sublevels;
for (i= -NumLinesAboveBelow; i<NumLinesAboveBelow; i++)
{

ssp= ssp1+(i*sublevels);

if (ssp%SweetSpotMainLevels==0)
{
style= LineStyleMain;
linecolor= LineColorMain;
}
else
{
style= LineStyleSub;
linecolor= LineColorSub;
}

thickness= 1;

if (ssp%(SweetSpotMainLevels*10)==0)
{
thickness= 2;
}
if (ssp%(SweetSpotMainLevels*100)==0)
{
thickness= 3;
}

ds1= ssp*Point;
SetLevel(DoubleToStr(ds1,Digits), ds1, linecolor, style, thickness, Time[10]);
}
return(0);
}

//+------------------------------------------------------------------+
//| Helper |
//+------------------------------------------------------------------+
void SetLevel(string text, double level, color col1, int linestyle, int thickness, datetime startofday)
{
string linename= "[SweetSpot] " + text + " Line" + pricelabel;
// create or move the horizontal line
if (ObjectFind(linename) != 0) {
ObjectCreate(linename, OBJ_TREND, 0, Time[0], level, Time[1], level, 0, 0);
// ObjectCreate(linename, OBJ_HLINE, 0, 0, level);

ObjectSet(linename, OBJPROP_STYLE, linestyle);
ObjectSet(linename, OBJPROP_COLOR, col1);
ObjectSet(linename, OBJPROP_WIDTH, thickness);
ObjectSet(linename, OBJPROP_RAY, true);
ObjectSet(linename, OBJPROP_BACK, True);
}
else {
ObjectMove(linename, 0, Time[0], level);
}

if(Show_Labels)
{


string Obj0002 = linename+"linelbl" ;

ObjectDelete(Obj0002);

if(ObjectFind(Obj0002) != 0)
{
ObjectCreate(Obj0002,OBJ_ARROW,0,Time[0],level);
ObjectSet(Obj0002,OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet(Obj0002,OBJPROP_COLOR,col1);
}
else
{
ObjectMove(Obj0002,0,Time[0],level);
}


} // if

}

//+------------------------------------------------------------------+
void TRO()
{

string tObjName03 = "TROTAG" ;
ObjectCreate(tObjName03, OBJ_LABEL, 0, 0, 0);//HiLow LABEL
ObjectSetText(tObjName03, CharToStr(78) , 12 , "Wingdings", DimGray );
ObjectSet(tObjName03, OBJPROP_CORNER, 3);
ObjectSet(tObjName03, OBJPROP_XDISTANCE, 5 );
ObjectSet(tObjName03, OBJPROP_YDISTANCE, 5 );
}
//+------------------------------------------------------------------+
Attached File
File Type: mq4 SweetSpotsGOLD_TRO_MODIFIED_VERSION.mq4   6 KB | 14 downloads
  • Post #2
  • Quote
  • Nov 27, 2019 4:21pm Nov 27, 2019 4:21pm
  •  honeggeral
  • | Joined Dec 2018 | Status: Member | 25 Posts | Online Now
Im not sure the purpose of this indicator, but ill try to help. Do you only want one alert per line? for instance if it touches a line drops down and touches it again? Also please give me an example of your inputs for the indicator
You get what you work work for, not wish for.
Money Machine Return This Month: -4.1%
  • Post #3
  • Quote
  • Nov 29, 2019 1:16pm Nov 29, 2019 1:16pm
  •  yamin2000
  • | Joined Apr 2018 | Status: Member | 15 Posts
Quoting honeggeral
Disliked
Im not sure the purpose of this indicator, but ill try to help. Do you only want one alert per line? for instance if it touches a line drops down and touches it again? Also please give me an example of your inputs for the indicator
Ignored
THANKS i found another indicator do the same job with alerts .but can you make the alerts ring once the price away from the horizontal by specific points which i set?


Quote
Disliked
//+------------------------------------------------------------------+
//| Mano Rounder.mq4 |
//| mladen |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link ""
#property indicator_chart_window
extern int OnChartOrder = 0;
extern int StepPips = 100;
extern int SubLevels = 1;
extern bool showZones = true;
extern bool showLines = true;
extern bool showPrices = true;
extern int pricesShift = -40;
extern color zoneColor = C'233,233,233';
extern color LevelColor = DimGray;
extern int LevelLineWidth = 1;
extern int LevelLineStyle = STYLE_SOLID;
extern color SubLevelColor = DimGray;
extern int SubLevelLineWidth = 1;
extern int SubLevelLineStyle = STYLE_DOT;
extern color pricesColor = DimGray;
//
//
//
//
//
extern int alertTolerance = 0;
extern bool alertsOn = true;
extern bool alertsOnCurrent = true;
extern bool alertsMessage = true;
extern bool alertsSound = false;
extern bool alertsEmail = false;
//
//
//
//
//
int Step;
int totalLevels = 0;
int totalPrices = 0;
double Prices[];
double SubLevelStep;
string ShortName;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int init()
{
ShortName = "ManoRounder"+OnChartOrder+"lines";
return(0);
}
int deinit()
{
ObjectsDeleteAll(0,"ManoRounder"+OnChartOrder+"lines");
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int start()
{
int l,counted_bars=IndicatorCounted();
datetime last;
datetime first;
double price;


if (totalLevels>0)
{
first = ObjectGet("ManoRounder1",OBJPROP_TIME1);
last = ObjectGet("ManoRounder1",OBJPROP_TIME2);
}
if (Digits==3 || Digits==5)
Step = StepPips*10;
else Step = StepPips;
if (SubLevels>0) SubLevelStep = Step/(SubLevels+1);

//
//
//
//
//

if (first != Time[Bars] || last != Time[0])
{
double lowPrice = Low[ iLowest (NULL,0,MODE_LOW ,0,0)];
double highPrice = High[iHighest(NULL,0,MODE_HIGH,0,0)];
double low;
double high;
double current;

//
//
//
//
//

low = MathFloor(lowPrice/(Step*Point))*Step*Point;
high = MathCeil(highPrice/(Step*Point))*Step*Point;
current = low;

//
//
//
//
//

string name;
while (totalLevels>0)
{
ObjectDelete(StringConcatenate(ShortName,totalLevels)); totalLevels--;
}
//
//
//
//
//


while(current<=high)
{
if (showZones)
{
totalLevels++; name = StringConcatenate(ShortName,totalLevels);
ObjectCreate(name,OBJ_RECTANGLE,0,Time[Bars-1],current,Time[0],current+(Step*Point));
ObjectSet(name,OBJPROP_COLOR,zoneColor);
ObjectSet(name,OBJPROP_BACK,true);
}

//
//
//
//
//

if (showLines)
{
totalLevels++; name = StringConcatenate(ShortName,totalLevels);
price = setPrice(current);
ObjectCreate(name,OBJ_TREND,0,Time[Bars-1],price,Time[0],price);
ObjectSet(name,OBJPROP_COLOR,LevelColor);
ObjectSet(name,OBJPROP_RAY,false);
ObjectSet(name,OBJPROP_BACK,true);
ObjectSet(name,OBJPROP_WIDTH,LevelLineWidth);
ObjectSet(name,OBJPROP_STYLE,LevelLineStyle);
totalLevels++; name = StringConcatenate(ShortName,totalLevels);
price = setPrice(current+(Step*Point));
ObjectCreate(name,OBJ_TREND,0,Time[Bars-1],price,Time[0],price);
ObjectSet(name,OBJPROP_COLOR,LevelColor);
ObjectSet(name,OBJPROP_RAY,false);
ObjectSet(name,OBJPROP_BACK,true);
ObjectSet(name,OBJPROP_WIDTH,LevelLineWidth);
ObjectSet(name,OBJPROP_STYLE,LevelLineStyle);
//
//
//
//
//

if (SubLevelStep != 0)
{
for (l=1; l<=SubLevels; l++)
{
totalLevels++; name = StringConcatenate(ShortName,totalLevels);
price = setPrice(current+(SubLevelStep*l*Point));
ObjectCreate(name,OBJ_TREND,0,Time[Bars-1],price,Time[0],price);
ObjectSet(name,OBJPROP_COLOR,SubLevelColor);
ObjectSet(name,OBJPROP_RAY,false);
ObjectSet(name,OBJPROP_BACK,true);
ObjectSet(name,OBJPROP_WIDTH,SubLevelLineWidth);
ObjectSet(name,OBJPROP_STYLE,SubLevelLineStyle);
}
for (l=1; l<=SubLevels; l++)
{
totalLevels++; name = StringConcatenate(ShortName,totalLevels);
price = setPrice(current+((SubLevelStep*l+Step)*Point));
ObjectCreate(name,OBJ_TREND,0,Time[Bars-1],price,Time[0],price);
ObjectSet(name,OBJPROP_COLOR,SubLevelColor);
ObjectSet(name,OBJPROP_RAY,false);
ObjectSet(name,OBJPROP_BACK,true);
ObjectSet(name,OBJPROP_WIDTH,SubLevelLineWidth);
ObjectSet(name,OBJPROP_STYLE,SubLevelLineStyle);
}
}
}
//
//
//
//
//

if (showPrices && (showLines || showZones))
{
totalLevels++; name = StringConcatenate(ShortName,totalLevels);
ObjectCreate(name,OBJ_TEXT,0,barTime(-pricesShift),current);
ObjectSet(name,OBJPROP_COLOR,pricesColor);
ObjectSet(name,OBJPROP_BACK,true);
ObjectSetText(name,DoubleToStr(current,Digits),7,"Arial",pricesColor);
totalLevels++; name = StringConcatenate(ShortName,totalLevels);
ObjectCreate(name,OBJ_TEXT,0,barTime(-pricesShift),current+(Step*Point));
ObjectSet(name,OBJPROP_COLOR,pricesColor);
ObjectSet(name,OBJPROP_BACK,true);
ObjectSetText(name,DoubleToStr(current+(Step*Point),Digits),7,"Arial",pricesColor);
//
//
//
//
//

if (SubLevelStep != 0)
{
for (l=1; l<=SubLevels; l++)
{
totalLevels++; name = StringConcatenate(ShortName,totalLevels);
ObjectCreate(name,OBJ_TEXT,0,barTime(-pricesShift),current+(SubLevelStep*l*Point));
ObjectSet(name,OBJPROP_COLOR,pricesColor);
ObjectSet(name,OBJPROP_BACK,true);
ObjectSetText(name,DoubleToStr(current+(SubLevelStep*l*Point),Digits),7,"Arial",pricesColor);
}
for (l=1; l<=SubLevels; l++)
{
totalLevels++; name = StringConcatenate(ShortName,totalLevels);
ObjectCreate(name,OBJ_TEXT,0,barTime(-pricesShift),current+((SubLevelStep*l+Step)*Point));
ObjectSet(name,OBJPROP_COLOR,pricesColor);
ObjectSet(name,OBJPROP_BACK,true);
ObjectSetText(name,DoubleToStr(current+((SubLevelStep*l+Step)*Point),Digits),7,"Arial",pricesColor);
}
}
}
current += (Step*2*Point);
}
}
//
//
//
//
//
if (alertsOn)
{
if (alertsOnCurrent)
l = 0;
else l = 1;
low = NormalizeDouble(Low[l] ,Digits);
high = NormalizeDouble(High[l],Digits);

//
//
//
//
//

for (l=0; l<totalPrices; l++)
{
if (MathAbs(NormalizeDouble((Prices[l]-low)/Point,0)) <= alertTolerance) { doAlert("Low touched "+DoubleToStr(Prices[l],Digits)+" line"); break; }
if (MathAbs(NormalizeDouble((Prices[l]-high)/Point,0)) <= alertTolerance) { doAlert("High touched "+DoubleToStr(Prices[l],Digits)+" line"); break; }
}
}
return(0);
}
//+------------------------------------------------------------------+
//|
//+------------------------------------------------------------------+
//
//
//
//
//
int barTime(int a)
{
if(a<0)
return(Time[0]+Period()*60*MathAbs(a));
else return(Time[a]);
}
double setPrice(double price)
{
totalPrices++; if (ArraySize(Prices) < totalPrices) ArrayResize(Prices,totalPrices);

//
//
//
//
//

double normalizedPrice = NormalizeDouble(price,Digits);
Prices[totalPrices-1] = normalizedPrice;
return(normalizedPrice);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
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 = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," mano rounder ",doWhat);
if (alertsMessage) Alert(message);
if (alertsEmail) SendMail(StringConcatenate(Symbol(),"mano rounder "),message);
if (alertsSound) PlaySound("alert2.wav");
}
}
  • Post #4
  • Quote
  • Dec 2, 2019 11:35pm Dec 2, 2019 11:35pm
  •  honeggeral
  • | Joined Dec 2018 | Status: Member | 25 Posts | Online Now
yeah i can do that, send me the indicator and a picture of an example of when the alert should be activated
You get what you work work for, not wish for.
Money Machine Return This Month: -4.1%
  • Post #5
  • Quote
  • Last Post: Dec 3, 2019 5:30am Dec 3, 2019 5:30am
  •  yamin2000
  • | Joined Apr 2018 | Status: Member | 15 Posts
Quoting honeggeral
Disliked
yeah i can do that, send me the indicator and a picture of an example of when the alert should be activated
Ignored
Attached Image (click to enlarge)
Click to Enlarge

Name: ff.PNG
Size: 77 KB

hi
alert me before it reach 141.100 for example 2 pip the distance i set it manual
Attached File
File Type: mq4 SweetSpotsGOLD_TRO_MODIFIED_VERSION.mq4   6 KB | 3 downloads
Thread Tools Search this Thread
Show Printable Version Show Printable Version
Email This Thread Email This Thread
Search this Thread:

Advanced Search

  • Platform Tech
  • /
  • add alerts to Sweet Spot Indicator
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2019