dampirs
Местный
- Регистрация
- 19.03.17
- Сообщения
- 118
- Реакции
- 72
dampirs не предоставил никакой дополнительной информации.
Ребята нужно попробовать восстановить четыре индикатора, пробовал через редактор MQL выдает ошибку скорее всего индикаторы старые
//+------------------------------------------------------------------+
//| Amir.mq4 |
//| Copyright Š 2005, Amir |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright Š 2005, Amir"
#property link ""
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//---- input parameters
extern int BoxSize=15;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
int Cur=0;
int KirUp=0;
int KirDn=0;
int kr=0;
int no=0;
double valueh=0;
double valuel=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexLabel(0,"XOUP");
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexLabel(1,"XODOWN");
IndicatorShortName("I-XO-A-H");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int CurrentBar;
double Hi,Lo,Curb;
int counted_bars=IndicatorCounted();
//---- TODO: add your code here
//----Calculation---------------------------
for(int i=0;i<=Bars;i++)
{
CurrentBar=Bars-i;
if (Cur<1)
{
Hi=Close[CurrentBar];
Lo=Close[CurrentBar];
Cur=1;
}
Curb=Close[CurrentBar];
if (Curb>(Hi+BoxSize*Point))
{
Cur+=1;
Hi=Curb;
Lo=Curb-BoxSize*Point;
KirUp=1;
KirDn=0;
kr+=1;
no=0;
}
if (Curb<(Lo-BoxSize*Point))
{
Cur+=1;
Lo=Curb;
Hi=Curb+BoxSize*Point;
KirUp=0;
KirDn=1;
no+=1;
kr=0;
}
valueh=kr;
valuel=0-no;
ExtMapBuffer1[CurrentBar]=valueh;
ExtMapBuffer2[CurrentBar]=valuel;
}
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Heiken Ashi Smoothed.mq4 |
//+------------------------------------------------------------------+
//| mod by Raff |
//+------------------------------------------------------------------+
#property copyright "Copyright Š 2006, Forex-TSD.com "
#property link "MQL5 forum"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 RoyalBlue
#property indicator_color3 Red
#property indicator_color4 RoyalBlue
//---- parameters
extern int MaMetod = 2;
extern int MaPeriod = 4;
extern int MaMetod2 = 2;
extern int MaPeriod2 = 1;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];
//----
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init()
{
//---- indicators
IndicatorBuffers(8);
SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, Red);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, RoyalBlue);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexStyle(2,DRAW_HISTOGRAM, 0, 3, Red);
SetIndexBuffer(2, ExtMapBuffer3);
SetIndexStyle(3,DRAW_HISTOGRAM, 0, 3, RoyalBlue);
SetIndexBuffer(3, ExtMapBuffer4);
//----
SetIndexDrawBegin(0,5);
//---- indicator buffers mapping
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexBuffer(5,ExtMapBuffer6);
SetIndexBuffer(6,ExtMapBuffer7);
SetIndexBuffer(7,ExtMapBuffer8);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double maOpen, maClose, maLow, maHigh;
double haOpen, haHigh, haLow, haClose;
if(Bars<=10) return(0);
ExtCountedBars=IndicatorCounted();
//---- check for possible errors
if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
if (ExtCountedBars>0) ExtCountedBars--;
int pos=Bars-ExtCountedBars-1;
int pos2=pos;
while(pos>=0)
{
maOpen=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_OPEN,pos);
maClose=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_CLOSE,pos);
maLow=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_LOW,pos);
maHigh=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_HIGH,pos);
haOpen=(ExtMapBuffer5[pos+1]+ExtMapBuffer6[pos+1])/2;
haClose=(maOpen+maHigh+maLow+maClose)/4;
haHigh=MathMax(maHigh, MathMax(haOpen, haClose));
haLow=MathMin(maLow, MathMin(haOpen, haClose));
if (haOpen<haClose)
{
ExtMapBuffer7[pos]=haLow;
ExtMapBuffer8[pos]=haHigh;
}
else
{
ExtMapBuffer7[pos]=haHigh;
ExtMapBuffer8[pos]=haLow;
}
ExtMapBuffer5[pos]=haOpen;
ExtMapBuffer6[pos]=haClose;
pos--;
}
int i;
for(i=0; i<pos2; i++) ExtMapBuffer1=iMAOnArray(ExtMapBuffer7,Bars,MaPeriod2,0,MaMetod2,i);
for(i=0; i<pos2; i++) ExtMapBuffer2=iMAOnArray(ExtMapBuffer8,Bars,MaPeriod2,0,MaMetod2,i);
for(i=0; i<pos2; i++) ExtMapBuffer3=iMAOnArray(ExtMapBuffer5,Bars,MaPeriod2,0,MaMetod2,i);
for(i=0; i<pos2; i++) ExtMapBuffer4=iMAOnArray(ExtMapBuffer6,Bars,MaPeriod2,0,MaMetod2,i);
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Basket14.mq4 |
//| Copyright Š 2011, PatPatel |
//| [email protected]|
//+------------------------------------------------------------------+
#property copyright "Copyright Š 2011, PatPatel"
#property link "[email protected]"
#include <WinUser32.mqh>
#property indicator_chart_window
//-------------------------------------------------------------------
extern int NumOfPairs = 14;
extern int MaxBars = 1000;
extern int TF = 1;
string Pair_suffix;
string shortname;
string Pair[14];
double Factor, multiplier[14];
int j, StartBar;
string Currency;
static int ExtHandle=-1;
static int tf = 0;
int MN=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
Pair_suffix=StringTrimLeft(StringTrimRight(StringSubstr(Symbol(),6,StringLen(Symbol())-6)));
Get_Trade_Pairs();
Currency="#kos#"+PadValINT(NumOfPairs,2)+Pair_suffix;
GlobalVariableSet(Currency+"_"+TF+"_Fact",Factor);
for(int kj=0;kj<NumOfPairs;kj++)
{
if(StringSubstr(Pair[kj],3,3)=="JPY") multiplier[kj]=1.0; else multiplier[kj]=100.0;
}
IndicatorShortName(Currency);
if (TF==0) tf = Period();
else tf = TF;
//Create initial file
int version=400;
string c_copyright;
string c_symbol=Currency;
int i_period=tf;
int i_digits=3;
int i_unused[13];
//DNK - indentify
i_unused[0]=3; i_unused[1]=3; i_unused[2]=3;
//----
ExtHandle=FileOpenHistory(c_symbol+i_period+".hst", FILE_BIN|FILE_WRITE);
if(ExtHandle < 0) return(-1);
//---- write history file header
c_copyright="Copyright Š 2011, PatPatel";
FileWriteInteger(ExtHandle, version, LONG_VALUE);
FileWriteString(ExtHandle, c_copyright, 64);
FileWriteString(ExtHandle, c_symbol, 12);
FileWriteInteger(ExtHandle, i_period, LONG_VALUE);
FileWriteInteger(ExtHandle, i_digits, LONG_VALUE);
FileWriteInteger(ExtHandle, 0, LONG_VALUE); //timesign
FileWriteInteger(ExtHandle, 0, LONG_VALUE); //last_sync
FileWriteArray(ExtHandle, i_unused, 0, 13);
FileFlush(ExtHandle);
if(ObjectFind(Currency+shortname+tf)==0)ObjectDelete(Currency+shortname+tf);
return(0);
}
//----
int deinit() {
FileFlush(ExtHandle);
FileClose(ExtHandle);
ObjectDelete (Currency+shortname+tf);
return(0);
}
//####################################################################
//+------------------------------------------------------------------+
//| Main program
//+------------------------------------------------------------------+
static datetime lastbar = 0;
static int last_fpos = 0;
static int hwnd;
static datetime last_time=0;
int start()
{
if (ExtHandle==-1) Print ("Error");
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
StartBar = MaxBars;
if (counted_bars>0) StartBar=Bars-counted_bars;
//---- main loop
for(int i=StartBar; i>=0; i--)
{
if (lastbar < iTime(Symbol(),tf,i))
{
last_fpos=FileTell(ExtHandle);
lastbar=iTime(Symbol(),tf,i);
}
else
{
FileSeek(ExtHandle,last_fpos,SEEK_SET);
}
datetime timebar=iTime(Symbol(),tf,i);
// Change kk to -1300 if HLOC values are less than 0.
double kk=-Factor;
double sum_A_Pair_C=kk;
double sum_A_Pair_H=kk;
double sum_A_Pair_L=kk;
double sum_A_Pair_O=kk;
double sum_A_Pair_V=0.0;
for (j=0;j<NumOfPairs;j++)
{
int shift=iBarShift(Pair[j],tf,timebar);
if (iTime(Pair[j],tf,i)>iTime(Pair[j],tf,shift)) {
shift++;
}
sum_A_Pair_C=sum_A_Pair_C +iClose(Pair[j],tf,shift)*multiplier[j];
sum_A_Pair_H=sum_A_Pair_H + iHigh(Pair[j],tf,shift)*multiplier[j];
sum_A_Pair_L=sum_A_Pair_L + iLow(Pair[j],tf,shift)*multiplier[j];
sum_A_Pair_O=sum_A_Pair_O + iOpen(Pair[j],tf,shift)*multiplier[j];
sum_A_Pair_V=sum_A_Pair_V +iVolume(Pair[j],tf,shift);
}
//Update file with current values
FileWriteInteger(ExtHandle, lastbar, LONG_VALUE);
FileWriteDouble(ExtHandle, sum_A_Pair_O, DOUBLE_VALUE);
FileWriteDouble(ExtHandle, sum_A_Pair_L, DOUBLE_VALUE);
FileWriteDouble(ExtHandle, sum_A_Pair_H, DOUBLE_VALUE);
FileWriteDouble(ExtHandle, sum_A_Pair_C, DOUBLE_VALUE);
FileWriteDouble(ExtHandle, sum_A_Pair_V, DOUBLE_VALUE);
FileFlush(ExtHandle);
}
// Update Basket Chart if Available
if(hwnd==0)
{
hwnd=WindowHandle(Currency,tf);
}
else
{
PostMessageA(hwnd,WM_COMMAND,33324,0);
}
return(0);
}
//+------------------------------------------------------------------+
int Get_Trade_Pairs()
{
switch (NumOfPairs)
{
case 1: Pair[0] = "GBPJPY" + Pair_suffix;
Factor=0.0;
break;
case 2: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURUSD" + Pair_suffix;
Factor=200.0;
break;
case 4: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURJPY" + Pair_suffix;
Pair[2] = "EURUSD" + Pair_suffix;
Pair[3] = "GBPJPY" + Pair_suffix;
Factor=400.0;
break;
case 6: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURJPY" + Pair_suffix;
Pair[2] = "AUDUSD" + Pair_suffix;
Pair[3] = "EURUSD" + Pair_suffix;
Pair[4] = "GBPJPY" + Pair_suffix;
Pair[5] = "NZDUSD" + Pair_suffix;
Factor=600.0;
break;
case 8: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURJPY" + Pair_suffix;
Pair[2] = "AUDUSD" + Pair_suffix;
Pair[3] = "NZDJPY" + Pair_suffix;
Pair[4] = "EURUSD" + Pair_suffix;
Pair[5] = "GBPJPY" + Pair_suffix;
Pair[6] = "NZDUSD" + Pair_suffix;
Pair[7] = "AUDJPY" + Pair_suffix;
Factor=800.0;
break;
case 10: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURGBP" + Pair_suffix;
Pair[2] = "GBPJPY" + Pair_suffix;
Pair[3] = "CADJPY" + Pair_suffix;
Pair[4] = "NZDUSD" + Pair_suffix;
Pair[5] = "EURUSD" + Pair_suffix;
Pair[6] = "USDJPY" + Pair_suffix;
Pair[7] = "AUDUSD" + Pair_suffix;
Pair[8] = "NZDJPY" + Pair_suffix;
Pair[9] = "GBPCHF" + Pair_suffix;
Factor=1000.0;
break;
case 12: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURGBP" + Pair_suffix;
Pair[2] = "GBPJPY" + Pair_suffix;
Pair[3] = "CADJPY" + Pair_suffix;
Pair[4] = "NZDUSD" + Pair_suffix;
Pair[5] = "AUDJPY" + Pair_suffix;
Pair[6] = "EURUSD" + Pair_suffix;
Pair[7] = "USDJPY" + Pair_suffix;
Pair[8] = "AUDUSD" + Pair_suffix;
Pair[9] = "NZDJPY" + Pair_suffix;
Pair[10] = "GBPCHF" + Pair_suffix;
Pair[11] = "CHFJPY" + Pair_suffix;
Factor=1200.0;
break;
case 14: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURGBP" + Pair_suffix;
Pair[2] = "GBPJPY" + Pair_suffix;
Pair[3] = "USDCHF" + Pair_suffix;
Pair[4] = "NZDUSD" + Pair_suffix;
Pair[5] = "AUDJPY" + Pair_suffix;
Pair[6] = "EURJPY" + Pair_suffix;
Pair[7] = "EURUSD" + Pair_suffix;
Pair[8] = "USDJPY" + Pair_suffix;
Pair[9] = "AUDUSD" + Pair_suffix;
Pair[10] = "NZDJPY" + Pair_suffix;
Pair[11] = "GBPCHF" + Pair_suffix;
Pair[12] = "CHFJPY" + Pair_suffix;
Pair[13] = "EURCHF" + Pair_suffix;
Factor=1400.0;
break;
default: break;
}
Currency=Currency+Pair_suffix;
//----
return(0);
}
string PadValINT(int Val, int PadSpc)
{
string S = Val;
while ( StringLen(S) < PadSpc ) S = "0" + S;
return(S);
}
//+------------------------------------------------------------------+
//| MultiPair HAS.mq4 |
//| Copyright Š 2011, John Wustrack |
//| Mofified by GVC 04/12/2012 |
//+------------------------------------------------------------------+
#property copyright "Copyright Š 2011, John Wustrack"
#property link ""
#property indicator_chart_window
#define TitleY 10
#define PairX 10
#define SignalX 100
#define BarsX 160
#define LineStartY 30
#define LineOffY 20
#define Font "Arial"
#define FontSize 12
#define TextColor Yellow
#define BullColor Blue
#define BearColor Red
#define ObjPfx "MP_HAS"
extern string HAS = "----HAS SETTINGS----";
extern int MaMetod = 2;
extern int MaPeriod = 15;
extern int MaMetod2 = 2;
extern int MaPeriod2 = 15;
extern bool AlertOn = true;
extern int MinimumSignalPairs = 9;
string TradePair[14] = {"GBPUSD","GBPJPY","EURJPY","NZDUSD","AUDJPY","USDJPY","NZDJPY","CHFJPY","USDCHF","EURUSD","AUDUSD",
"GBPCHF","EURCHF","EURGBP"};
int NoOfPairs = 14;
datetime LastAlert;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
Create_Title_Line();
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
Delete_Objects();
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
int ld_Signal,li_BullSignal,li_BearSignal;
int OffsetY = LineStartY;
color lc_color;
string ls_arrow;
// For each pair in the array
for (int i=0; i<NoOfPairs; i++)
{
ld_Signal=0;
li_BullSignal=0;
li_BearSignal=0;
{
double HA00=iCustom(TradePair, 0, "Heiken_Ashi_Smoothed",MaMetod,MaPeriod,MaMetod2,MaPeriod2,0,1);
double HA10=iCustom(TradePair, 0, "Heiken_Ashi_Smoothed",MaMetod,MaPeriod,MaMetod2,MaPeriod2,1,1);
double HA20=iCustom(TradePair, 0, "Heiken_Ashi_Smoothed",MaMetod,MaPeriod,MaMetod2,MaPeriod2,2,1);
double HA30=iCustom(TradePair, 0, "Heiken_Ashi_Smoothed",MaMetod,MaPeriod,MaMetod2,MaPeriod,3,1);
if (HA00 < HA10 && HA20 < HA30) ld_Signal=1;
if (HA00 > HA10 && HA20 > HA30) ld_Signal=-1;
}
// Create the pair on the screen
Object_Create(ObjPfx+"Pair"+i,PairX,OffsetY,TradePair,FontSize,Font,TextColor);
{
if (ld_Signal == 1)
{
ls_arrow = CharToStr(233);
lc_color = BullColor;
li_BullSignal++;
}
if (ld_Signal == -1)
{
ls_arrow = CharToStr(234);
lc_color = BearColor;
li_BearSignal++;
}
Object_Create(ObjPfx+"Signal"+i,SignalX,OffsetY,ls_arrow,FontSize,"Wingdings",lc_color);
}
OffsetY += LineOffY;
} //end of pairs loop
// Alerts
if ( li_BullSignal >= MinimumSignalPairs && LastAlert != Time[0])
{
Alert("BUY SIGNAL at ",TimeToStr(Time[0],TIME_DATE|TIME_MINUTES));
LastAlert = Time[0];
}
if ( li_BearSignal >= MinimumSignalPairs && LastAlert != Time[0])
{
Alert("SELL SIGNAL at ",TimeToStr(Time[0],TIME_DATE|TIME_MINUTES));
LastAlert = Time[0];
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| create the title line |
//+------------------------------------------------------------------+
int Create_Title_Line()
{
//----
Object_Create(ObjPfx+"Pair",PairX,TitleY,"Pair",FontSize,Font,TextColor);
Object_Create(ObjPfx+"Signal",SignalX,TitleY,"Has-Signal",FontSize,Font,TextColor);
return(0);
}
//+------------------------------------------------------------------+
//| create screen objects |
//+------------------------------------------------------------------+
void Object_Create(string ps_name,int pi_x,int pi_y,string ps_text=" ",int pi_size=12,
string ps_font="Arial",color pc_colour=CLR_NONE)
{
//----
ObjectCreate(ps_name,OBJ_LABEL,0,0,0,0,0);
ObjectSet(ps_name,OBJPROP_CORNER,0);
ObjectSet(ps_name,OBJPROP_COLOR,pc_colour);
ObjectSet(ps_name,OBJPROP_XDISTANCE,pi_x);
ObjectSet(ps_name,OBJPROP_YDISTANCE,pi_y);
ObjectSetText(ps_name,ps_text,pi_size,ps_font,pc_colour);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Delete the objects |
//+------------------------------------------------------------------+
void Delete_Objects()
{
//----
string ls_Obj.Name;
for (int i=ObjectsTotal()-1; i>=0; i--)
{
ls_Obj.Name=ObjectName(i);
if (StringFind(ls_Obj.Name,ObjPfx)>-1) ObjectDelete(ls_Obj.Name);
}
ObjectsRedraw();
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Amir.mq4 |
//| Copyright Š 2005, Amir |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright Š 2005, Amir"
#property link ""
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//---- input parameters
extern int BoxSize=15;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
int Cur=0;
int KirUp=0;
int KirDn=0;
int kr=0;
int no=0;
double valueh=0;
double valuel=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexLabel(0,"XOUP");
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexLabel(1,"XODOWN");
IndicatorShortName("I-XO-A-H");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int CurrentBar;
double Hi,Lo,Curb;
int counted_bars=IndicatorCounted();
//---- TODO: add your code here
//----Calculation---------------------------
for(int i=0;i<=Bars;i++)
{
CurrentBar=Bars-i;
if (Cur<1)
{
Hi=Close[CurrentBar];
Lo=Close[CurrentBar];
Cur=1;
}
Curb=Close[CurrentBar];
if (Curb>(Hi+BoxSize*Point))
{
Cur+=1;
Hi=Curb;
Lo=Curb-BoxSize*Point;
KirUp=1;
KirDn=0;
kr+=1;
no=0;
}
if (Curb<(Lo-BoxSize*Point))
{
Cur+=1;
Lo=Curb;
Hi=Curb+BoxSize*Point;
KirUp=0;
KirDn=1;
no+=1;
kr=0;
}
valueh=kr;
valuel=0-no;
ExtMapBuffer1[CurrentBar]=valueh;
ExtMapBuffer2[CurrentBar]=valuel;
}
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Heiken Ashi Smoothed.mq4 |
//+------------------------------------------------------------------+
//| mod by Raff |
//+------------------------------------------------------------------+
#property copyright "Copyright Š 2006, Forex-TSD.com "
#property link "MQL5 forum"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 RoyalBlue
#property indicator_color3 Red
#property indicator_color4 RoyalBlue
//---- parameters
extern int MaMetod = 2;
extern int MaPeriod = 4;
extern int MaMetod2 = 2;
extern int MaPeriod2 = 1;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];
//----
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init()
{
//---- indicators
IndicatorBuffers(8);
SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, Red);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, RoyalBlue);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexStyle(2,DRAW_HISTOGRAM, 0, 3, Red);
SetIndexBuffer(2, ExtMapBuffer3);
SetIndexStyle(3,DRAW_HISTOGRAM, 0, 3, RoyalBlue);
SetIndexBuffer(3, ExtMapBuffer4);
//----
SetIndexDrawBegin(0,5);
//---- indicator buffers mapping
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexBuffer(5,ExtMapBuffer6);
SetIndexBuffer(6,ExtMapBuffer7);
SetIndexBuffer(7,ExtMapBuffer8);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double maOpen, maClose, maLow, maHigh;
double haOpen, haHigh, haLow, haClose;
if(Bars<=10) return(0);
ExtCountedBars=IndicatorCounted();
//---- check for possible errors
if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
if (ExtCountedBars>0) ExtCountedBars--;
int pos=Bars-ExtCountedBars-1;
int pos2=pos;
while(pos>=0)
{
maOpen=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_OPEN,pos);
maClose=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_CLOSE,pos);
maLow=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_LOW,pos);
maHigh=iMA(NULL,0,MaPeriod,0,MaMetod,MODE_HIGH,pos);
haOpen=(ExtMapBuffer5[pos+1]+ExtMapBuffer6[pos+1])/2;
haClose=(maOpen+maHigh+maLow+maClose)/4;
haHigh=MathMax(maHigh, MathMax(haOpen, haClose));
haLow=MathMin(maLow, MathMin(haOpen, haClose));
if (haOpen<haClose)
{
ExtMapBuffer7[pos]=haLow;
ExtMapBuffer8[pos]=haHigh;
}
else
{
ExtMapBuffer7[pos]=haHigh;
ExtMapBuffer8[pos]=haLow;
}
ExtMapBuffer5[pos]=haOpen;
ExtMapBuffer6[pos]=haClose;
pos--;
}
int i;
for(i=0; i<pos2; i++) ExtMapBuffer1=iMAOnArray(ExtMapBuffer7,Bars,MaPeriod2,0,MaMetod2,i);
for(i=0; i<pos2; i++) ExtMapBuffer2=iMAOnArray(ExtMapBuffer8,Bars,MaPeriod2,0,MaMetod2,i);
for(i=0; i<pos2; i++) ExtMapBuffer3=iMAOnArray(ExtMapBuffer5,Bars,MaPeriod2,0,MaMetod2,i);
for(i=0; i<pos2; i++) ExtMapBuffer4=iMAOnArray(ExtMapBuffer6,Bars,MaPeriod2,0,MaMetod2,i);
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Basket14.mq4 |
//| Copyright Š 2011, PatPatel |
//| [email protected]|
//+------------------------------------------------------------------+
#property copyright "Copyright Š 2011, PatPatel"
#property link "[email protected]"
#include <WinUser32.mqh>
#property indicator_chart_window
//-------------------------------------------------------------------
extern int NumOfPairs = 14;
extern int MaxBars = 1000;
extern int TF = 1;
string Pair_suffix;
string shortname;
string Pair[14];
double Factor, multiplier[14];
int j, StartBar;
string Currency;
static int ExtHandle=-1;
static int tf = 0;
int MN=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
Pair_suffix=StringTrimLeft(StringTrimRight(StringSubstr(Symbol(),6,StringLen(Symbol())-6)));
Get_Trade_Pairs();
Currency="#kos#"+PadValINT(NumOfPairs,2)+Pair_suffix;
GlobalVariableSet(Currency+"_"+TF+"_Fact",Factor);
for(int kj=0;kj<NumOfPairs;kj++)
{
if(StringSubstr(Pair[kj],3,3)=="JPY") multiplier[kj]=1.0; else multiplier[kj]=100.0;
}
IndicatorShortName(Currency);
if (TF==0) tf = Period();
else tf = TF;
//Create initial file
int version=400;
string c_copyright;
string c_symbol=Currency;
int i_period=tf;
int i_digits=3;
int i_unused[13];
//DNK - indentify
i_unused[0]=3; i_unused[1]=3; i_unused[2]=3;
//----
ExtHandle=FileOpenHistory(c_symbol+i_period+".hst", FILE_BIN|FILE_WRITE);
if(ExtHandle < 0) return(-1);
//---- write history file header
c_copyright="Copyright Š 2011, PatPatel";
FileWriteInteger(ExtHandle, version, LONG_VALUE);
FileWriteString(ExtHandle, c_copyright, 64);
FileWriteString(ExtHandle, c_symbol, 12);
FileWriteInteger(ExtHandle, i_period, LONG_VALUE);
FileWriteInteger(ExtHandle, i_digits, LONG_VALUE);
FileWriteInteger(ExtHandle, 0, LONG_VALUE); //timesign
FileWriteInteger(ExtHandle, 0, LONG_VALUE); //last_sync
FileWriteArray(ExtHandle, i_unused, 0, 13);
FileFlush(ExtHandle);
if(ObjectFind(Currency+shortname+tf)==0)ObjectDelete(Currency+shortname+tf);
return(0);
}
//----
int deinit() {
FileFlush(ExtHandle);
FileClose(ExtHandle);
ObjectDelete (Currency+shortname+tf);
return(0);
}
//####################################################################
//+------------------------------------------------------------------+
//| Main program
//+------------------------------------------------------------------+
static datetime lastbar = 0;
static int last_fpos = 0;
static int hwnd;
static datetime last_time=0;
int start()
{
if (ExtHandle==-1) Print ("Error");
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
StartBar = MaxBars;
if (counted_bars>0) StartBar=Bars-counted_bars;
//---- main loop
for(int i=StartBar; i>=0; i--)
{
if (lastbar < iTime(Symbol(),tf,i))
{
last_fpos=FileTell(ExtHandle);
lastbar=iTime(Symbol(),tf,i);
}
else
{
FileSeek(ExtHandle,last_fpos,SEEK_SET);
}
datetime timebar=iTime(Symbol(),tf,i);
// Change kk to -1300 if HLOC values are less than 0.
double kk=-Factor;
double sum_A_Pair_C=kk;
double sum_A_Pair_H=kk;
double sum_A_Pair_L=kk;
double sum_A_Pair_O=kk;
double sum_A_Pair_V=0.0;
for (j=0;j<NumOfPairs;j++)
{
int shift=iBarShift(Pair[j],tf,timebar);
if (iTime(Pair[j],tf,i)>iTime(Pair[j],tf,shift)) {
shift++;
}
sum_A_Pair_C=sum_A_Pair_C +iClose(Pair[j],tf,shift)*multiplier[j];
sum_A_Pair_H=sum_A_Pair_H + iHigh(Pair[j],tf,shift)*multiplier[j];
sum_A_Pair_L=sum_A_Pair_L + iLow(Pair[j],tf,shift)*multiplier[j];
sum_A_Pair_O=sum_A_Pair_O + iOpen(Pair[j],tf,shift)*multiplier[j];
sum_A_Pair_V=sum_A_Pair_V +iVolume(Pair[j],tf,shift);
}
//Update file with current values
FileWriteInteger(ExtHandle, lastbar, LONG_VALUE);
FileWriteDouble(ExtHandle, sum_A_Pair_O, DOUBLE_VALUE);
FileWriteDouble(ExtHandle, sum_A_Pair_L, DOUBLE_VALUE);
FileWriteDouble(ExtHandle, sum_A_Pair_H, DOUBLE_VALUE);
FileWriteDouble(ExtHandle, sum_A_Pair_C, DOUBLE_VALUE);
FileWriteDouble(ExtHandle, sum_A_Pair_V, DOUBLE_VALUE);
FileFlush(ExtHandle);
}
// Update Basket Chart if Available
if(hwnd==0)
{
hwnd=WindowHandle(Currency,tf);
}
else
{
PostMessageA(hwnd,WM_COMMAND,33324,0);
}
return(0);
}
//+------------------------------------------------------------------+
int Get_Trade_Pairs()
{
switch (NumOfPairs)
{
case 1: Pair[0] = "GBPJPY" + Pair_suffix;
Factor=0.0;
break;
case 2: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURUSD" + Pair_suffix;
Factor=200.0;
break;
case 4: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURJPY" + Pair_suffix;
Pair[2] = "EURUSD" + Pair_suffix;
Pair[3] = "GBPJPY" + Pair_suffix;
Factor=400.0;
break;
case 6: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURJPY" + Pair_suffix;
Pair[2] = "AUDUSD" + Pair_suffix;
Pair[3] = "EURUSD" + Pair_suffix;
Pair[4] = "GBPJPY" + Pair_suffix;
Pair[5] = "NZDUSD" + Pair_suffix;
Factor=600.0;
break;
case 8: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURJPY" + Pair_suffix;
Pair[2] = "AUDUSD" + Pair_suffix;
Pair[3] = "NZDJPY" + Pair_suffix;
Pair[4] = "EURUSD" + Pair_suffix;
Pair[5] = "GBPJPY" + Pair_suffix;
Pair[6] = "NZDUSD" + Pair_suffix;
Pair[7] = "AUDJPY" + Pair_suffix;
Factor=800.0;
break;
case 10: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURGBP" + Pair_suffix;
Pair[2] = "GBPJPY" + Pair_suffix;
Pair[3] = "CADJPY" + Pair_suffix;
Pair[4] = "NZDUSD" + Pair_suffix;
Pair[5] = "EURUSD" + Pair_suffix;
Pair[6] = "USDJPY" + Pair_suffix;
Pair[7] = "AUDUSD" + Pair_suffix;
Pair[8] = "NZDJPY" + Pair_suffix;
Pair[9] = "GBPCHF" + Pair_suffix;
Factor=1000.0;
break;
case 12: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURGBP" + Pair_suffix;
Pair[2] = "GBPJPY" + Pair_suffix;
Pair[3] = "CADJPY" + Pair_suffix;
Pair[4] = "NZDUSD" + Pair_suffix;
Pair[5] = "AUDJPY" + Pair_suffix;
Pair[6] = "EURUSD" + Pair_suffix;
Pair[7] = "USDJPY" + Pair_suffix;
Pair[8] = "AUDUSD" + Pair_suffix;
Pair[9] = "NZDJPY" + Pair_suffix;
Pair[10] = "GBPCHF" + Pair_suffix;
Pair[11] = "CHFJPY" + Pair_suffix;
Factor=1200.0;
break;
case 14: Pair[0] = "GBPUSD" + Pair_suffix;
Pair[1] = "EURGBP" + Pair_suffix;
Pair[2] = "GBPJPY" + Pair_suffix;
Pair[3] = "USDCHF" + Pair_suffix;
Pair[4] = "NZDUSD" + Pair_suffix;
Pair[5] = "AUDJPY" + Pair_suffix;
Pair[6] = "EURJPY" + Pair_suffix;
Pair[7] = "EURUSD" + Pair_suffix;
Pair[8] = "USDJPY" + Pair_suffix;
Pair[9] = "AUDUSD" + Pair_suffix;
Pair[10] = "NZDJPY" + Pair_suffix;
Pair[11] = "GBPCHF" + Pair_suffix;
Pair[12] = "CHFJPY" + Pair_suffix;
Pair[13] = "EURCHF" + Pair_suffix;
Factor=1400.0;
break;
default: break;
}
Currency=Currency+Pair_suffix;
//----
return(0);
}
string PadValINT(int Val, int PadSpc)
{
string S = Val;
while ( StringLen(S) < PadSpc ) S = "0" + S;
return(S);
}
//+------------------------------------------------------------------+
//| MultiPair HAS.mq4 |
//| Copyright Š 2011, John Wustrack |
//| Mofified by GVC 04/12/2012 |
//+------------------------------------------------------------------+
#property copyright "Copyright Š 2011, John Wustrack"
#property link ""
#property indicator_chart_window
#define TitleY 10
#define PairX 10
#define SignalX 100
#define BarsX 160
#define LineStartY 30
#define LineOffY 20
#define Font "Arial"
#define FontSize 12
#define TextColor Yellow
#define BullColor Blue
#define BearColor Red
#define ObjPfx "MP_HAS"
extern string HAS = "----HAS SETTINGS----";
extern int MaMetod = 2;
extern int MaPeriod = 15;
extern int MaMetod2 = 2;
extern int MaPeriod2 = 15;
extern bool AlertOn = true;
extern int MinimumSignalPairs = 9;
string TradePair[14] = {"GBPUSD","GBPJPY","EURJPY","NZDUSD","AUDJPY","USDJPY","NZDJPY","CHFJPY","USDCHF","EURUSD","AUDUSD",
"GBPCHF","EURCHF","EURGBP"};
int NoOfPairs = 14;
datetime LastAlert;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
Create_Title_Line();
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
Delete_Objects();
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
int ld_Signal,li_BullSignal,li_BearSignal;
int OffsetY = LineStartY;
color lc_color;
string ls_arrow;
// For each pair in the array
for (int i=0; i<NoOfPairs; i++)
{
ld_Signal=0;
li_BullSignal=0;
li_BearSignal=0;
{
double HA00=iCustom(TradePair, 0, "Heiken_Ashi_Smoothed",MaMetod,MaPeriod,MaMetod2,MaPeriod2,0,1);
double HA10=iCustom(TradePair, 0, "Heiken_Ashi_Smoothed",MaMetod,MaPeriod,MaMetod2,MaPeriod2,1,1);
double HA20=iCustom(TradePair, 0, "Heiken_Ashi_Smoothed",MaMetod,MaPeriod,MaMetod2,MaPeriod2,2,1);
double HA30=iCustom(TradePair, 0, "Heiken_Ashi_Smoothed",MaMetod,MaPeriod,MaMetod2,MaPeriod,3,1);
if (HA00 < HA10 && HA20 < HA30) ld_Signal=1;
if (HA00 > HA10 && HA20 > HA30) ld_Signal=-1;
}
// Create the pair on the screen
Object_Create(ObjPfx+"Pair"+i,PairX,OffsetY,TradePair,FontSize,Font,TextColor);
{
if (ld_Signal == 1)
{
ls_arrow = CharToStr(233);
lc_color = BullColor;
li_BullSignal++;
}
if (ld_Signal == -1)
{
ls_arrow = CharToStr(234);
lc_color = BearColor;
li_BearSignal++;
}
Object_Create(ObjPfx+"Signal"+i,SignalX,OffsetY,ls_arrow,FontSize,"Wingdings",lc_color);
}
OffsetY += LineOffY;
} //end of pairs loop
// Alerts
if ( li_BullSignal >= MinimumSignalPairs && LastAlert != Time[0])
{
Alert("BUY SIGNAL at ",TimeToStr(Time[0],TIME_DATE|TIME_MINUTES));
LastAlert = Time[0];
}
if ( li_BearSignal >= MinimumSignalPairs && LastAlert != Time[0])
{
Alert("SELL SIGNAL at ",TimeToStr(Time[0],TIME_DATE|TIME_MINUTES));
LastAlert = Time[0];
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| create the title line |
//+------------------------------------------------------------------+
int Create_Title_Line()
{
//----
Object_Create(ObjPfx+"Pair",PairX,TitleY,"Pair",FontSize,Font,TextColor);
Object_Create(ObjPfx+"Signal",SignalX,TitleY,"Has-Signal",FontSize,Font,TextColor);
return(0);
}
//+------------------------------------------------------------------+
//| create screen objects |
//+------------------------------------------------------------------+
void Object_Create(string ps_name,int pi_x,int pi_y,string ps_text=" ",int pi_size=12,
string ps_font="Arial",color pc_colour=CLR_NONE)
{
//----
ObjectCreate(ps_name,OBJ_LABEL,0,0,0,0,0);
ObjectSet(ps_name,OBJPROP_CORNER,0);
ObjectSet(ps_name,OBJPROP_COLOR,pc_colour);
ObjectSet(ps_name,OBJPROP_XDISTANCE,pi_x);
ObjectSet(ps_name,OBJPROP_YDISTANCE,pi_y);
ObjectSetText(ps_name,ps_text,pi_size,ps_font,pc_colour);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Delete the objects |
//+------------------------------------------------------------------+
void Delete_Objects()
{
//----
string ls_Obj.Name;
for (int i=ObjectsTotal()-1; i>=0; i--)
{
ls_Obj.Name=ObjectName(i);
if (StringFind(ls_Obj.Name,ObjPfx)>-1) ObjectDelete(ls_Obj.Name);
}
ObjectsRedraw();
//----
return(0);
}
//+------------------------------------------------------------------+