#3 news panel (black) bgp.mq5
Похожие материалы по тегам
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «#3 news panel (black) bgp.mq5» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
О программе
Этот индикатор для MetaTrader 5 отображает на графике панель с информацией об экономических новостях, получаемых из внешнего XML-файла ForexFactory. Панель показывает до четырёх ближайших событий с указанием времени, страны и важности, а также может подавать звуковое оповещение за заданное число минут до первого события. Индикатор поддерживает настройку отображаемых валют, цветовую схему, выбор таймфреймов для показа и расположение панели на графике. Реализована загрузка XML-файла через Wininet.dll с обновлением не чаще заданного интервала. Исходный код содержит предупреждение о необходимости разрешить импорт DLL.
Настройки программы
| Настройка | Описание |
|---|---|
| Part_1 | Заголовок группы настроек управления отображением индикатора. |
| Indicator_On | Включает или выключает отображение индикатора на графике. |
| Show_Impacts_H_HM_HML_123 | Выбор отображаемых уровней важности новостей: 1 — только высокая, 2 — высокая и средняя, 3 — высокая, средняя и низкая. |
| News_Panel_At_Chart_Right | Если включено, панель новостей располагается в правом верхнем углу графика. |
| News_Panel_In_Subwindow_1 | Если включено, панель новостей отображается в первом подокне графика. |
| Display_Min_TF | Минимальный таймфрейм в секундах, на котором отображается индикатор. |
| Display_Max_TF | Максимальный таймфрейм в секундах, на котором отображается индикатор. |
| TF_Choices | Список таймфреймов, разделённых дефисом, на которых индикатор может отображаться. |
| __ | Пустой разделитель между группами настроек. |
| Part_2 | Заголовок группы настроек панели новостей. |
| Panel_Title | Цвет заголовка панели новостей. |
| Low_Impact_News_Color | Цвет текста для новостей низкой важности. |
| Medium_Impact_News_Color | Цвет текста для новостей средней важности. |
| High_Impact_News_Color | Цвет текста для новостей высокой важности. |
| Bank_Holiday_Color | Цвет текста для банковских праздников. |
| Remarks_Color | Цвет текста для примечаний и отсутствующих событий. |
| Background_Color_ | Цвет фона панели новостей. |
| Show_Panel_Background | Включает отображение фона панели новостей. |
| ___ | Пустой разделитель между группами настроек. |
| Part_3 | Заголовок группы настроек отображения новостей по другим валютам. |
| Show_USD_News | Включает отображение новостей, связанных с долларом США (USD). |
| Show_EUR_News | Включает отображение новостей, связанных с евро (EUR). |
| Show_GBP_News | Включает отображение новостей, связанных с британским фунтом (GBP). |
| Show_NZD_News | Включает отображение новостей, связанных с новозеландским долларом (NZD). |
| Show_JPY_News | Включает отображение новостей, связанных с японской иеной (JPY). |
| Show_AUD_News | Включает отображение новостей, связанных с австралийским долларом (AUD). |
| Show_CAD_News | Включает отображение новостей, связанных с канадским долларом (CAD). |
| Show_CHF_News | Включает отображение новостей, связанных со швейцарским франком (CHF). |
| Show_CNY_News | Включает отображение новостей, связанных с китайским юанем (CNY). |
| Ignore_Current_Symbol | Если включено, новости по текущему символу графика не учитываются, отображаются только выбранные валюты. |
| ____ | Пустой разделитель между группами настроек. |
| Part_4 | Заголовок группы настроек оповещения о событии 1. |
| Alert_Minutes_Before_Event_1 | Число минут до первого события, за которое должно сработать оповещение. Значение 0 отключает оповещение. |
Поиск по коду файла
/*-------------------------------------------------------------------------------------------------
User Notes:
This indicator is coded to run on MT4 Build 600+. It places a News Panel on the chart displaying
up to four news releases. Details are provided below.
News Panel Contents -
The time, title and ranking of the releases are shown.
The time releases is important. SM (Smart Money: investment banks, hedge funds, etc.) often
know in advance the essence of the content of "official" releases. This is due to the fact that
banks frequently are part of the data gathering process. Keep in mind that for the currency
market there is no law against "formal institutions" having and trading on "insider information."
So, SM can place orders in advance of releases and Market Makers can move price ahead of releases
and use the remaining time to fill those orders, saving the move that will make profits on the
orders until the time of the releases. This is called "front running".
The title and ranking of releases is important because the variety of low impact releases often
have no effect on price, whereas the variety of high impact releases can trigger a big price move,
and sometimes involve front running.
Of the three impact level events (High, Medium, Low) and Bank Holidays, you have the option to not
show all but the High Impact events. Previous/Forecast data is not displayed because prices can
go either way regardless of specifics released. it is the timing of news that is important, as a
potential market volatility event, and as an event that might precipitate front running.
Prioritizing News Events -
Prioritization of events is fully automated and four event labels are provided to help avoid
surprises. When two or more events occur simultaneously, only one event of the highest impact
displays unless there are multiple high impact events. In that case the multple high impact
events are displayed. When 2nd, 3rd or 4th events are not scheduled, text noting that appears.
A current day Bank Holiday will remain displayed in the first label until the Bank Holiday is
over. You can show events for any pair on any chart. For example, you can show a CNY (China)
event on a AUDUSD chart. A new option is added allowing you to ignore the chart pair and just
select what other currencies you want to show news for.
The News Alert -
You can specify to be alerted "x" minutes ahead of the scheduled release of Event #1. When
that time arrives, an alert will sound/appear on the chart. If during the same minute, while
the release time and the alert time are of the same minute, if you change chart time framse the
alert will retrigger on the selected new chart time frame. After that minute passes, there will
be no retrigger of the set alert under any circumstances. Enter your "Broker_Name_In_Alert" to
avoid confusion if simultaneously using multiple platforms involving different brokers.
When "Alert_Minutes_Before_Event_1" is set at "0" the Alert is not set to function. If any
other number appears, the Alert is set to function. When the Alert is set to function....
* If the minutes input is less than the time to the release of Event #1, the Alert is set
to trigger and "Alert Pending" appears in the FFCal title.
* If the minutes input equals the time to the release, the Alert triggers and "Alert Received"
appears in the FFCal title.
* If the minutes input now exceeds the time to the release, the release is already one or
more minutes into the past and "Alert Completed" appears in the FFCal title. When this is
the case, open the External Inputs and reset the input to "0" to turn off the Alert.
Setting Time Frames for Display of Indicator -
You can select a range of TFs for the display of this indicator, so it automatically will not
display on a chart TF outside that range. The indicator can be turned on/off without having
to remove it from the chart, thereby preserving your chart settings.
Revisons to previous release 05-30-2015:
* Changed text font style to enhance clarity.
* Revised Panel background sizing code to prevent text overruns.
* Revised User Notes.
* Made some minor "housekeeping" changes.
- Traderathome, 06-28-2015
---------------------------------------------------------------------------------------------------
ACKNOWLEDGEMENTS:
derkwehler and other contributors - the core code of the FFCal indicator,
FFCal_v20 dated 07/07/2009, Copyright @ 2006 derkwehler
email: d********r*@gmail.com
deVries - for his excellent donated work that significantly altered and streamlined the file
handling coding to establish compatibility with the new release of MT4 Build 600+,
(Jobs for deVries www.mql5.com/en/job/new?prefered=deVries)
qFish - for his generously given time and help during the effort to improve this indicator.
atstrader - For the option controlling for what pair/pairs(s) news is shown, and for providing
new file access coding in 2015.
traderathome - for the modification of the original work to show more and prioritized headlines.
---------------------------------------------------------------------------------------------------
Suggested Colors: White Charts Black Charts
Panel_Title Black C'180,180,180'
News_Low_Impact C'000,125,029' C'046,186,046'
News_Medium_Impact MediumBlue C'098,147,238'
News_High_Impact Crimson C'240,038,038'
Bank_Holiday_Color DarkOrchid Orchid
Remarks_Color DarkGray DimGray
Background_Color_ White C'010,010,010''
-------------------------------------------------------------------------------------------------*/
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 CLR_NONE
#define READURL_BUFFER_SIZE 100
#define TITLE 0
#define COUNTRY 1
#define DATE 2
#define TIME 3
#define IMPACT 4
#define FORECAST 5
#define PREVIOUS 6
#import "Wininet.dll"
int InternetOpenW(string, int, string, string, int);
int InternetConnectW(int, string, int, string, string, int, int, int);
int HttpOpenRequestW(int, string, string, int, string, int, string, int);
int InternetOpenUrlW(int, string, string, uint, uint, uint);
int InternetReadFile(int, uchar & arr[], int, int & arr[]);
int InternetCloseHandle(int);
#import
extern string Part_1 = "Indicator Display Controls:";
extern bool Indicator_On = true;
extern int Show_Impacts_H_HM_HML_123 = 3;
extern bool News_Panel_At_Chart_Right = true;
extern bool News_Panel_In_Subwindow_1 = true;
extern int Display_Min_TF = 1;
extern int Display_Max_TF = 43200;
extern string TF_Choices = "1-5-15-30-60-240-1440-10080-43200";
extern string __ = "";
extern string Part_2 = "News Panel Settings:";
extern color Panel_Title = C'180,180,180';
extern color Low_Impact_News_Color = C'046,186,046';
extern color Medium_Impact_News_Color = C'098,147,238';
extern color High_Impact_News_Color = C'240,038,038';
extern color Bank_Holiday_Color = Orchid;
extern color Remarks_Color = DimGray;
extern color Background_Color_ = C'010,010,010';
extern bool Show_Panel_Background = true;
extern string ___ = "";
extern string Part_3 = "Other Currency Settings:";
extern bool Show_USD_News = false;
extern bool Show_EUR_News = false;
extern bool Show_GBP_News = false;
extern bool Show_NZD_News = false;
extern bool Show_JPY_News = false;
extern bool Show_AUD_News = false;
extern bool Show_CAD_News = false;
extern bool Show_CHF_News = false;
extern bool Show_CNY_News = false;
extern bool Ignore_Current_Symbol = false;
extern string ____ = "";
extern string Part_4 = "Event #1 Alert Setting:";
extern int Alert_Minutes_Before_Event_1 = 0;
bool Deinitialized, skip;
bool FLAG_1_done, FLAG_2_done, FLAG_3_done, FLAG_4_done;
bool FLAG_1_none, FLAG_2_none, FLAG_3_none, FLAG_4_none;
int BankIdx1,cnr;
color TxtColorNews;
datetime newsTime,calendardate; //sundaydate calendar
double ExtMapBuffer0[]; // Contains (minutes until) each news event
int xmlHandle, BoEvent, finalend, end, begin, minsTillNews, tmpMins, idxOfNext;
int Minutes[8], newsIdx, next, dispMins, Days, Hours, Mins;
int i,k,curX,curY,W,Box,x1,x2,index;
int WebUpdateFreq = 240; // 240 Minutes between web updates to not overload FF server
int TxtSize = 7;
int TitleSpacer = 6;
int EventSpacer = 4;
static int PrevMinute = -1;
string xmlFileName;
string xmlSearchName;
int PrevTF = 0;
static int UpdateRateSec = 10;
string sUrl = ""; //original
string myEvent,mainData[200][7], sData, csvoutput, sinceUntil, TimeStr;
string G,/*pair, cntry1, cntry2,*/ Title[8], Country[8], Impact[8],event[5],Color[5];
string sTags[7] = { "<title>", "<country>", "<date><![CDATA[","<time><![CDATA[",
"<impact><![CDATA[", "<forecast><![CDATA[", "<previous><![CDATA[" };
string eTags[7] = { "</title>", "</country>", "]]></date>", "]]></time>",
"]]></impact>", "]]></forecast>", "]]></previous>" };
string Text_Style = "Tahoma";
string header;
string box1 = "z[News] Box1";
string box2 = "z[News] Box2";
string News1 = "z[News] News1";
string News2 = "z[News] News2";
string News3 = "z[News] News3";
string News4 = "z[News] News4";
string Sponsor = "z[News] Sponsor";
bool Alert_Allowed;
string TxtStr = " ";
int TxtLen = 0;
int TxtLenMax = 0;
int deinit()
{
int obj_total= ObjectsTotal();
for (i= obj_total; i>=0; i--)
{
string name= ObjectName(i);
if (StringSubstr(name,0,6)=="z[News") {ObjectDelete(name);}
}
return(0);
}
int init()
{
// код доступен только после оплаты
}
int start()
{
// код доступен только после оплаты
}
if((!Indicator_On) || ((Period() < Display_Min_TF) || (Period() > Display_Max_TF)))
{
if (!Deinitialized) {deinit(); Deinitialized = true;}
return(0);
}
InitNews(sUrl);
if(PrevTF==Period())
{
if(MathMod(Seconds(),UpdateRateSec)==0)
{
return (true);
}
else
{
PrevTF = Period();
}
}
ArrayInitialize(ExtMapBuffer0, 0);
xmlHandle = FileOpen(xmlFileName, FILE_BIN|FILE_READ);
if(xmlHandle>=0)
{
int size = FileSize(xmlHandle);
sData = FileReadString(xmlHandle, size);
FileClose(xmlHandle);
}
BankIdx1 = 0;
FLAG_1_done = false;
FLAG_2_done = false;
FLAG_3_done = false;
FLAG_4_done = false;
FLAG_1_none = false;
FLAG_2_none = false;
FLAG_3_none = false;
FLAG_4_none = false;
for (i=0; i<=9; i++)
{
Title[i] = "";
Country[i] = "";
Impact[i] = "";
Minutes[i] = 0;
}
newsIdx = 0;
tmpMins = 10080; // (a week)
BoEvent = 0;
while (true)
{
BoEvent = StringFind(sData, "<event>", BoEvent);
if (BoEvent == -1) break;
BoEvent += 7;
next = StringFind(sData, "</event>", BoEvent);
if (next == -1) break;
myEvent = StringSubstr(sData, BoEvent, next - BoEvent);
BoEvent = next;
begin = 0;
skip = false;
for (i=0; i < 7; i++)
{
mainData[newsIdx][i] = "";
next = StringFind(myEvent, sTags[i], begin);
if (next == -1) continue;
else
{
begin = next + StringLen(sTags[i]); // Advance past the start tag
end = StringFind(myEvent, eTags[i], begin); // Find start of end tag
if (end > begin && end != -1)
{mainData[newsIdx][i] = StringSubstr(myEvent, begin, end - begin);}
}
}//End "for" loop
if(!IsNewsCurrency(Symbol(),mainData[newsIdx][COUNTRY])) //deVries
{skip = true;}
else if ((Show_Impacts_H_HM_HML_123 == 1) &&
(mainData[newsIdx][IMPACT] == "Medium"))
{skip = true;}
else if ((Show_Impacts_H_HM_HML_123 == 1 || Show_Impacts_H_HM_HML_123 == 2) &&
(mainData[newsIdx][IMPACT] == "Low"))
{skip = true;}
else if (!StringSubstr(mainData[newsIdx][TITLE],0,4)== "Bank")
{skip = true;}
else if (!StringSubstr(mainData[newsIdx][TITLE],0,8)== "Daylight")
{skip = true;}
else if ((mainData[newsIdx][TIME] == "All Day" && mainData[newsIdx][TIME] == "") ||
(mainData[newsIdx][TIME] == "Tentative" && mainData[newsIdx][TIME] == "") ||
(mainData[newsIdx][TIME] == ""))
{skip = true;}
if (!skip)
{
newsTime = MakeDateTime(mainData[newsIdx][DATE], mainData[newsIdx][TIME]);
minsTillNews = (newsTime - TimeGMT()) / 60;
if (minsTillNews < 0 || MathAbs(tmpMins) > minsTillNews)
{idxOfNext = newsIdx; tmpMins = minsTillNews;}
ExtMapBuffer0[newsIdx] = minsTillNews;
newsIdx++;
}//End "skip" routine
}//End "while" routine
for (i=0; i < newsIdx; i++)
{
if (i == idxOfNext-3)
{
Title[7] = mainData[i][TITLE];
Country[7] = mainData[i][COUNTRY];
Impact[7] = mainData[i][IMPACT];
Minutes[7] = ExtMapBuffer0[i];
}
if (i == idxOfNext-2)
{
Title[6] = mainData[i][TITLE];
Country[6] = mainData[i][COUNTRY];
Impact[6] = mainData[i][IMPACT];
Minutes[6] = ExtMapBuffer0[i];
}
if (i == idxOfNext-1)
{
Title[5] = mainData[i][TITLE];
Country[5] = mainData[i][COUNTRY];
Impact[5] = mainData[i][IMPACT];
Minutes[5] = ExtMapBuffer0[i];
}
if (i == idxOfNext)
{
Title[1] = mainData[i][TITLE];
Country[1] = mainData[i][COUNTRY];
Impact[1] = mainData[i][IMPACT];
Minutes[1] = ExtMapBuffer0[i];
if (Minutes[0] <= 0)
{
if ((Minutes[0] == Minutes[4]) &&
((Impact[1] == "Medium" && Impact[5] == "High") ||
(Impact[1] == "Low" && Impact[5] == "High") ||
(Impact[1] == "Low" && Impact[5] == "Medium")))
{
Title[1] = Title[5];
Country[1] = Country[5];
Impact[1] = Impact[5];
Minutes[1] = Minutes[5];
}
else if ((Minutes[0] == Minutes[5]) &&
((Impact[1] == "Medium" && Impact[5] == "High") ||
(Impact[1] == "Low" && Impact[5] == "High") ||
(Impact[1] == "Low" && Impact[5] == "Medium")))
{
Title[1] = Title[6];
Country[1] = Country[6];
Impact[1] = Impact[6];
Minutes[1] = Minutes[6];
}
else if ((Minutes[0] == Minutes[6]) &&
((Impact[1] == "Medium" && Impact[7] == "High") ||
(Impact[1] == "Low" && Impact[7] == "High") ||
(Impact[1] == "Low" && Impact[7] == "Medium")))
{
Title[1] = Title[7];
Country[1] = Country[7];
Impact[1] = Impact[7];
Minutes[1] = Minutes[7];
}
}
}
if (i >= idxOfNext+1)
{
Title[7] = mainData[i][TITLE];
Country[7] = mainData[i][COUNTRY];
Impact[7] = mainData[i][IMPACT];
Minutes[7] = ExtMapBuffer0[i];
if (!FLAG_1_done)
{
if ((Minutes[1] == Minutes[7]) &&
((Impact[1] == "Medium" && Impact[7] == "High") ||
(Impact[1] == "Low" && Impact[7] == "High") ||
(Impact[1] == "Low" && Impact[7] == "Medium")))
{
Title[1] = Title[7];
Country[1] = Country[7];
Показано первые 50% кода (символов: 25339)
Открыть по тарифу
Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.
Разовая покупка файла
На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.
Зачем нужен email? После подтверждения оплаты файл сохранится в кабинете на этот email. Если аккаунта ещё нет, мы создадим его и пришлём ссылку для задания пароля. Если аккаунт уже есть, покупка добавится в него. Укажите адрес, к которому у вас есть доступ.
Чтобы оформить заказ, введите email и перейдите к оплате.