Price Data Components
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
MarketWayMulti
//+------------------------------------------------------------------+
//| Market Way Multi.mq4 |
//| Copyright © 2010, O.Konovalov aka Regul |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010 O.Konovalov"
#property link "E-mail:O_Konovalov@ukr.net"
#property link "E-mail:RegulStar@gmail.com"
#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 SteelBlue
#property indicator_color2 Goldenrod
#property indicator_color3 BlueViolet
#property indicator_color4 YellowGreen
#property indicator_color5 DeepPink
#property indicator_color6 OrangeRed
#property indicator_color7 DarkOliveGreen
#property indicator_color8 MediumPurple
//---- input parameters
extern int IdMain = 12; // main line
extern int IdMulti = 12; // multi line
extern int IdBull = 0; // bull line
extern int IdBear = 0; // bear line
extern int IdArray=12; // all sma line
extern int Pairs=14;//íåîáõîäèìî äëÿ ïðàâèëüíîãî ðàñ÷åòà èíäåêñà, ïðè èçìåíåíèå êîëè÷åñòâà ïàð, ìåíÿåì äàííîå ÷èñëî
extern string Pair1 = "GBPUSD";
extern string Pair2 = "EURGBP";
extern string Pair3 = "GBPJPY";
extern string Pair4 = "USDCHF";
extern string Pair5 = "NZDUSD";
extern string Pair6 = "AUDJPY";
extern string Pair7 = "EURJPY";
extern string Pair8 = "EURUSD";
extern string Pair9 = "USDJPY";
extern string Pair10 = "AUDUSD";
extern string Pair11 = "NZDJPY";
extern string Pair12 = "GBPCHF";
extern string Pair13 = "CHFJPY";
extern string Pair14 = "EURCHF";
//---- buffers
double ExtMapBuffer[];
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- ïàðàìåòðû èíäèêàòîðîâ
SetIndexStyle(0,DRAW_LINE,0,1);
SetIndexBuffer(0,ExtMapBuffer);
SetIndexArrow(0,158);
//---
SetIndexStyle(1,DRAW_LINE,0,1);
SetIndexBuffer(1,ExtMapBuffer1);
SetIndexArrow(1,158);
//---
SetIndexStyle(2,DRAW_LINE,0,2);
SetIndexBuffer(2,ExtMapBuffer2);
SetIndexArrow(2,158);
//---
SetIndexStyle(3,DRAW_LINE,0,1);
SetIndexBuffer(3,ExtMapBuffer3);
//---
SetIndexStyle(4,DRAW_LINE,0,1);
SetIndexBuffer(4,ExtMapBuffer4);
//---
SetIndexStyle(5,DRAW_LINE,0,2);
SetIndexBuffer(5,ExtMapBuffer5);
SetIndexArrow(5,158);
//---
SetIndexStyle(6,DRAW_LINE,0,1);
SetIndexBuffer(6,ExtMapBuffer6);
SetIndexArrow(3,158);
//---
SetIndexStyle(7,DRAW_LINE,0,1);
SetIndexBuffer(7,ExtMapBuffer7);
//--- Íàèìåíîâàíèå èíäèêàòîðà è ïàðàìåòðû çíà÷åíèé íà ýêðàíå
IndicatorShortName("Market Way Multi");
//---
SetIndexLabel(0,"Multi Line");
SetIndexLabel(1,"Multi SMA Line");
SetIndexLabel(2,"Main Line");
SetIndexLabel(3,"Bull Accumulation");
SetIndexLabel(4,"Bear Accumulation");
SetIndexLabel(5,"Main SMA Line");
SetIndexLabel(6,"Bull SMA Line");
SetIndexLabel(7,"Bear SMA Line");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double bull,bear,faster,fast,main,mainmulti,mc,mo;
//----
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
if(counted_bars==0) limit-=1+MathMax(MathMax(IdBull,IdBear),MathMax(IdMain,IdMulti));
int i=limit;
//***********************************************ÁÓÔÅÐÀ ÄËß ÐÀÑ×ÅÒÎÂ**********************************************
while(i>=0)
{
//--- MW2 ÁÓÔÅÐ ÑÓÌÌÀÐÍÀß(Áûêè è Ìåäâåäè) àêêóìóëÿöèÿ íàïðàâëåíèÿ äâèæåíèÿ ðûíêà
//òî æå ÷òî è ïàðà äâóõ IdMain-òè ïåðèîäíûõ (SMA) ðàñ÷èòàíûõ ïî îòêðûòèÿì è çàêðûòèÿì
//ïîëîæèòåëíûå çíà÷åíèÿ óêàçûâàþò íà íàõîæäåíèå SMA îò Close âûøå ÷åì SMA îò Open, îòðèöàòåëüíûå íàîáîðîò!
//Bull's & Bear's accumulation
//However, that and a pair of two IdMain-tee time periods (SMA) is apply for the opening and closing
main=0;
for(int m=0;m<IdMain;m++)
{
main=main+(Close[i+m]-Open[i+m]); //ñóììà ðàçíèöû îòêðûòèÿ è çàêðûòèÿ çà IdMain ïåðèîä
}
ExtMapBuffer2[i]=NormalizeDouble(main/MarketInfo(Symbol(),MODE_POINT),Digits);
//--- MW3 ÁÓÔÅÐ Áû÷üÿ àêêóìóëÿöèÿ íàïðàâëåíèÿ äâèæåíèÿ (òî æå, ÷òî è SÌÀ îò Close)
//çäåñü ðàñ÷èòàíû òîëüêî áû÷üè áàðû è äîæè çà óêàçàíûé ïåðèîä, ò.å. òå, êîòîðûå òâå÷àþò óñëîâèþ Close-Open>=0
//only Bull's bars accumulation
//calculated only bullish & doji bars for the periods IdBull. fulfill the condition (Close-Open>=0).
bull=0;
for(int bu=0;bu<IdBull;bu++)
{
if(Close[i+bu]-Open[i+bu]>=0)
bull=bull+(Close[i+bu]-Open[i+bu]);
}
ExtMapBuffer3[i]=NormalizeDouble(bull/MarketInfo(Symbol(),MODE_POINT),Digits);
//--- MW4 ÁÓÔÅÐ Ìåäâåæüÿ àêêóìóëÿöèÿ íàïðàâëåíèÿ äâèæåíèÿ (òî æå, ÷òî è SÌÀ îò Open)
//çäåñü ðàñ÷èòàíû òîëüêî ìåäâåæüè áàðû è äîæè çà óêàçàíûé ïåðèîä, ò.å. òå, êîòîðûå òâå÷àþò óñëîâèþ Close-Open<=0
//only Bear's bars accumulation
//calculated only bearish & doji bars for the periods IdBear. fulfill the condition (Close-Open<=0).
bear=0;
for(int be=0;be<IdBear;be++)
{
if(Close[i+be]-Open[i+be]<=0)
bear=bear+(Close[i+be]-Open[i+be]);
}
ExtMapBuffer4[i]=NormalizeDouble(bear/MarketInfo(Symbol(),MODE_POINT),Digits);
//--- MW0 Multi ÁÓÔÅÐ ÑÓÌÌÀÐÍÀß(Áûêè è Ìåäâåäè) àêêóìóëÿöèÿ íàïðàâëåíèÿ äâèæåíèÿ ðûíêà
//òî æå ÷òî è ïàðà äâóõ IdMain-òè ïåðèîäíûõ (SMA) ðàñ÷èòàíûõ ïî îòêðûòèÿì è çàêðûòèÿì
//ïîëîæèòåëíûå çíà÷åíèÿ óêàçûâàþò íà íàõîæäåíèå SMA îò Close âûøå ÷åì SMA îò Open, îòðèöàòåëüíûå íàîáîðîò!
//Multi Bull's & Bear's accumulation
//However, that and a pair of two IdMain-tee time periods (SMA) is apply for the opening and closing
mainmulti=0;
for(int mu=0;mu<IdMulti;mu++)
{
mainmulti=mainmulti+((multiclose(Pair1,0,i+mu)-multiopen(Pair1,0,i+mu))+
(multiclose(Pair2,0,i+mu)-multiopen(Pair2,0,i+mu))+
(multiclose(Pair3,0,i+mu)-multiopen(Pair3,0,i+mu))+
(multiclose(Pair4,0,i+mu)-multiopen(Pair4,0,i+mu))+
(multiclose(Pair5,0,i+mu)-multiopen(Pair5,0,i+mu))+
(multiclose(Pair6,0,i+mu)-multiopen(Pair6,0,i+mu))+
(multiclose(Pair7,0,i+mu)-multiopen(Pair7,0,i+mu))+
(multiclose(Pair8,0,i+mu)-multiopen(Pair8,0,i+mu))+
(multiclose(Pair9,0,i+mu)-multiopen(Pair9,0,i+mu))+
(multiclose(Pair10,0,i+mu)-multiopen(Pair10,0,i+mu))+
(multiclose(Pair11,0,i+mu)-multiopen(Pair11,0,i+mu))+
(multiclose(Pair12,0,i+mu)-multiopen(Pair12,0,i+mu))+
(multiclose(Pair13,0,i+mu)-multiopen(Pair13,0,i+mu))+
(multiclose(Pair14,0,i+mu)-multiopen(Pair14,0,i+mu))
);
}
ExtMapBuffer[i]=NormalizeDouble(mainmulti/Pairs,Digits);
i--; //óìåíüøåíèå çíà÷åíèÿ èíäåêñà
}
//----------------------------------------------------- SMA
//--- MW5 ÁÓÔÅÐ SMA îò ÑÓÌÌÀÐÍÎÉ àêêóìóëÿöèè //SMA from MAIN accumalation (Bull's & Bear's bars)
for(i=0; i<limit; i++)
ExtMapBuffer5[i]=NormalizeDouble(iMAOnArray(ExtMapBuffer2,0,IdArray,0,MODE_SMA,i),Digits);
//--- MW6 ÁÓÔÅÐ SMA Áû÷üåé àêêóìóëÿöèè //SMA from Bull accumalation
for(i=0; i<limit; i++)
ExtMapBuffer6[i]=NormalizeDouble(iMAOnArray(ExtMapBuffer3,0,IdArray,0,MODE_SMA,i),Digits);
//--- MW7 ÁÓÔÅÐ SMA Ìåäâåæüåé àêêóìóëÿöèè //SMA from Bear accumalation
for(i=0; i<limit; i++)
ExtMapBuffer7[i]=NormalizeDouble(iMAOnArray(ExtMapBuffer4,0,IdArray,0,MODE_SMA,i),Digits);
//--- MW1 ÁÓÔÅÐ SMA Multi
for(i=0; i<limit; i++)
ExtMapBuffer1[i]=NormalizeDouble(iMAOnArray(ExtMapBuffer,0,IdArray,0,MODE_SMA,i),Digits);
//----
return(0);
}
//+------------------------------------------------------------------+
double multiclose(string c,int tf,int ni)
{
if(StringLen(c)<6) return(0);//ïðîâåðêà íà êîððåêòíîñòü ñèìâîëà
RefreshRates();
double cclose=iClose(c,tf,ni)/MarketInfo(c,MODE_POINT);
return(cclose);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double multiopen(string o,int tf,int ni)
{
if(StringLen(o)<6) return(0);
RefreshRates();
double oopen=iOpen(o,tf,ni)/MarketInfo(o,MODE_POINT);
return(oopen);
}
//+------------------------------------------------------------------+
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
---