Witam,
Posiadam dostęp do konta na FX na którym są udostępniane sygnały (transakcje oczywiście są tam zabronione.). Nie mam zamiaru cały czas patrzeć w ekran, kiedy udostępniający sygnały otworzy pozycję.
Dlatego poszukiwałem wskaźnika, który informowałby mnie komunikatem dźwiękowym gdy zostanie otwarta pozycja.
Niestety nic takiego nie znalazłem i dlatego próbuję napisać taki wskaźnik, oczywiście mi to nie wychodzi
Chciałbym zmodyfikować wskaźnik price alert:
Kod: Zaznacz cały
//+------------------------------------------------------------------+
//| 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;
//+------------------------------------------------------------------+
//| 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, Green);
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, Red);
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");
ObjectDelete("SoundWhenPriceGoesAbove");
SoundWhenPriceGoesAbove = 0;
}
if ((Bid < SoundWhenPriceGoesBelow) && (SoundWhenPriceGoesBelow > 0))
{
Alert("Price below the alert level.");
PlaySound("alert.wav");
ObjectDelete("SoundWhenPriceGoesBelow");
SoundWhenPriceGoesBelow = 0;
}
if ((Bid == SoundWhenPriceIsExactly) || (Ask == SoundWhenPriceIsExactly))
{
Alert("Price is exactly at the alert level.");
PlaySound("alert.wav");
ObjectDelete("SoundWhenPriceIsExactly");
SoundWhenPriceIsExactly = 0;
}
return(0);
}
//+------------------------------------------------------------------+
Pomysł jest następujący: Wyciągnąć aktualnie wszystkie otwarte pozycje i zapisać je do zmiennych
SoundWhenPriceGoesAbove i SoundWhenPriceGoesBelow. Np. zostanie otwarta pozycja na poziomie 1.3100.
Gdy przekroczy górą albo dołem tę wartość wtedy pokaże się alert. Albo zrobić to na zmiennej SoundWhenPriceIsExactly.
Znalazłem w helpie funkcje, które mają mi w tym pomóc lecz nie za bardzo wiem jak z nich skorzystać
Kod: Zaznacz cały
if(OrderSelect(124, SELECT_BY_TICKET)==true)
{
Print("Cena otwarcia zlecenie #124 ", OrderOpenPrice());
Print("Cena zamknięcia zlecenia #124 ", OrderClosePrice());
}
else
Print("Błąd wykonania funkcji OrderSelect ",GetLastError());
if(OrderSelect(124, SELECT_BY_POS)==true){
Print("Cena otwarcia zlecenia #124 ",OrderOpenPrice());
}
else
Print("Błąd wykonania funkcji OrderSelect ",GetLastError());