Price Alert для FORCE INDEX

 
Доброго времени суток!
Есть индикатор Price Alert - он посылает письмо на почту если цена дошла до заведомо нужного Вам уровня!

Как его переделать на то, что бы он посылал письмо когда уровня достигает Force Index

Пример:
Force Index достиг уровня 0.50 - нужно что бы Alert послал письмо на почту!
СПАСИБО!!!
 
papaden:
Индикатор сюда залейте.
 
papaden:
//+------------------------------------------------------------------+
//| PriceAlert.mq4 |
//| Copyright © 2009, www.earnforex.com |
//| Issues sound alerts when price reaches certain levels. |
//+------------------------------------------------------------------+
#property copyright "EarnForex.com"
#property link "http://www.earnforex.com"

#property indicator_chart_window

extern double SoundWhenPriceGoesAbove = 0;
extern double SoundWhenPriceGoesBelow = 0;
extern double SoundWhenPriceIsExactly = 0;
extern bool SendEmail = true; //If true e-mail is sent to the e-mail address set in your MT4. E-mail SMTP Server settings should also be configured in your MT4

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
if (SoundWhenPriceIsExactly > 0)
{
ObjectCreate("SoundWhenPriceIsExactly", OBJ_HLINE, 0, Time[0], SoundWhenPriceIsExactly);
ObjectSet("SoundWhenPriceIsExactly", OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("SoundWhenPriceIsExactly", OBJPROP_COLOR, Yellow);
ObjectSet("SoundWhenPriceIsExactly", OBJPROP_WIDTH, 1);
}
if (SoundWhenPriceGoesAbove > 0)
{
ObjectCreate("SoundWhenPriceGoesAbove", OBJ_HLINE, 0, Time[0], SoundWhenPriceGoesAbove);
ObjectSet("SoundWhenPriceGoesAbove", OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("SoundWhenPriceGoesAbove", OBJPROP_COLOR, LightGreen);
ObjectSet("SoundWhenPriceGoesAbove", OBJPROP_WIDTH, 1);
}
if (SoundWhenPriceGoesBelow > 0)
{
ObjectCreate("SoundWhenPriceGoesBelow", OBJ_HLINE, 0, Time[0], SoundWhenPriceGoesBelow);
ObjectSet("SoundWhenPriceGoesBelow", OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("SoundWhenPriceGoesBelow", OBJPROP_COLOR, LightCoral);
ObjectSet("SoundWhenPriceGoesBelow", OBJPROP_WIDTH, 1);
}
return(0);
}

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("SoundWhenPriceIsExactly");
ObjectDelete("SoundWhenPriceGoesAbove");
ObjectDelete("SoundWhenPriceGoesBelow");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
if ((Ask > SoundWhenPriceGoesAbove) && (SoundWhenPriceGoesAbove > 0))
{
Alert("Price above the alert level.");
PlaySound("alert.wav");
SendMail("Price for " + Symbol() + " above the alert level " + Ask, "Price for " + Symbol() + " reached " + Ask + " level, which is above your alert level of " + SoundWhenPriceGoesAbove);
ObjectDelete("SoundWhenPriceGoesAbove");
SoundWhenPriceGoesAbove = 0;
}
if ((Bid < SoundWhenPriceGoesBelow) && (SoundWhenPriceGoesBelow > 0))
{
Alert("Price below the alert level.");
PlaySound("alert.wav");
SendMail("Price for " + Symbol() + " below the alert level " + Bid, "Price for " + Symbol() + " reached " + Bid + " level, which is below your alert level of " + SoundWhenPriceGoesBelow);
ObjectDelete("SoundWhenPriceGoesBelow");
SoundWhenPriceGoesBelow = 0;
}
if ((Bid == SoundWhenPriceIsExactly) || (Ask == SoundWhenPriceIsExactly))
{
Alert("Price is exactly at the alert level.");
PlaySound("alert.wav");
SendMail("Price for " + Symbol() + " exactly at the alert level " + Ask, "Price for " + Symbol() + " reached " + Ask + "/" + Bid + " level, which is exactly your alert level of " + SoundWhenPriceIsExactly);
ObjectDelete("SoundWhenPriceIsExactly");
SoundWhenPriceIsExactly = 0;
}
}
//+------------------------------------------------------------------+


Для начала SRC cверху нажмите и:

//+------------------------------------------------------------------+
//| PriceAlert.mq4 |
//| Copyright © 2009, www.earnforex.com |
//| Issues sound alerts when price reaches certain levels. |
//+------------------------------------------------------------------+
#property copyright "EarnForex.com"
#property link "http://www.earnforex.com"


#property indicator_chart_window


extern double SoundWhenPriceGoesAbove = 0;
extern double SoundWhenPriceGoesBelow = 0;
extern double SoundWhenPriceIsExactly = 0;
extern bool SendEmail = true; //If true e-mail is sent to the e-mail address set in your MT4. E-mail SMTP Server settings should also be configured in your MT4


//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() 
{
if (SoundWhenPriceIsExactly > 0)
{
ObjectCreate("SoundWhenPriceIsExactly", OBJ_HLINE, 0, Time[0], SoundWhenPriceIsExactly);
ObjectSet("SoundWhenPriceIsExactly", OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("SoundWhenPriceIsExactly", OBJPROP_COLOR, Yellow);
ObjectSet("SoundWhenPriceIsExactly", OBJPROP_WIDTH, 1);
}
if (SoundWhenPriceGoesAbove > 0)
{
ObjectCreate("SoundWhenPriceGoesAbove", OBJ_HLINE, 0, Time[0], SoundWhenPriceGoesAbove);
ObjectSet("SoundWhenPriceGoesAbove", OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("SoundWhenPriceGoesAbove", OBJPROP_COLOR, LightGreen);
ObjectSet("SoundWhenPriceGoesAbove", OBJPROP_WIDTH, 1);
}
if (SoundWhenPriceGoesBelow > 0)
{
ObjectCreate("SoundWhenPriceGoesBelow", OBJ_HLINE, 0, Time[0], SoundWhenPriceGoesBelow);
ObjectSet("SoundWhenPriceGoesBelow", OBJPROP_STYLE, STYLE_SOLID);
ObjectSet("SoundWhenPriceGoesBelow", OBJPROP_COLOR, LightCoral);
ObjectSet("SoundWhenPriceGoesBelow", OBJPROP_WIDTH, 1);
}
return(0);
}


//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("SoundWhenPriceIsExactly");
ObjectDelete("SoundWhenPriceGoesAbove");
ObjectDelete("SoundWhenPriceGoesBelow");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
if ((Ask > SoundWhenPriceGoesAbove) && (SoundWhenPriceGoesAbove > 0))
{
Alert("Price above the alert level.");
PlaySound("alert.wav");
SendMail("Price for " + Symbol() + " above the alert level " + Ask, "Price for " + Symbol() + " reached " + Ask + " level, which is above your alert level of " + SoundWhenPriceGoesAbove);
ObjectDelete("SoundWhenPriceGoesAbove");
SoundWhenPriceGoesAbove = 0;
}
if ((Bid < SoundWhenPriceGoesBelow) && (SoundWhenPriceGoesBelow > 0))
{
Alert("Price below the alert level.");
PlaySound("alert.wav");
SendMail("Price for " + Symbol() + " below the alert level " + Bid, "Price for " + Symbol() + " reached " + Bid + " level, which is below your alert level of " + SoundWhenPriceGoesBelow);
ObjectDelete("SoundWhenPriceGoesBelow");
SoundWhenPriceGoesBelow = 0;
}
if ((Bid == SoundWhenPriceIsExactly) || (Ask == SoundWhenPriceIsExactly))
{
Alert("Price is exactly at the alert level.");
PlaySound("alert.wav");
SendMail("Price for " + Symbol() + " exactly at the alert level " + Ask, "Price for " + Symbol() + " reached " + Ask + "/" + Bid + " level, which is exactly your alert level of " + SoundWhenPriceIsExactly);
ObjectDelete("SoundWhenPriceIsExactly");
SoundWhenPriceIsExactly = 0;
}
}
//+------------------------------------------------------------------+
Так-то лучше?!
 
borilunad:


Для начала SRC cверху нажмите и:

Так-то лучше?!


понял ... спасибо...

вот... Это код индикатора, который посылает письмо в почту....

extern bool SendEmail = true

как сделать так. что бы force index тоже это делал?

 
#property indicator_chart_window

extern int MyPeriod=13;
extern int MyMethod=0;
extern int MyApplied_price=0;
extern int MyShift=0;
extern double MyLowIF=0.49;
extern double MyHighIF=0.51;

double f;

int init() {}
int deinit() {}

int start()
{
f=iForce(NULL,0,MyPeriod, MyMethod, MyApplied_price, MyShift);
if ((f>=MyLowIF) && (f<=MyHighIF))
  {
  SendMail("из Вашего MT-4", "iForce достиг установленных значений");
  }
}
 

DmitriyN !!!! Восхитительно!!!!

спасиибо!!!!

SendMail("не понял что указывать туту", "и тут");

так? SendMail("не понял что указывать туту", "0.80"); ????

не могли бы Вы указать для примера ...

Force Index

13 (ema) интересуют значения +0.05 и -0.05

 
papaden:
не могли бы Вы указать для примера ...
Force Index
13 (ema) интересуют значения +0.05 и -0.05


Для EMA(13), iForce=0,5 и iForce=-0,05:

#property indicator_chart_window

extern int MyPeriod=13;
extern int MyMethod=1; // смотрите https://docs.mql4.com/ru/constants/movings
extern int MyApplied_price=0;
extern int MyShift=0;
//1
extern double MyLowIF1=0.49;
extern double MyHighIF1=0.51;
//2
extern double MyLowIF2=-0.051;
extern double MyHighIF2=-0.049;

double f;

int init() {}
int deinit() {}

int start()
{
f=iForce(NULL,0,MyPeriod, MyMethod, MyApplied_price, MyShift);
//1
if ((f>=MyLowIF1) && (f<=MyHighIF1))
   {
   SendMail("из Вашего MT-4", "iForce достиг установленного диапазона 1");
   }
//2
if ((f>=MyLowIF2) && (f<=MyHighIF2))
   {
   SendMail("из Вашего MT-4", "iForce достиг установленного диапазона 2");
   }
}
 
papaden:

так? SendMail("не понял что указывать туту", "0.80"); ????

Тут ничего. Почту укажите в настройках терминала.
https://docs.mql4.com/ru/common/sendmail
 

Красавчик! скинь мне номер мобилки я тебе 200 руб перечислю ! Знаю мало, но все же... любой труд должен быть оплачен... красавчик

моя почта papaden@yandex.ru кинь туда что бы тут не светить...

+5

 
papaden:

Красавчик! скинь мне номер мобилки я тебе 200 руб перечислю ! Знаю мало, но все же... любой труд должен быть оплачен... красавчик

моя почта papaden@yandex.ru кинь туда что бы тут не светить...

+5

Спасибо, не надо. Мне денег хватает.
 

тогда здоровья и человеческого счастья тебе!!! от души!

вопрос еще есть

extern double MyLowIF1=0.49;

extern double MyHighIF1=0.51;

это уровни после достижения котрых будет письмо?

или при наложении индикатора MyLowIF и MyHighIF мне туда прописываь....??

Причина обращения: