Price Data Components
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
FanSimple8YZst
#include <stdlib.mqh>
/******************************************************************************/
#property indicator_chart_window
#property indicator_buffers 8
/******************************************************************************/
/******************************************************************************/
/******************************************************************************/
/* Çäåñü ìîæíî èñïðàâèòü çíà÷åíèÿ, ýòè çíà÷åíèÿ èñïîëüçóþòñÿ ïî óìîë÷àíèþ ïðè ïîäêëþ÷åíèè èíäèêàòîðà */
/******************************************************************************/
/******************************************************************************/
/******************************************************************************/
/* Öâåòà íàáîðà ñðåäíèõ (âñòàâ êóðñîðîì íà èìåíè öâåòà, íàæàòü F1 è óâèäåòü èìåíà îñòàëüíûõ öâåòîâ) */
#property indicator_color1 OrangeRed
#property indicator_color2 Yellow
#property indicator_color3 Orange
#property indicator_color4 DodgerBlue
#property indicator_color5 Aqua
#property indicator_color6 Magenta
#property indicator_color7 Gray
#property indicator_color8 Blue // White
/******************************************************************************
Indicator parameters
*/
#define cCURr 12
#define cCURi 20
#define cgTimeFrame 9
extern color cCurrFon =LightSeaGreen;
extern color cCurrActive = Aqua;
extern int gSellLine = 21;
extern int gSellTF = PERIOD_M15;
extern int gBuyLine = 21;
extern int gBuyTF = PERIOD_M15;
extern string sSymbol="";
extern color FanWrongColorST10=Red;
extern color FanWrongColorST20=Tomato;
extern color FanWrongColorST80=Green;
extern color FanWrongColorST100=Lime;
/* Îáùèé ðóáèëüíèê îòîáðàæåíèÿ ïðàâèëüíîñòè âååðà, ïîçâîëÿåò îòðóáèòü ðàçîì îòîáðàæåíèå íàáîðà âñåõ ïåðèîäîâ */
extern bool DisplayFanStatus = true;
/* Îáùèé ðóáèëüíèê îòîáðàæåíèÿ ñðåäíèõ, ïîçâîëÿåò îòðóáèòü ðàçîì îòîáðàæåíèå íàáîðà ñðåäíèõ */
extern bool DisplayFan = true;
/* Çíà÷åíèÿ ïåðèîäîâ íàáîðà timeframe'îâ â ïîðÿäêå ñëåäîâàíèÿ ñëåâà íàïðàâî (âîçìîæíû ïîâòîðåíèÿ, 0-âûå è íåïðàâèëüíûå çíà÷åíèÿ âêëþ÷åíû â íàáîð íå áóäóò) */
extern int Timeframe1 = PERIOD_M1;
extern int Timeframe2 = PERIOD_M5;
extern int Timeframe3 = PERIOD_M15;
extern int Timeframe4 = PERIOD_M30;
extern int Timeframe5 = PERIOD_H1;
extern int Timeframe6 = PERIOD_H4;
extern int Timeframe7 = PERIOD_D1;
extern int Timeframe8 = PERIOD_W1;
extern int Timeframe9 = PERIOD_MN1;
/*
extern int Timeframe1 = PERIOD_M1;
extern int Timeframe2 = PERIOD_M5;
extern int Timeframe3 = PERIOD_M15;
extern int Timeframe4 = PERIOD_H1;
extern int Timeframe5 = PERIOD_H4;
extern int Timeframe6 = PERIOD_D1;
extern int Timeframe7 = 0;
extern int Timeframe8 = 0;
extern int Timeframe9 = 0;
*/
/* Äàòà è âðåìÿ, äëÿ êîòîðîãî èíäèöèðóåòñÿ ïðàâèëüíîñòü âååðà */
static datetime TrackingTime[cCURi]; // = {0,0,0,0,0,0,0,0,0,0,0};
/* Ðèñîâàòü ëè âåðòèêàëüíóþ ëèíèþ ÷åðåç îòñëåæèâàåìûé áàð */
extern bool Tracking = false;
/* Ñäâèãàåì ëè òî÷êó ñëåæåíèÿ ñ îáðàçîâíèåì ñëåäóùåãî áàðà */
extern bool Sliding = true;
/* Èìÿ ôàéëà çâóêà, âîñïðîèçâîäèìîãî ïðè ñäâèãå òî÷êè ñëåæåíèÿ */
extern string SlidingSound = "";
/* Çíà÷åíèÿ ïåðèîäîâ íàáîðà ñðåäíèõ, ñîñòàâëÿþùèõ âååð, ïðàâèëüíîñòü êîòîðîãî îòñëåæèâàåòñÿ (0-âûå è íåïðàâèëüíûå çíà÷åíèÿ âêëþ÷åíû â íàáîð íå áóäóò) */
/*
extern int MA1 = 233;
extern int MA2 = 55;
extern int MA3 = 21;
extern int MA4 = 5;
extern int MA5 = 0;
extern int MA6 = 0;
extern int MA7 = 0;
extern int MA8 = 0;
*/
extern int MA1 = 365;
extern int MA2 = 200;
extern int MA3 = 144;
extern int MA4 = 89;
extern int MA5 = 63;
extern int MA6 = 44;
extern int MA7 = 21;
extern int MA8 = 5;
/* Èíäèâèäóàëüíûé ðóáèëüíèê îòîáðàæåíèÿ íà êàæäóþ ñðåäíþþ */
extern bool DisplayMA1 = true;
extern bool DisplayMA2 = true;
extern bool DisplayMA3 = true;
extern bool DisplayMA4 = true;
extern bool DisplayMA5 = true;
extern bool DisplayMA6 = true;
extern bool DisplayMA7 = true;
extern bool DisplayMA8 = true;
extern string soundFile = "alert.wav";
/* Èìÿ ôîíòà ñèìâîëîâ */
extern string FontName = "Wingdings";
extern string FontNameST = "Times New Roman";
/* Ðàçìåð ñèìâîëîâ */
extern int FontSize = 8;
extern int FontSizeCUR = 8;
extern int FontSizeST = 8;
extern string FontNameCUR = "Times New Roman";
/* Ñèìâîëû íàðèñîâàííîãî è ñò¸ðòîãî óêàçàòåëÿ ïîëîæåíèÿ öåíû îòíîñèòåëüíî âååðà */
extern int PriceOnSymbol = 108; // Circle
extern int PriceOffSymbol = 32; // Space
/* Öâåòà íàðèñîâàííîãî óêàçàòåëÿ ïîëîæåíèÿ öåíû îòíîñèòåëüíî âååðà */
extern color PriceColor = LimeGreen;
/* Ñèìâîëû óêàçàòåëÿ ïðàâèëüíîñòè âååðà */
extern int FanWrongSymbol = 117; // Diamond
extern int FanUpSymbol = 233; // Up Arrow
extern int FanDownSymbol = 234; // Down Arrow
/* Öâåòà óêàçàòåëÿ ïðàâèëüíîñòè âååðà */
extern color FanWrongColor = DarkGray;
extern color FanUpColor = DodgerBlue;
extern color FanDownColor = OrangeRed;
/* Ñìåùåíèå âëåâî (X) è âïðàâî (Y) îò ïðàâîãî âåðõíåãî óãëà */
extern int gX = 10;
extern int gY = 40;
static double MA[cCURi];
static string sCurrency[cCURi];
static double PrevMA[cCURi];
static int WorkCurrency[cCURi];
static int stoxKperiod[cCURi][cgTimeFrame];
static int stoxDperiod[cCURi][cgTimeFrame];
static int stoxSlowing[cCURi][cgTimeFrame];
static int stoxMETOD[cCURi][cgTimeFrame];
static int stoxPrice_field[cCURi][cgTimeFrame];
static int mTimeFrame[9] = {PERIOD_M1,PERIOD_M5,PERIOD_M15,PERIOD_M30,PERIOD_H1,PERIOD_H4,PERIOD_D1,PERIOD_W1,PERIOD_MN1};
static int gCur = cCURr;
// äëÿ äðóãèõ âàëþò øàã ïîêà ôèêñèðîâàí
/******************************************************************************/
/******************************************************************************/
/******************************************************************************/
/******************************************************************************
Tracking vertical line label and color
*/
#define TRACKING_NAME "YZÁàð, îòñëåæèâàåìûé èíäèêàòîðîì FanSimple"
#define TRACKING_COLOR DarkGray
/******************************************************************************/
static string RowName[3] = { "YZÖåíà âûøå âååðà",
"YZÑòàòóñ âååðà",
"YZÖåíà íèæå âååðà" };
static string RowNameST[3] = {"YZm",
"YZs",
"YZíèç" };
/******************************************************************************/
/******************************************************************************/
/******************************************************************************
/*** À âîò ñþäà ëàçèòü óæå íå ñëåäóåò **** À âîò ñþäà ëàçèòü óæå íå ñëåäóåò ***/
/// äîáàâèë íà îäèí ýêðàí 10 âàëþò
/******************************************************************************/
/******************************************************************************/
/******************************************************************************
Type of rendering codes
*/
#define is_down 0
#define is_none 1
#define is_up 2
/******************************************************************************/
static int Timeframe[cgTimeFrame];
static string TimeframeNames[cgTimeFrame];
static int TimeframeInUse[cCURi]; // = {0,0,0,0,0,0,0,0,0,0,0};
/******************************************************************************/
static int MAs[8];
static int Xlat[8];
static int MAsInUse = 0;
/******************************************************************************/
static double MA1Buf[], MA2Buf[], MA3Buf[], MA4Buf[], MA5Buf[], MA6Buf[], MA7Buf[], MA8Buf[];
/******************************************************************************/
string LabelName(int i, int j,string pCur,int iCur)
{
return(pCur+"_"+RowName[j] + "(" + (i + 1) + "): " + TimeframeNames[i]);
}
string LabelNameST(int i, int j,string pCur,int iCur)
{
if (j == 0)
return(pCur+"_stm"+RowNameST[j] + "(" + (i + 1) + "): " + TimeframeNames[i]);
if (j == 1)
return(pCur+"_sts"+RowNameST[j] + "(" + (i + 1) + "): " + TimeframeNames[i]);
}
void UpdatePriceStatusST(int i, int how,string pCur,int iCur, double S, double M)
{
string s = " ";
int PriceColorSTm;
int PriceColorSTs;
PriceColorSTm = DarkGray;
PriceColorSTs = DarkGray;
if (S >= 0 && S <= 5)
PriceColorSTs = OrangeRed; // FanWrongColorST10;
if (M >= 0 && M <= 5)
PriceColorSTm = OrangeRed; // FanWrongColorST10;
if (S >= 6 && S <= 10)
PriceColorSTs = Red;
if (M >= 6 && M <= 10)
PriceColorSTm = Red;
if (S >= 11 && S <= 15)
PriceColorSTs = Crimson;
if (M >= 11 && M <= 15)
PriceColorSTm = Crimson; // FireBrick;
if (S >= 16 && S <= 20)
PriceColorSTs = FireBrick;
if (M >= 16 && M <= 20)
PriceColorSTm = FireBrick;
if (S >= 21 && S <= 25)
PriceColorSTs = Tomato;
if (M >= 21 && M <= 25)
PriceColorSTm = Tomato;
if (S >= 26 && S <= 30)
PriceColorSTs = IndianRed;
if (M >= 26 && M <= 30)
PriceColorSTm = IndianRed;
if (M >= 70 && M <= 74)
PriceColorSTm = Green;
if (S >= 70 && S <= 74)
PriceColorSTs = Green; // LawnGreen
if (M >= 75 && M <= 79)
PriceColorSTm = ForestGreen;
if (S >= 75 && S <= 79)
PriceColorSTs = ForestGreen; // LawnGreen
if (M >= 80 && M <= 84)
PriceColorSTm = MediumSeaGreen;
if (S >= 80 && S <= 84)
PriceColorSTs = MediumSeaGreen; // LawnGreen
if (M >= 85 && M <= 89)
PriceColorSTm = LimeGreen;
if (S >= 85 && S <= 89)
PriceColorSTs = LimeGreen; // LawnGreen
if (M >= 90 && M <= 95)
PriceColorSTm = Chartreuse;
if (S >= 90 && S <= 95)
PriceColorSTs = Chartreuse; // LawnGreen
if (M >= 96 && M <= 100)
PriceColorSTm = Lime;
if ( S >= 96 && S <= 100)
PriceColorSTs = Lime; // LawnGreen
s = DoubleToStr(S,0);
if (S == 0)
s = "00";
ObjectSetText( LabelNameST(i, 0,pCur,iCur) , s , FontSizeST, FontNameST, PriceColorSTs );
s = DoubleToStr(M,0);
if (M == 0)
s = "00";
ObjectSetText( LabelNameST(i, 1,pCur,iCur) , s , FontSizeST, FontNameST, PriceColorSTm );
GlobalVariableSet( LabelNameST(i, 0,pCur,iCur), S ); // ïåðåäàòü äðóãèì îêíàì
GlobalVariableSet( LabelNameST(i, 1,pCur,iCur), M ); // ïåðåäàòü äðóãèì îêíàì
}
/******************************************************************************/
int symcolor[3][2];
int syms[3][2];
/******************************************************************************/
void UpdateFanStatus(int i, int how,string pCur,int iCur)
{
string s = " ";
ObjectSetText(LabelName(i, 1, pCur ,iCur), StringSetChar(s, 0, symcolor[how][0]), FontSize, FontName, symcolor[how][1]);
GlobalVariableSet( LabelName(i, 1, pCur,iCur), symcolor[how][0]); // ïåðåäàòü äðóãèì îêíàì
}
/******************************************************************************/
void UpdatePriceStatus(int i, int how,string pCur,int iCur)
{
string s = " ";
ObjectSetText(LabelName(i, 0,pCur,iCur), StringSetChar(s, 0, syms[how][0]), FontSize, FontName, PriceColor);
ObjectSetText(LabelName(i, 2,pCur,iCur), StringSetChar(s, 0, syms[how][1]), FontSize, FontName, PriceColor);
GlobalVariableSet( LabelName(i, 0,pCur,iCur), syms[how][0] ); // ïåðåäàòü äðóãèì îêíàì
GlobalVariableSet( LabelName(i, 2,pCur,iCur), syms[how][1] ); // ïåðåäàòü äðóãèì îêíàì
}
/******************************************************************************/
void InitTimeframe(int &P[], int PV, int pCur)
{
if(PV != 0)
{
switch(PV)
{
case PERIOD_M1: TimeframeNames[TimeframeInUse[pCur]] = "M1"; break;
case PERIOD_M5: TimeframeNames[TimeframeInUse[pCur]] = "M5"; break;
case PERIOD_M15: TimeframeNames[TimeframeInUse[pCur]] = "M15"; break;
case PERIOD_M30: TimeframeNames[TimeframeInUse[pCur]] = "M30"; break;
case PERIOD_H1: TimeframeNames[TimeframeInUse[pCur]] = "H1"; break;
case PERIOD_H4: TimeframeNames[TimeframeInUse[pCur]] = "H4"; break;
case PERIOD_D1: TimeframeNames[TimeframeInUse[pCur]] = "D1"; break;
case PERIOD_W1: TimeframeNames[TimeframeInUse[pCur]] = "W1"; break;
case PERIOD_MN1: TimeframeNames[TimeframeInUse[pCur]] = "MN1"; break;
default: return;
}
P[ TimeframeInUse[pCur] ] = PV;
TimeframeInUse[pCur]++;
}
}
/******************************************************************************/
void InitMAs(int &P[], int MA)
{
if( MA > 0)
{
P[MAsInUse] = MA;
MAsInUse++;
}
}
/******************************************************************************/
int init()
{
int i, j;
int Y,X;
string sCurr;
int iCur;
/* FOR SVV
GOLD - çîëîòî
EURUSD
GBPUSD
USDCHF
USDJPY
EURJPY --- êðîññû
GBPJPY
GBPCHF
EURGBP
AUDUSD
USDCAD
*/
sCurrency[1] = "EURUSD";
sCurrency[2] = "GBPUSD";
sCurrency[3] = "USDCHF";
sCurrency[4] = "USDJPY";
sCurrency[5] = "EURJPY";
sCurrency[6] = "GBPJPY";
sCurrency[7] = "GBPCHF";
sCurrency[8] = "EURGBP";
sCurrency[9] = "AUDUSD";
sCurrency[10] = "USDCAD";
sCurrency[11] = "AUDJPY";
sCurrency[12] = "GOLD";
Y = gY;
for ( iCur = 1; iCur <= gCur; iCur++)
{
WorkCurrency[ iCur ] = 0;
if ( iCur >= 1 && iCur <= 4 )
WorkCurrency[ iCur ] = 1;
for ( int iTF = 0; iTF <= cgTimeFrame; iTF++)
{
stoxKperiod [iCur][iTF]=21;
stoxDperiod [iCur][iTF]=41;
stoxSlowing [iCur][iTF]=3;
stoxMETOD [iCur][iTF]=MODE_SMA;
stoxPrice_field [iCur][iTF]=MODE_CLOSE;
}
sCurr = sCurrency[iCur];
Y = Y + 70;
if (iCur == 1 )
Y = gY ;
if (iCur == 5 )
Y = gY;
if ( WorkCurrency[ iCur ] == 1 )
{
X = gX + 180;
}
else
{
// if (iCur == 5)
// Y = gY + 80;
X = gX;
}
Print( sCurr + " "+iCur);
///
if(DisplayFanStatus)
{
syms[0][0] = PriceOffSymbol;
syms[0][1] = PriceOnSymbol;
syms[1][0] = PriceOffSymbol;
syms[1][1] = PriceOffSymbol;
syms[2][0] = PriceOnSymbol;
syms[2][1] = PriceOffSymbol;
InitTimeframe(Timeframe, Timeframe1,iCur);
InitTimeframe(Timeframe, Timeframe2,iCur);
InitTimeframe(Timeframe, Timeframe3,iCur);
InitTimeframe(Timeframe, Timeframe4,iCur);
InitTimeframe(Timeframe, Timeframe5,iCur);
InitTimeframe(Timeframe, Timeframe6,iCur);
InitTimeframe(Timeframe, Timeframe7,iCur);
InitTimeframe(Timeframe, Timeframe8,iCur);
InitTimeframe(Timeframe, Timeframe9,iCur);
InitMAs(MAs, MA1);
InitMAs(MAs, MA2);
InitMAs(MAs, MA3);
InitMAs(MAs, MA4);
InitMAs(MAs, MA5);
InitMAs(MAs, MA6);
InitMAs(MAs, MA7);
InitMAs(MAs, MA8);
for(i = 0; i < MAsInUse; i++)
Xlat[i] = i;
for(i = 0; i < MAsInUse - 1; i++)
{
for(j = i + 1; j < MAsInUse; j++)
{
if(MAs[Xlat[i]] > MAs[Xlat[j]])
{
int k = Xlat[j];
Xlat[j] = Xlat[i];
Xlat[i] = k;
}
}
}
for(i = 0; i < TimeframeInUse[iCur]; i++)
{
for(j = 0; j < 3; j++)
{
if ( j != 2)
{
string ss = LabelNameST(i, j, sCurr,iCur);
ObjectCreate(ss, OBJ_LABEL, 0, 0, 0);
ObjectSet(ss, OBJPROP_XDISTANCE, (TimeframeInUse[iCur] - i - 1) * 16 * FontSizeST / 10 + 2 * FontSizeST / 10 + X );
ObjectSet(ss, OBJPROP_YDISTANCE, j * 16 * FontSizeST / 10 + 3 * FontSizeST/ 10 + Y -25);
ObjectSet(ss, OBJPROP_BACK, true);
ObjectSet(ss, OBJPROP_CORNER, 1);
ObjectSetText(ss, " ", FontSizeST, FontNameST, Red); // BLACK
}
string s = LabelName(i, j, sCurr,iCur);
ObjectCreate(sCurr+"_L", OBJ_LABEL, 0, 0, 0);
ObjectSet(sCurr+"_L", OBJPROP_XDISTANCE,10+ (TimeframeInUse[iCur] - i - 1) * 16 * FontSize / 10 + 2 * FontSize / 10 + X + 110 );
ObjectSet(sCurr+"_L", OBJPROP_YDISTANCE, 1 * 16 * FontSize / 10 + 3 * FontSize / 10 +Y-2 );
ObjectSet(sCurr+"_L", OBJPROP_BACK, true);
ObjectSet(sCurr+"_L", OBJPROP_CORNER, 1);
if (Symbol() == sCurr)
ObjectSetText(sCurr+"_L", sCurr, FontSizeCUR, FontNameCUR, cCurrActive );
else
ObjectSetText(sCurr+"_L", sCurr, FontSizeCUR, FontNameCUR, cCurrFon );
ObjectCreate(s, OBJ_LABEL, 0, 0, 0);
ObjectSet(s, OBJPROP_XDISTANCE, (TimeframeInUse[iCur] - i - 1) * 16 * FontSize / 10 + 2 * FontSize / 10 + X);
ObjectSet(s, OBJPROP_YDISTANCE, j * 16 * FontSize / 10 + 3 * FontSize / 10 + Y);
ObjectSet(s, OBJPROP_BACK, true);
ObjectSet(s, OBJPROP_CORNER, 1);
ObjectSetText(s, " ", FontSize, FontName, Black);
}
}
if(Tracking)
{
ObjectCreate(TRACKING_NAME, OBJ_VLINE, 0, TrackingTime, 0);
ObjectSet(TRACKING_NAME, OBJPROP_COLOR, TRACKING_COLOR);
}
}
///
if(DisplayFan)
{
string IndicatorName = sCurr+"FanSimpleYZ(";
symcolor[0][0] = FanDownSymbol;
symcolor[0][1] = FanDownColor;
symcolor[1][0] = FanWrongSymbol;
symcolor[1][1] = FanWrongColor;
symcolor[2][0] = FanUpSymbol;
symcolor[2][1] = FanUpColor;
if(DisplayMA1 && MA1 > 0)
IndicatorName = IndicatorName + MA1;
if(DisplayMA2 && MA2 > 0)
IndicatorName = IndicatorName + ", " + MA2;
if(DisplayMA3 && MA3 > 0)
IndicatorName = IndicatorName + ", " + MA3;
if(DisplayMA4 && MA4 > 0)
IndicatorName = IndicatorName + ", " + MA4;
if(DisplayMA5 && MA5 > 0)
IndicatorName = IndicatorName + ", " + MA5;
if(DisplayMA6 && MA6 > 0)
IndicatorName = IndicatorName + ", " + MA6;
if(DisplayMA7 && MA7 > 0)
IndicatorName = IndicatorName + ", " + MA7;
if(DisplayMA8 && MA8 > 0)
IndicatorName = IndicatorName + ", " + MA8;
IndicatorShortName(IndicatorName + ")");
IndicatorBuffers(8);
SetIndexBuffer(0, MA1Buf);
SetIndexBuffer(1, MA2Buf);
SetIndexBuffer(2, MA3Buf);
SetIndexBuffer(3, MA4Buf);
SetIndexBuffer(4, MA5Buf);
SetIndexBuffer(5, MA6Buf);
SetIndexBuffer(6, MA7Buf);
SetIndexBuffer(7, MA8Buf);
SetIndexLabel(0, sCurr+"_yzÂååð, " + MA1 + "-ÿ ñðåäíÿÿ");
SetIndexLabel(1, sCurr+"_yzÂååð, " + MA2 + "-ÿ ñðåäíÿÿ");
SetIndexLabel(2, sCurr+"_yzÂååð, " + MA3 + "-ÿ ñðåäíÿÿ");
SetIndexLabel(3, sCurr+"_yzÂååð, " + MA4 + "-ÿ ñðåäíÿÿ");
SetIndexLabel(4, sCurr+"_yzÂååð, " + MA5 + "-ÿ ñðåäíÿÿ");
SetIndexLabel(5, sCurr+"_yzÂååð, " + MA6 + "-ÿ ñðåäíÿÿ");
SetIndexLabel(6, sCurr+"_yzÂååð, " + MA7 + "-ÿ ñðåäíÿÿ");
SetIndexLabel(7, sCurr+"_yzÂååð, " + MA8 + "-ÿ ñðåäíÿÿ");
for(i = 0; i < 7; i++)
{
SetIndexStyle(i, DRAW_LINE);
SetIndexEmptyValue(i, 0);
}
ArraySetAsSeries(MA1Buf, true);
ArraySetAsSeries(MA2Buf, true);
ArraySetAsSeries(MA3Buf, true);
ArraySetAsSeries(MA4Buf, true);
ArraySetAsSeries(MA5Buf, true);
ArraySetAsSeries(MA6Buf, true);
ArraySetAsSeries(MA7Buf, true);
ArraySetAsSeries(MA8Buf, true);
for(i = iBars(sCurr, Period()) - 1; i >= 0; i--)
{
MA1Buf[i] = 0;
MA2Buf[i] = 0;
MA3Buf[i] = 0;
MA4Buf[i] = 0;
MA5Buf[i] = 0;
MA6Buf[i] = 0;
MA7Buf[i] = 0;
MA8Buf[i] = 0;
}
}
}
return(0);
}
/******************************************************************************/
int deinit()
{
int iCur;
string sCurr;
for ( iCur = 1; iCur <=gCur; iCur++)
{
sCurr = sCurrency[iCur];
//if (Symbol() == sCurr )
//{
for(int i = 0; i < TimeframeInUse[iCur]; i++)
{
for(int j = 0; j < 3; j++)
{
ObjectDelete(LabelName(i, j, sCurr,iCur ));
ObjectDelete(LabelNameST(i, j, sCurr,iCur ));
ObjectDelete(sCurr+"_L");
GlobalVariableDel( LabelName(i, j, sCurr, iCur) );
}
}
GlobalVariableDel( sCurr+"_YZA" ); // ïåðåäàòü äðóãèì îêíàì
GlobalVariableDel( sCurr+"_YZB" ); // ïåðåäàòü äðóãèì îêíàì
//}
}
if(Tracking)
{
ObjectDelete(TRACKING_NAME);
}
return(0);
}
/******************************************************************************/
int start()
{
int i;
int iCur;
string sCurr;
double mAsk,mBid;
datetime NewTrackingTime[cCURi]; // = TrackingTime;
static datetime time[cCURi]; // = {0,0,0,0,0,0,0,0,0,0,0};
for ( iCur = 1; iCur <= gCur; iCur++ )
{
sCurr = sCurrency[iCur]; //Symbol();
NewTrackingTime[iCur] = TrackingTime[iCur];
mAsk = MarketInfo( sCurr , MODE_ASK);
mBid = MarketInfo( sCurr , MODE_BID);
GlobalVariableSet( sCurr+"_YZA", mAsk ); // ïåðåäàòü äðóãèì îêíàì
GlobalVariableSet( sCurr+"_YZB", mBid ); // ïåðåäàòü äðóãèì îêíàì
if( time[iCur] == 0)
{
if(TrackingTime[iCur] == 0)
TrackingTime[iCur] = iTime(sCurr,Period(),0); // Time[0]; // datetime iTime( string symbol, int timeframe, int shift
i = ((TimeDay(TrackingTime[iCur]) * 24 + TimeHour(TrackingTime[iCur])) * 60 + TimeMinute(TrackingTime[iCur])) * 60 + TimeSeconds(TrackingTime[iCur]);
TrackingTime[iCur] -= i;
i /= 60;
i -= i % Period();
TrackingTime[iCur] += i * 60;
if(Tracking)
ObjectSet(TRACKING_NAME, OBJPROP_TIME1, TrackingTime[iCur]);
else
NewTrackingTime[iCur] = TrackingTime[iCur];
}
if(Tracking)
NewTrackingTime[iCur] = ObjectGet(TRACKING_NAME, OBJPROP_TIME1);
/* Ïîëüçîâàòåëü ñäâèíóë òî÷êó ñëåæåíèÿ èëè òî÷êà ñëåæåíèÿ - ïîñëåäíèé áàð èëè ïîÿâèëñÿ íîâûé áàð */
if(NewTrackingTime[iCur] != TrackingTime[iCur] || (CurTime() - TrackingTime[iCur]) / 60 < Period() || time[iCur] != iTime(sCurr,Period(),0) ) // Time[0])
{
if(DisplayFanStatus)
for(i = 0; i < TimeframeInUse[iCur]; i++)
{
bool Up = true, Down = true;
bool PriceUp = true, PriceDown = true;
int pKperiod = stoxKperiod[iCur][i];
int pDperiod = stoxDperiod[iCur][i];
int pSlowing = stoxSlowing[iCur][i];
int pMETOD = stoxMETOD[iCur][i];
int pPrice_field = stoxPrice_field[iCur][i];
int zTF = mTimeFrame[i];
double tmpSTOXASTIC_SIGNAL = NormalizeDouble( iStochastic( sCurr, zTF , pKperiod, pDperiod, pSlowing, pMETOD, pPrice_field, MODE_SIGNAL, 0),0) ;
double tmpSTOXASTIC_MAIN = NormalizeDouble( iStochastic( sCurr, zTF , pKperiod, pDperiod, pSlowing, pMETOD, pPrice_field, MODE_MAIN , 0),0) ;
// Print(" S "+tmpSTOXASTIC_SIGNAL+" M "+tmpSTOXASTIC_MAIN+" ST cur "+sCurr+" "+iCur+" tf "+i+" [ "+pKperiod+" "+pDperiod+" "+pSlowing+" "+pMETOD+" "+pPrice_field+ " ]");
UpdatePriceStatusST(i, is_up, sCurr,iCur,tmpSTOXASTIC_SIGNAL,tmpSTOXASTIC_MAIN);
int LocalShift = iBarShift(sCurr, Timeframe[i], NewTrackingTime[iCur] + (Period() - 1) * 60);
PrevMA[iCur] = 0;
for(int j = 0; j < MAsInUse; j++)
{
MA[iCur] = iMA(sCurr, Timeframe[i], MAs[Xlat[j]], 0, MODE_EMA, PRICE_CLOSE, LocalShift);
if ( Timeframe[i] == gSellTF )
// Print( NormalizeDouble( MA , Digits ) +" " +Ask +" " +Bid +" " +Timeframe[i]+" " + " "+gBuyTF + " "+MAs[Xlat[j]] + " "+gBuyLine );
if ( ( MA[iCur] >= mAsk && MA[iCur] <= mBid ) && Timeframe[i] == gBuyTF && MAs[Xlat[j]] == gBuyLine ) // öåíà ó ëèíèè íà 15
{
PlaySound(soundFile);
Print(" BUY ");
}
if(j > 0)
{
if (Up && PrevMA[iCur] < MA[iCur])
Up = false;
if(Down && PrevMA[iCur] > MA[iCur])
Down = false;
}
if(PriceUp && MA[iCur] > iClose(sCurr, Timeframe[i], LocalShift))
PriceUp = false;
if(PriceDown && MA[iCur] < iClose(sCurr, Timeframe[i], LocalShift))
PriceDown = false;
PrevMA[iCur] = MA[iCur];
}
if(Up)
UpdateFanStatus(i, is_up, sCurr,iCur);
else
if(Down)
UpdateFanStatus(i, is_down, sCurr,iCur);
else
UpdateFanStatus(i, is_none, sCurr,iCur);
if(PriceUp)
UpdatePriceStatus(i, is_up, sCurr,iCur);
else
if(PriceDown)
UpdatePriceStatus(i, is_down, sCurr,iCur);
else
UpdatePriceStatus(i, is_none, sCurr,iCur);
}
if (Symbol() == sCurr )
{
if(DisplayFan)
{
for(i = iBars(sCurr, Period()) - IndicatorCounted() - 1; i >= 0; i--)
{
if(DisplayMA1 && MA1 > 0)
MA1Buf[i] = iMA(sCurr, 0, MA1, 0, MODE_EMA, PRICE_CLOSE, i);
if(DisplayMA2 && MA2 > 0)
MA2Buf[i] = iMA(sCurr, 0, MA2, 0, MODE_EMA, PRICE_CLOSE, i);
if(DisplayMA3 && MA3 > 0)
MA3Buf[i] = iMA(sCurr, 0, MA3, 0, MODE_EMA, PRICE_CLOSE, i);
if(DisplayMA4 && MA4 > 0)
MA4Buf[i] = iMA(sCurr, 0, MA4, 0, MODE_EMA, PRICE_CLOSE, i);
if(DisplayMA5 && MA5 > 0)
MA5Buf[i] = iMA(sCurr, 0, MA5, 0, MODE_EMA, PRICE_CLOSE, i);
if(DisplayMA6 && MA6 > 0)
MA6Buf[i] = iMA(sCurr, 0, MA6, 0, MODE_EMA, PRICE_CLOSE, i);
if(DisplayMA7 && MA7 > 0)
MA7Buf[i] = iMA(sCurr, 0, MA7, 0, MODE_EMA, PRICE_CLOSE, i);
if(DisplayMA8 && MA8 > 0)
MA8Buf[i] = iMA(sCurr, 0, MA8, 0, MODE_EMA, PRICE_CLOSE, i);
}
}
}
if(time[iCur] != iTime(sCurr,Period(),0) ) // Time[0])
{
if(Sliding && time[iCur] != 0)
// NewTrackingTime += Time[0] - time;
NewTrackingTime[iCur] += iTime(sCurr,Period(),0) - time[iCur];
// time = Time[0];
time[iCur] = iTime(sCurr,Period(),0);
}
if(Tracking && NewTrackingTime[iCur] != TrackingTime[iCur])
ObjectSet(TRACKING_NAME, OBJPROP_TIME1, NewTrackingTime[iCur]);
if(StringLen(SlidingSound) != 0 && NewTrackingTime[iCur] != TrackingTime[iCur])
PlaySound(SlidingSound);
TrackingTime[iCur] = NewTrackingTime[iCur];
}
}
return(0);
}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---