for(int i=0; i<ArraySize(news_type); i++){ // каждый проход это таблица
int db=DatabaseOpen(global_file, DATABASE_OPEN_READWRITE | DATABASE_OPEN_CREATE |DATABASE_OPEN_COMMON);
// Print(__FUNCTION__ , " ", db);
if(db==INVALID_HANDLE){
Print(__FUNCTION__, " DB: ", global_file, " open failed with code ", GetLastError());
}else{
global_newstype = news_type[i];
//после подключения к таблице осуществляется поиск данны
//string req = NormalizeSelect("ID WHERE H4MINUS4HDIR='down'");
string req = NormalizeSelect(preRequest);
string IDs[]; requestArr(db, req, IDs); //нужные айдишники
//cчетчики
int LO_asianContinuationLongs=0, LO_asianContinuationShorts=0, LO_asianRange=0,
loAsianHighSeek=0, loAsianLowSeek=0, loAsianDestroy=0,
euAsianHighSeek=0, euAsianLowSeek=0, euAsianDestroy=0,
LO_LONGS_TOKYO_LOW_Seek=0, LO_LONGS_ASIAN_LOW_Seek=0,
EU_LONGS_TOKYO_LOW_Seek=0, EU_LONGS_ASIAN_LOW_Seek=0,
LO_SHORTS_TOKYO_HIGH_Seek=0, LO_SHORTS_ASIAN_HIGH_Seek=0,
EU_SHORTS_TOKYO_HIGH_Seek=0, EU_SHORTS_ASIAN_HIGH_Seek=0,
AM_LONGS_LO_LOW_Seek =0, AM_LONGS_EU_LOW_Seek =0,
AM_LONGS_TOKYO_LOW_Seek =0, AM_LONGS_ASIAN_LOW_Seek =0,
USA_LONGS_LO_LOW_Seek =0, USA_LONGS_EU_LOW_Seek =0,
USA_LONGS_TOKYO_LOW_Seek =0, USA_LONGS_ASIAN_LOW_Seek =0,
AM_SHORTS_LO_HIGH_Seek=0, AM_SHORTS_EU_HIGH_Seek =0,
AM_SHORTS_TOKYO_HIGH_Seek =0, AM_SHORTS_ASIAN_HIGH_Seek =0,
USA_SHORTS_LO_HIGH_Seek=0, USA_SHORTS_EU_HIGH_Seek=0,
USA_SHORTS_TOKYO_HIGH_Seek=0, USA_SHORTS_ASIAN_HIGH_Seek=0;
int AM_EUContinuationLongs=0, AM_EUContinuationShorts=0, AM_EURange=0,
AMEUHighSeek=0, AMEULowSeek=0, AMEUDestroy=0,
USAEUHighSeek=0, USAEULowSeek=0, USAEUDestroy=0;
int euDayLow=0, loDayLow=0, asiaDayLow=0, usaDayLow=0, amDayLow=0,
SopenDayLow=0, PremarketDayLow=0, LunchDayLow=0, PMDayLow=0,
LastHourDayLow=0,
euDayHigh=0, loDayHigh=0, asiaDayHigh=0, usaDayHigh=0, amDayHigh=0,
SopenDayHigh=0, PremarketDayHigh=0, LunchDayHigh=0, PMDayHigh=0,
LastHourDayHigh=0;
int PerviousDayLow=0, PerviousDayHigh=0, PerviousDayDestroy=0,
PerviousDayRange=0,
euPerviousDayLow=0, loPerviousDayLow=0, asiaPerviousDayLow=0,
usaPerviousDayLow=0, amPerviousDayLow=0, SopenPerviousDayLow=0,
PremarketPerviousDayLow=0, LunchPerviousDayLow=0, PMPerviousDayLow=0,
LastHourPerviousDayLow=0,
euPerviousDayHigh=0, loPerviousDayHigh=0, asiaPerviousDayHigh=0,
usaPerviousDayHigh=0, amPerviousDayHigh=0, SopenPerviousDayHigh=0,
PremarketPerviousDayHigh=0, LunchPerviousDayHigh=0, PMPerviousDayHigh=0,
LastHourPerviousDayHigh=0;
int Monday=0, Tuesday=0, Wednesday=0, Thursday=0, Friday=0,
WeekHigh_Monday=0, WeekHigh_Tuesday=0, WeekHigh_Wednesday=0,
WeekHigh_Thursday=0, WeekHigh_Friday=0,
WeekLow_Monday=0, WeekLow_Tuesday=0, WeekLow_Wednesday=0,
WeekLow_Thursday=0,WeekLow_Friday=0;
int pdlafternewslfill = 0, pdhafternewslfill = 0,
pdlbeforenewslfill = 0, pdhbeforenewslfill = 0;
int reversal_1D = 0, reversal_4H=0, reversal_1H=0,
reversal_15m_30=0, reversal_15m_2h=0,
reversal_15m_4h=0,reversal_15m_30m2h=0, reversal_15m_30m4h=0,
reversal_h1_2h =0, reversal_h1_4h=0, reversal_h1_2h4h=0, reversal_h4_4h=0;
int d1fvg_before_news=0,d1fvg_after_news=0, h4fvg_before_news=0,
h4fvg_after_news=0, h1fvg_before_news=0, h1fvg_after_news=0;
for(int l = 0; l < ArraySize(IDs); l++) { //строки таблицы с учетом выборки айдишников
UpdateDataGlobalCandles(db, IDs[l], l); //правильные свечи
UpdateMacroHighsAndLows(); //ключевые хаи-лои
................
// -- ma
global_ma[0] = StringToDouble(global_PM0600MIN[l]);
global_ma[1] = StringToDouble(global_PM0600MAX[l]);
global_ma[2] = StringToDouble(global_PM0615MIN[l]);
global_ma[3] = StringToDouble(global_PM0615MAX[l]);
global_ma[4] = StringToDouble(global_PM0630MIN[l]);
global_ma[5] = StringToDouble(global_PM0630MAX[l]);
global_ma[6] = StringToDouble(global_PM0645MIN[l]);
global_ma[7] = StringToDouble(global_PM0645MAX[l]);
......
global_ma[176] = StringToDouble(global_PM0400MIN[l]);
global_ma[177] = StringToDouble(global_PM0400MAX[l]);
global_ma[178] = StringToDouble(global_PM0415MIN[l]);
global_ma[179] = StringToDouble(global_PM0415MAX[l]);
global_ma[180] = StringToDouble(global_PM0430MIN[l]);
global_ma[181] = StringToDouble(global_PM0430MAX[l]);
global_ma[182] = StringToDouble(global_PM0445MIN[l]);
global_ma[183] = StringToDouble(global_PM0445MAX[l]);
void UpdateMacroHighsAndLows(){
//
global_ASIAN_HIGH = findMacroHigh(0, 57, global_ma);
global_ASIAN_LOW = findMacroLow(0, 57, global_ma);
global_TOKYO_HIGH = findMacroHigh(12, 21, global_ma);
global_TOKYO_LOW = findMacroLow(12, 21, global_ma);
global_EU_HIGH = findMacroHigh(56, 121, global_ma);
global_EU_LOW = findMacroLow(56, 121, global_ma);
global_LO_HIGH = findMacroHigh(72, 81, global_ma);
global_LO_LOW = findMacroLow(72, 81, global_ma);
global_USA_HIGH = findMacroHigh(120, 183, global_ma);
global_USA_LOW = findMacroLow(120, 183, global_ma);
global_Sopen_HIGH = findMacroHigh(104, 109, global_ma);
global_Sopen_LOW = findMacroLow(104, 109, global_ma);
global_Premarket_HIGH = findMacroHigh(114, 125, global_ma);
global_Premarket_LOW = findMacroLow(114, 125, global_ma);
global_AM_HIGH = findMacroHigh(124, 145, global_ma);
global_AM_LOW = findMacroLow(124, 145, global_ma);
global_Lunch_HIGH = findMacroHigh(144, 153, global_ma);
global_Lunch_LOW = findMacroLow(144, 153, global_ma);
global_PM_HIGH = findMacroHigh(152, 169, global_ma);
global_PM_LOW = findMacroLow(152, 169, global_ma);
global_LastHour_HIGH = findMacroHigh(168, 177, global_ma);
global_LastHour_LOW = findMacroLow(168, 177, global_ma);
global_DAY_HIGH = findMacroHigh(0, 183, global_ma);
global_DAY_LOW = findMacroLow(0, 183, global_ma);
}
//////-------------- сессионное поведение AM
if(AMOPEN_H > global_EU_HIGH ){ //уже перехай EU
AM_EUContinuationLongs++;
if(global_AM_LOW < global_LO_LOW ){
AM_LONGS_LO_LOW_Seek++;
}
if(global_AM_LOW < global_EU_LOW ){
AM_LONGS_EU_LOW_Seek++;
}
if(global_AM_LOW < global_TOKYO_LOW ){
AM_LONGS_TOKYO_LOW_Seek++;
}
if(global_AM_LOW < global_ASIAN_LOW ){
AM_LONGS_ASIAN_LOW_Seek++;
}
if(global_USA_LOW < global_LO_LOW ){
USA_LONGS_LO_LOW_Seek++;
}
if(global_USA_LOW < global_EU_LOW ){
USA_LONGS_EU_LOW_Seek++;
}
if(global_USA_LOW < global_TOKYO_LOW ){
USA_LONGS_TOKYO_LOW_Seek++;
}
if(global_USA_LOW < global_ASIAN_LOW ){
USA_LONGS_ASIAN_LOW_Seek++;
}
}else if(AMOPEN_L < global_EU_LOW ){ //уже перелой
AM_EUContinuationShorts++;
if(global_AM_HIGH > global_LO_HIGH ){
AM_SHORTS_LO_HIGH_Seek++;
}
if(global_AM_HIGH > global_EU_HIGH ){
AM_SHORTS_EU_HIGH_Seek++;
}
if(global_AM_HIGH > global_TOKYO_HIGH ){
AM_SHORTS_TOKYO_HIGH_Seek++;
}
if(global_AM_HIGH > global_ASIAN_HIGH ){
AM_SHORTS_ASIAN_HIGH_Seek++;
}
if(global_USA_HIGH > global_LO_HIGH ){
USA_SHORTS_LO_HIGH_Seek++;
}
if(global_USA_LOW < global_EU_LOW ){
USA_SHORTS_EU_HIGH_Seek++;
}
if(global_USA_LOW < global_TOKYO_LOW ){
USA_SHORTS_TOKYO_HIGH_Seek++;
}
if(global_USA_LOW < global_ASIAN_LOW ){
USA_SHORTS_ASIAN_HIGH_Seek++;
}
}else{ //тут цена внутри ренжа
AM_EURange++;
// куда придет цена в am
if(global_AM_HIGH > global_EU_HIGH ){
AMEUHighSeek++;
}
if( global_AM_LOW < global_EU_LOW ){
AMEULowSeek++;
}
// как часто снимают обе стороны
if(global_AM_HIGH > global_EU_HIGH && global_AM_LOW < global_EU_LOW){
AMEUDestroy++;
}
// куда придет цена в USA
if(global_USA_HIGH > global_EU_HIGH ){
USAEUHighSeek++;
}
if( global_USA_LOW < global_EU_LOW ){
USAEULowSeek++;
}
// как часто снимают обе стороны
if(global_USA_HIGH > global_EU_HIGH && global_USA_LOW < global_EU_LOW){
USAEUDestroy++;
}
}
// ----- ХАЙ ДНЯ
if(global_ASIAN_HIGH==global_DAY_HIGH) asiaDayHigh++; //в азию
if(global_EU_HIGH==global_DAY_HIGH) euDayHigh++; //в eu
if(global_LO_HIGH==global_DAY_HIGH) loDayHigh++; //в лондон
if(global_Sopen_HIGH==global_DAY_HIGH) SopenDayHigh++; //macro 7-00
if(global_Premarket_HIGH==global_DAY_HIGH) PremarketDayHigh++; //л premarket
if(global_USA_HIGH==global_DAY_HIGH) usaDayHigh++; // ню
if(global_AM_HIGH==global_DAY_HIGH) amDayHigh++; // am
if(global_Lunch_HIGH==global_DAY_HIGH) LunchDayHigh++; // Lunch
if(global_PM_HIGH==global_DAY_HIGH) PMDayHigh++; // PM
if(global_LastHour_HIGH==global_DAY_HIGH) LastHourDayHigh++;// LastHour
// ----- ЛОЙ ДНЯ
if(global_ASIAN_LOW==global_DAY_LOW) asiaDayLow++; //лой дня в азию
if(global_EU_LOW==global_DAY_LOW) euDayLow++; //лой дня в eu
if(global_LO_LOW==global_DAY_LOW) loDayLow++; //лой дня в лондон
if(global_Sopen_LOW==global_DAY_LOW) SopenDayLow++; //лой дня в macro 7-00
if(global_Premarket_LOW==global_DAY_LOW) PremarketDayLow++; //лой дня в premarket
if(global_USA_LOW==global_DAY_LOW) usaDayLow++; //лой дня в ню
if(global_AM_LOW==global_DAY_LOW) amDayLow++; //лой дня в am
if(global_Lunch_LOW==global_DAY_LOW) LunchDayLow++; //лой дня в Lunch
if(global_PM_LOW==global_DAY_LOW) PMDayLow++; //лой дня в PM
if(global_LastHour_LOW==global_DAY_LOW) LastHourDayLow++; //лой дня в LastHo
// ---- DESTROY PD --- PDL+PDH
if(global_DAY_LOW <= global_PERVIOUS_DAY_LOW && global_DAY_HIGH >= global_PERVIOUS_DAY_HIGH) PerviousDayDestroy++;
// ---- RANGE DAY --- no PDL + no PDH
if(global_DAY_LOW > global_PERVIOUS_DAY_LOW && global_DAY_HIGH < global_PERVIOUS_DAY_HIGH) PerviousDayRange++;
// ----- PDL
if(global_DAY_LOW <= global_PERVIOUS_DAY_LOW) PerviousDayLow++; //общий
// ----- PDH
if(global_DAY_HIGH >= global_PERVIOUS_DAY_HIGH) PerviousDayHigh++; //общий
//посещения 1D имба до ньюсов
for(int s=48; s<afterNews; ++s){ // global_ma[48] = StringToDouble(global_AM1200MIN[l]);
if( StringToDouble(global_FVG1DBISIUP[l]) <0 && StringToDouble(global_FVG1DBISIUP[l]) <1 && StringToDouble(global_FVG1DBISIUP[l]) >-1) { if(global_ma[s]!= -1 && global_ma[s] <= StringToDouble(global_FVG1DBISIUP[l]) ) { d1fvg_before_news++; break; } } // BISI 1D
if( StringToDouble(global_FVG1DSIBIDOWN[l]) >0 && StringToDouble(global_FVG1DSIBIDOWN[l]) <1 && StringToDouble(global_FVG1DSIBIDOWN[l]) >-1) { if(global_ma[s]!= -1 && global_ma[s] >= StringToDouble(global_FVG1DSIBIDOWN[l]) ) { d1fvg_before_news ++; break; } } // SIBI 1D
}
// 1D fvg после ньюсов
for(int s=afterNews; s<ArraySize(global_ma); ++s){
if( StringToDouble(global_FVG1DBISIUP[l]) <0 && StringToDouble(global_FVG1DBISIUP[l]) <1 && StringToDouble(global_FVG1DBISIUP[l]) >-1) { if(global_ma[s]!= -1 && global_ma[s] <= StringToDouble(global_FVG1DBISIUP[l]) ) { d1fvg_after_news++; break; } } // BISI 1D
if( StringToDouble(global_FVG1DSIBIDOWN[l]) >0 && StringToDouble(global_FVG1DSIBIDOWN[l]) <1 && StringToDouble(global_FVG1DSIBIDOWN[l]) >-1) { if(global_ma[s]!= -1 && global_ma[s] >= StringToDouble(global_FVG1DSIBIDOWN[l]) ) { d1fvg_after_news ++; break; } } // SIBI 1D
}
//посещения 4h имба до ньюсов
for(int s=48; s<afterNews; ++s){ // global_ma[48] = StringToDouble(global_AM1200MIN[l]);
if( StringToDouble(global_FVG4HBISIUP[l]) <0 && StringToDouble(global_FVG4HBISIUP[l]) <1 && StringToDouble(global_FVG4HBISIUP[l]) >-1) { if(global_ma[s]!= -1 && global_ma[s] <= StringToDouble(global_FVG4HBISIUP[l]) ) { h4fvg_before_news++; break; } } // BISI 4H
if( StringToDouble(global_FVG4HSIBIDOWN[l]) >0 && StringToDouble(global_FVG4HSIBIDOWN[l]) <1 && StringToDouble(global_FVG4HSIBIDOWN[l]) >-1) { if(global_ma[s]!= -1 && global_ma[s] >= StringToDouble(global_FVG4HSIBIDOWN[l]) ) { h4fvg_before_news ++; break; } } // SIBI 4H
}
// 4h fvg после ньюсов
for(int s=afterNews; s<ArraySize(global_ma); ++s){
if( StringToDouble(global_FVG4HBISIUP[l]) <0 && StringToDouble(global_FVG4HBISIUP[l]) <1 && StringToDouble(global_FVG4HBISIUP[l]) >-1) { if(global_ma[s]!= -1 && global_ma[s] <= StringToDouble(global_FVG4HBISIUP[l]) ) { h4fvg_after_news++; break; } } // BISI 4H
if( StringToDouble(global_FVG4HSIBIDOWN[l]) >0 && StringToDouble(global_FVG4HSIBIDOWN[l]) <1 && StringToDouble(global_FVG4HSIBIDOWN[l]) >-1) { if(global_ma[s]!= -1 && global_ma[s] >= StringToDouble(global_FVG4HSIBIDOWN[l]) ) { h4fvg_after_news ++; break; } } // SIBI 4H
}
//посещения 1h имба до ньюсов
for(int s=48; s<afterNews; ++s){ // global_ma[48] = StringToDouble(global_AM1200MIN[l]);
if( StringToDouble(global_FVG1HBISIUP[l]) <0 && StringToDouble(global_FVG1HBISIUP[l]) <1 && StringToDouble(global_FVG1HBISIUP[l]) >-1) { if(global_ma[s]!= -1 && global_ma[s] <= StringToDouble(global_FVG1HBISIUP[l]) ) { h1fvg_before_news++; break; } } // BISI 1H
if( StringToDouble(global_FVG1HSIBIDOWN[l]) >0 && StringToDouble(global_FVG1HSIBIDOWN[l]) <1 && StringToDouble(global_FVG1HSIBIDOWN[l]) >-1) { if(global_ma[s]!= -1 && global_ma[s] >= StringToDouble(global_FVG1HSIBIDOWN[l]) ) { h1fvg_before_news ++; break; } } // SIBI 1H
}
// 1h fvg после ньюсов
for(int s=afterNews; s<ArraySize(global_ma); ++s){
if( StringToDouble(global_FVG1HBISIUP[l]) <0 && StringToDouble(global_FVG1HBISIUP[l]) <1 && StringToDouble(global_FVG1HBISIUP[l]) >-1) { if(global_ma[s]!= -1 && global_ma[s] <= StringToDouble(global_FVG1HBISIUP[l]) ) { h1fvg_after_news++; break; } } // BISI 1H
if( StringToDouble(global_FVG1HSIBIDOWN[l]) >0 && StringToDouble(global_FVG1HSIBIDOWN[l]) <1 && StringToDouble(global_FVG1HSIBIDOWN[l]) >-1) { if(global_ma[s]!= -1 && global_ma[s] >= StringToDouble(global_FVG1HSIBIDOWN[l]) ) { h1fvg_after_news ++; break; } } // SIBI 1H
}
//джудасы м15
if(global_M15MINUS30MDIR[l] != global_M15PLUS30MDIR[l]) reversal_15m_30 ++;
if(global_M15MINUS2HDIR[l] != global_M15PLUS2HDIR[l]) reversal_15m_2h ++;
if(global_M15MINUS4HDIR[l] != global_M15PLUS4HDIR[l]) reversal_15m_4h ++;
//отложенные джудасы
if(global_M15MINUS30MDIR[l] != global_M15PLUS2HDIR[l]) reversal_15m_30m2h ++;
if(global_M15MINUS30MDIR[l] != global_M15PLUS4HDIR[l]) reversal_15m_30m4h ++;
//джудасы h1
if(global_H1MINUS2HDIR[l] != global_H1PLUS2HDIR[l]) reversal_h1_2h ++;
if(global_H1MINUS4HDIR[l] != global_H1PLUS4HDIR[l]) reversal_h1_4h ++;
//отоложенные
if(global_H1MINUS2HDIR[l] != global_H1PLUS4HDIR[l]) reversal_h1_2h4h ++;
//джудасы h4
if(global_H4MINUS4HDIR[l] != global_H4PLUS4HDIR[l]) reversal_h4_4h ++;
//////-------------- сессионное поведение LO
if(LOOPEN_H > global_ASIAN_HIGH ){ //уже перехай азии
LO_asianContinuationLongs++;
//я уже знаю квантили те максимальные таргеты
//хочу понять как часто развернет и побреет
//LO
if(global_LO_LOW < global_TOKYO_LOW ){
LO_LONGS_TOKYO_LOW_Seek++;
}
if(global_LO_LOW < global_ASIAN_LOW ){
LO_LONGS_ASIAN_LOW_Seek++;
}
//EU
if(global_EU_LOW < global_TOKYO_LOW ){
EU_LONGS_TOKYO_LOW_Seek++;
}
if(global_EU_LOW < global_ASIAN_LOW ){
EU_LONGS_ASIAN_LOW_Seek++;
}
}else if(LOOPEN_L < global_ASIAN_LOW ){ //уже перелой азии
LO_asianContinuationShorts++;
//я уже знаю квантили те максимальные таргеты
//хочу понять как часто развернет и побреет
//LO
if(global_LO_HIGH > global_TOKYO_HIGH ){
LO_SHORTS_TOKYO_HIGH_Seek++;
}
if(global_LO_HIGH > global_ASIAN_HIGH ){
LO_SHORTS_ASIAN_HIGH_Seek++;
}
//EU
if(global_EU_HIGH > global_TOKYO_HIGH ){
EU_SHORTS_TOKYO_HIGH_Seek++;
}
if(global_EU_HIGH > global_ASIAN_HIGH ){
EU_SHORTS_ASIAN_HIGH_Seek++;
}
}else{ //тут цена внутри азиатского ренжа
LO_asianRange++;
// куда придет цена в лондон
if(global_LO_HIGH > global_ASIAN_HIGH ){
loAsianHighSeek++;
}
if( global_LO_LOW < global_ASIAN_LOW ){
loAsianLowSeek++;
}
// как часто снимают обе стороны
if(global_LO_HIGH > global_ASIAN_HIGH && global_LO_LOW < global_ASIAN_LOW){
loAsianDestroy++;
}
// куда придет цена в EU
if(global_EU_HIGH > global_ASIAN_HIGH ){
euAsianHighSeek++;
}
if( global_EU_LOW < global_ASIAN_LOW ){
euAsianLowSeek++;
}
// как часто снимают обе стороны
if(global_EU_HIGH > global_ASIAN_HIGH && global_EU_LOW < global_ASIAN_LOW){
euAsianDestroy++;
}
}
// расстояние пройдденное за сессию
EU_movement[l] = (string)MathAbs(global_EU_HIGH-global_EU_LOW);
LO_movement[l] = (string)MathAbs(global_LO_HIGH-global_LO_LOW);
USA_movement[l] = (string)MathAbs(global_USA_HIGH-global_USA_LOW);
AM_movement[l] = (string)MathAbs(global_AM_HIGH-global_AM_LOW);
PM_movement[l] = (string)MathAbs(global_PM_HIGH-global_PM_LOW);
NEWS_movement[l] = (string)MathAbs(global_NEWS_HIGH-global_NEWS_LOW);
q = 0.1;
// double EU_deviation = Quantile(EU_Q, 0.10);
EU_max_movement = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(EU_movement, q)), 2));
LO_max_movement = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(LO_movement, q)), 2));
USA_max_movement = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(USA_movement, q)), 2));
AM_max_movement = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(AM_movement, q)), 2));
PM_max_movement = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(PM_movement, q)), 2));
NEWS_90_max_movement = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(NEWS_movement, q)), 2));
q = 0.4;
NEWS_60_max_movement = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(NEWS_movement, q)), 2));
......
// Функция для нахождения квантили
string Quantile(string &array[], double percentile)
{
// Копируем массив для сортировки и берем модули всех значений
double sorted_array[];
int x =0;
if(ArraySize(array) == 0) { Print(__FUNCTION__, " emty arr "); return "-1"; }
for (int i = 0; i < ArraySize(array); i++)
{
if(StringToDouble(array[i])>-1) {
x = ArraySize(sorted_array)+1;
ArrayResize(sorted_array, x);
sorted_array[ x-1] = MathAbs(StringToDouble(array[i]));
}
}
if(ArraySize(sorted_array) < 1){
ArrayPrint(array);
}
// Сортируем массив
ArraySort(sorted_array);
int index = (int)MathCeil( (1-percentile) * ArraySize(sorted_array)) - 1;
// Возвращаем значение квантиля
return (string)sorted_array[index];
}
// ----- PDL
if(global_ASIAN_LOW < global_PERVIOUS_DAY_LOW) asiaPerviousDayLow++; //аз
if(global_EU_LOW < global_PERVIOUS_DAY_LOW) euPerviousDayLow++;//в eu
if(global_LO_LOW < global_PERVIOUS_DAY_LOW) loPerviousDayLow++; // в лондон
if(global_Sopen_LOW < global_PERVIOUS_DAY_LOW) SopenPerviousDayLow++; //в 7-30
if(global_Premarket_LOW < global_PERVIOUS_DAY_LOW) PremarketPerviousDayLow++; //premarket
if(global_USA_LOW < global_PERVIOUS_DAY_LOW) usaPerviousDayLow++; //в ню
if(global_AM_LOW < global_PERVIOUS_DAY_LOW) amPerviousDayLow++; //в am
if(global_Lunch_LOW < global_PERVIOUS_DAY_LOW) LunchPerviousDayLow++; //в Lunch
if(global_PM_LOW < global_PERVIOUS_DAY_LOW) PMPerviousDayLow++; //в PM
if(global_LastHour_LOW < global_PERVIOUS_DAY_LOW) LastHourPerviousDayLow++; //в LastHour
// ----- PDH
if(global_ASIAN_HIGH > global_PERVIOUS_DAY_HIGH) asiaPerviousDayHigh++; //в азию
if(global_EU_HIGH > global_PERVIOUS_DAY_HIGH) euPerviousDayHigh++; //в eu
if(global_LO_HIGH > global_PERVIOUS_DAY_HIGH) loPerviousDayHigh++; // в лондон
if(global_Sopen_HIGH > global_PERVIOUS_DAY_HIGH) SopenPerviousDayHigh++; //в 7-30
if(global_Premarket_HIGH > global_PERVIOUS_DAY_HIGH) PremarketPerviousDayHigh++; //premark
if(global_USA_HIGH > global_PERVIOUS_DAY_HIGH) usaPerviousDayHigh++; //в ню
if(global_AM_HIGH > global_PERVIOUS_DAY_HIGH) amPerviousDayHigh++; //в am
if(global_Lunch_HIGH > global_PERVIOUS_DAY_HIGH) LunchPerviousDayHigh++; //в Lunch
if(global_PM_HIGH > global_PERVIOUS_DAY_HIGH) PMPerviousDayHigh++; //в PM
if(global_LastHour_HIGH > global_PERVIOUS_DAY_HIGH) LastHourPerviousDayHigh++; //в LastHou
q = 0.1;
updateGlobalQuantiles(q);
QASIA_90 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QASIA, q)), 2));
QTOKYO_90 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QTOKYO, q)), 2));
QEU_90 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QEU, q)), 2));
QLO_90 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QLO, q)), 2));
QSO_90 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QSOPEN, q)), 2));
QPREMARKET_90 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QPREMARKET, q)), 2));
QUSA_90 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QUSA, q)), 2));
QAM_90 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QAM, q)), 2));
QLUNCH_90 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QLUNCH, q)), 2));
QPM_90 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QPM, q)), 2));
QLASTHOUR_90 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QLASTHOUR, q)), 2));
q = 0.4;
updateGlobalQuantiles(q);
QASIA_60 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QASIA, q)), 2));
QTOKYO_60 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QTOKYO, q)), 2));
QEU_60 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QEU, q)), 2));
QLO_60 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QLO, q)), 2));
QSO_60 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QSOPEN, q)), 2));
QPREMARKET_60 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QPREMARKET,q)), 2));
QUSA_60 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QUSA, q)), 2));
QAM_60 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QAM, q)), 2));
QLUNCH_60 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QLUNCH, q)), 2));
QPM_60 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QPM, q)), 2));
QLASTHOUR_60 = (string)NormalizeTPSL(
NormalizeDouble(100 * StringToDouble(Quantile(global_QLASTHOUR, q)), 2));
//дирекшоны
if(global_PD1DDIR[l] != global_ND1DDIR[l]) reversal_1D ++;
if(global_PD4HDIR[l] != global_ND4HDIR[l]) reversal_4H ++;
if(global_PD1HDIR[l] != global_ND1HDIR[l]) reversal_1H ++;
// ------- хай недели
if( FindWeekHigh(IDs[l]) == "Monday") WeekHigh_Monday++;
if( FindWeekHigh(IDs[l]) == "Tuesday") WeekHigh_Tuesday++;
if( FindWeekHigh(IDs[l]) == "Wednesday") WeekHigh_Wednesday++;
if( FindWeekHigh(IDs[l]) == "Thursday") WeekHigh_Thursday++;
if( FindWeekHigh(IDs[l]) == "Friday") WeekHigh_Friday++;
// ------- лой недели
if( FindWeekLow(IDs[l]) == "Monday") WeekLow_Monday++;
if( FindWeekLow(IDs[l]) == "Tuesday") WeekLow_Tuesday++;
if( FindWeekLow(IDs[l]) == "Wednesday") WeekLow_Wednesday++;
if( FindWeekLow(IDs[l]) == "Thursday") WeekLow_Thursday++;
if( FindWeekLow(IDs[l]) == "Friday") WeekLow_Friday++;
The data provided by the BIASMACHINE service is for informational purposes only and does not constitute investment and/or financial advice. The data and figures provided by the service do not guarantee profits in the future or the present.