//+——————————————————————+
//| Forex_goile_mod_W.mq4 |
//| Copyright 2017, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+——————————————————————+
#property copyright “Copyright © 2010, FOREX GOILER INDICATOR”
#property link “”
#property indicator_chart_window
extern int CountDays =1;
extern int Font_Size = 9;
extern int Corner = 3;
extern bool Show_Calc = TRUE;
extern int width=2;
extern int style=0;
double ny_close[];
int ny_shift[];
datetime ny_time[];
datetime time1;
datetime time2;
int shift, num;
datetime prevDay=0;
bool fTime;
int init() {
fTime = true;
IndicatorBuffers(1);
SetIndexBuffer(0,ny_close);
//IndicatorShortName(“HAMADASALAM_v1.5”);
//ObjectsDeleteAll(0, OBJ_LABEL);
return (0);
}
int deinit() {
ObjDel();
return (0);
}
//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start()
{
int counted_bars=IndicatorCounted();
//—-
double Today_Open_Price=0;
double Price_Angle=0;
double Correction_V=0;
double Correction_V1=0;
double Correction_V2=0;
double Corrected_price_angle=0;
double Corrected_price_angle1=0;
double Corrected_price_angle2=0;
double Factor_no=0;
double Factor_no1=0;
double Factor_no2=0;
int xxx = 100;
int digits;
if (StringFind(Symbol(), “JPY”, 0) == -1) xxx = 10000;
if (MarketInfo(Symbol(), MODE_DIGITS) == 5 || MarketInfo(Symbol(), MODE_DIGITS) == 4)
digits = 4;
if (MarketInfo(Symbol(), MODE_DIGITS) == 3 || MarketInfo(Symbol(), MODE_DIGITS) == 2)
digits = 2;
datetime cDay = iTime(NULL,PERIOD_W1,0);
if (cDay != prevDay || fTime)
{
//***
ObjDel();
ArrayResize(ny_time,CountDays+1);
for (shift=0;shift<=CountDays;shift++)
{
ny_time[shift] = iTime(NULL,PERIOD_W1,shift);
ny_close[shift] = iOpen(NULL,PERIOD_W1,shift)*xxx;
}
//***
for (shift=0;shift<=CountDays-1;shift++)
{
//Today_Open_Price = iOpen(Symbol(), PERIOD_D1, 0)*xxx;
Price_Angle = MathMod(((MathSqrt(ny_close[shift])*180) -225), 360);
time1 = ny_time[shift];
if (shift==0)
time2 = ny_time[shift] + 168*3600;
else
time2 = ny_time[shift-1];
if (Price_Angle >= 90)
{
Correction_V1 = NormalizeDouble ((Price_Angle/90),0);
Corrected_price_angle1 = (Price_Angle/Correction_V1);
Factor_no1 = Corrected_price_angle1/180;
Correction_V = Correction_V1;
Corrected_price_angle = Corrected_price_angle1 ;
Factor_no = Factor_no1;
}
else
{
Correction_V2 = NormalizeDouble ((90/Price_Angle),0);
Corrected_price_angle2 = (Price_Angle * Correction_V2);
Factor_no2 = Corrected_price_angle2/180;
Correction_V=Correction_V2 ;
Corrected_price_angle =Corrected_price_angle2 ;
Factor_no=Factor_no2;
}
double Entry,Entry2,TP1,TP2,SL;
double MathS_OP = MathSqrt(ny_close[shift]);
//*
if(Price_Angle >=0 && Price_Angle<=90)
{
Entry = (ny_close[shift]/xxx);
Entry2 =((MathS_OP – (Factor_no/2))* (MathS_OP – (Factor_no/2)))/xxx;
TP1 = ((MathS_OP + (Factor_no/2))*(MathS_OP + (Factor_no/2)))/xxx;
TP2 = ((MathS_OP + Factor_no)*(MathS_OP + Factor_no))/xxx;
SL = ((MathS_OP – Factor_no)*(MathS_OP – Factor_no))/xxx;
PlotLine(“вход[“+shift+”]”,Entry,White) ;
PlotLine(“добавка[“+shift+”]”,Entry2,Orange);
PlotLine(“тейк[“+shift+”]”,TP1,Lime);
PlotLine(“тейк_2[“+shift+”]”,TP2,DodgerBlue);
PlotLine(“стоп[“+shift+”]”,SL,Red);
}
//*
if(Price_Angle >=180 && Price_Angle<=270)
{
Entry = (ny_close[shift]/xxx);
Entry2 =((MathS_OP – (Factor_no/2))* (MathS_OP – (Factor_no/2)))/xxx;
TP1 = ((MathS_OP + (Factor_no/2))*(MathS_OP + (Factor_no/2)))/xxx;
TP2 = ((MathS_OP + Factor_no)*(MathS_OP + Factor_no))/xxx;
SL = ((MathS_OP – Factor_no)*(MathS_OP – Factor_no))/xxx;
PlotLine(“вход[“+shift+”]”,Entry,White) ;
PlotLine(“добавка[“+shift+”]”,Entry2,Orange);
PlotLine(“тейк[“+shift+”]”,TP1,Lime);
PlotLine(“тейк_2[“+shift+”]”,TP2,DodgerBlue);
PlotLine(“стоп[“+shift+”]”,SL,Red);
}
//*
if(Price_Angle >=91 && Price_Angle<180)
{
Entry = ny_close[shift]/xxx;
Entry2 =((MathS_OP + (Factor_no/2))* (MathS_OP + (Factor_no/2)))/xxx;
TP1 = ((MathS_OP – (Factor_no/2))*(MathS_OP -(Factor_no/2)))/xxx;
TP2 = ((MathS_OP – Factor_no)*(MathS_OP – Factor_no))/xxx;
SL = ((MathS_OP + Factor_no)*(MathS_OP + Factor_no))/xxx;
PlotLine(“вход[“+shift+”]”,Entry,White) ;
PlotLine(“добавка[“+shift+”]”,Entry2,Orange);
PlotLine(“тейк[“+shift+”]”,TP1,Lime);
PlotLine(“тейк_2[“+shift+”]”,TP2,DodgerBlue);
PlotLine(“стоп[“+shift+”]”,SL,Red);
}
//*
if(Price_Angle >=271 && Price_Angle<=360)
{
Entry = ny_close[shift]/xxx;
Entry2 =((MathS_OP + (Factor_no/2))* (MathS_OP + (Factor_no/2)))/xxx;
TP1 = ((MathS_OP – (Factor_no/2))*(MathS_OP -(Factor_no/2)))/xxx;
TP2 = ((MathS_OP – Factor_no)*(MathS_OP – Factor_no))/xxx;
SL = ((MathS_OP + Factor_no)*(MathS_OP + Factor_no))/xxx;
PlotLine(“вход[“+shift+”]”,Entry,White) ;
PlotLine(“добавка[“+shift+”]”,Entry2,Orange);
PlotLine(“тейк[“+shift+”]”,TP1,Lime);
PlotLine(“тейк_2[“+shift+”]”,TP2,DodgerBlue);
PlotLine(“стоп[“+shift+”]”,SL,Red);
}
if (shift==0)
{
string EntryS = DoubleToStr(Entry,digits);
string Entry2S = DoubleToStr(Entry2,digits);
string TP1S = DoubleToStr(TP1,digits);
string TP2S = DoubleToStr(TP2,digits);
string SLS = DoubleToStr(SL,digits);
string sText1, sText2, sText3,sText4, sText5, sText6, sText7 ;
string sNameRT1 = “En1”;
string sNameRT2 = “En2”;
string sNameRT3 = “TP1”;
string sNameRT4 = “TP2”;
string sNameRT5 = “SL”;
string sNameRT6 = “Calculation1”;
string sNameRT7 = “Calculation2″;
if (Show_Calc == True)
{
sText1 = sText1 + ” “+ “вход ” + EntryS ;
ObjectCreate(sNameRT1, OBJ_LABEL, 0, 0, 0);
ObjectSetText(sNameRT1,sText1,Font_Size, “Verdana”, White);
ObjectSet(sNameRT1, OBJPROP_CORNER, Corner);
ObjectSet(sNameRT1, OBJPROP_XDISTANCE, 20);
ObjectSet(sNameRT1, OBJPROP_YDISTANCE, 84);
sText2 = sText2 + ” “+ “вход “+Entry2S ;
ObjectCreate(sNameRT2, OBJ_LABEL, 0, 0, 0);
ObjectSetText(sNameRT2,sText2,Font_Size, “Verdana”, Orange);
ObjectSet(sNameRT2, OBJPROP_CORNER, Corner);
ObjectSet(sNameRT2, OBJPROP_XDISTANCE, 20);
ObjectSet(sNameRT2, OBJPROP_YDISTANCE, 71);
sText3 = sText3 + ” ” + “тейк “+ TP1S ;
ObjectCreate(sNameRT3, OBJ_LABEL, 0, 0, 0);
ObjectSetText(sNameRT3,sText3,Font_Size, “Verdana”, Lime);
ObjectSet(sNameRT3, OBJPROP_CORNER, Corner);
ObjectSet(sNameRT3, OBJPROP_XDISTANCE, 20);
ObjectSet(sNameRT3, OBJPROP_YDISTANCE, 58);
sText4 = sText4 + ” “+ “тейк “+TP2S ;
ObjectCreate(sNameRT4, OBJ_LABEL, 0, 0, 0);
ObjectSetText(sNameRT4,sText4,Font_Size, “Verdana”, DodgerBlue);
ObjectSet(sNameRT4, OBJPROP_CORNER, Corner);
ObjectSet(sNameRT4, OBJPROP_XDISTANCE, 20);
ObjectSet(sNameRT4, OBJPROP_YDISTANCE, 45);
sText5 = sText5 + ” ” + “стоп “+ SLS ;
ObjectCreate(sNameRT5, OBJ_LABEL, 0, 0, 0);
ObjectSetText(sNameRT5,sText5,Font_Size, “Verdana”, Red);
ObjectSet(sNameRT5, OBJPROP_CORNER, Corner);
ObjectSet(sNameRT5, OBJPROP_XDISTANCE, 20);
ObjectSet(sNameRT5, OBJPROP_YDISTANCE, 32);
sText6 = sText6 + ” ” + “P.Angle : ” + DoubleToStr(Price_Angle,0) + ” ” + “Adjustment: ” +DoubleToStr(Correction_V,0);
ObjectCreate(sNameRT6, OBJ_LABEL, 0, 0, 0);
ObjectSetText(sNameRT6,sText6,8, “Verdana”, White);
ObjectSet(sNameRT6, OBJPROP_CORNER, Corner);
ObjectSet(sNameRT6, OBJPROP_XDISTANCE, 20);
ObjectSet(sNameRT6, OBJPROP_YDISTANCE, 20);
sText7 = sText7 + ” ” + “Corrected P.Angle : ” + DoubleToStr(Corrected_price_angle,0) + ” ” + “Factor : ” +DoubleToStr(Factor_no,5);
ObjectCreate(sNameRT7, OBJ_LABEL, 0, 0, 0);
ObjectSetText(sNameRT7,sText7,8, “Verdana”, White);
ObjectSet(sNameRT7, OBJPROP_CORNER, Corner);
ObjectSet(sNameRT7, OBJPROP_XDISTANCE, 20);
ObjectSet(sNameRT7, OBJPROP_YDISTANCE, 10);
}
else
{
sText1 = sText1 + ” “+ “вход ” + EntryS ;
ObjectCreate(sNameRT1, OBJ_LABEL, 0, 0, 0);
ObjectSetText(sNameRT1,sText1,Font_Size, “Verdana”, White);
ObjectSet(sNameRT1, OBJPROP_CORNER, Corner);
ObjectSet(sNameRT1, OBJPROP_XDISTANCE, 20);
ObjectSet(sNameRT1, OBJPROP_YDISTANCE, 61);
sText2 = sText2 + ” “+ “вход “+Entry2S ;
ObjectCreate(sNameRT2, OBJ_LABEL, 0, 0, 0);
ObjectSetText(sNameRT2,sText2,Font_Size, “Verdana”, Orange);
ObjectSet(sNameRT2, OBJPROP_CORNER, Corner);
ObjectSet(sNameRT2, OBJPROP_XDISTANCE, 20);
ObjectSet(sNameRT2, OBJPROP_YDISTANCE, 48);
sText3 = sText3 + ” ” + “тейк “+ TP1S ;
ObjectCreate(sNameRT3, OBJ_LABEL, 0, 0, 0);
ObjectSetText(sNameRT3,sText3,Font_Size, “Verdana”, Lime);
ObjectSet(sNameRT3, OBJPROP_CORNER, Corner);
ObjectSet(sNameRT3, OBJPROP_XDISTANCE, 20);
ObjectSet(sNameRT3, OBJPROP_YDISTANCE, 36);
sText4 = sText4 + ” “+ “тейк “+TP2S ;
ObjectCreate(sNameRT4, OBJ_LABEL, 0, 0, 0);
ObjectSetText(sNameRT4,sText4,Font_Size, “Verdana”, DodgerBlue);
ObjectSet(sNameRT4, OBJPROP_CORNER, Corner);
ObjectSet(sNameRT4, OBJPROP_XDISTANCE, 20);
ObjectSet(sNameRT4, OBJPROP_YDISTANCE, 23);
sText5 = sText5 + ” ” + “стоп “+ SLS ;
ObjectCreate(sNameRT5, OBJ_LABEL, 0, 0, 0);
ObjectSetText(sNameRT5,sText5,Font_Size, “Verdana”, Red);
ObjectSet(sNameRT5, OBJPROP_CORNER, Corner);
ObjectSet(sNameRT5, OBJPROP_XDISTANCE, 20);
ObjectSet(sNameRT5, OBJPROP_YDISTANCE, 10);
}}}
//**
fTime = false;
prevDay = cDay;
}
return (0);
}
//****************************************************
void PlotLine(string name,double value,color line_color)
{
//datetime time1= iTime(NULL,PERIOD_D1,0)+Period()*60 + (GMT-Period()/60.0)*3600;
//datetime time2= time1+24*3600+Period()*60 ;
double valueN=NormalizeDouble(value,Digits);
bool res = ObjectCreate(name,OBJ_TREND,0,time1,valueN,time2,valueN);
ObjectSet(name, OBJPROP_WIDTH, width);
ObjectSet(name, OBJPROP_STYLE, style);
ObjectSet(name, OBJPROP_RAY, false);
ObjectSet(name, OBJPROP_BACK, true);
ObjectSet(name, OBJPROP_COLOR, line_color);
}
//*******************************************************
void ObjDel()
{
if (ObjectsTotal() > 0)
for (num=0;num<=CountDays;num++)
{
ObjectDelete(“вход[“+num+”]”);
ObjectDelete(“добавка[“+num+”]”);
ObjectDelete(“тейк[“+num+”]”);
ObjectDelete(“тейк_2[“+num+”]”);
ObjectDelete(“стоп[“+num+”]”);
}
ObjectDelete(“En1”);
ObjectDelete(“En2”);
ObjectDelete(“TP1”);
ObjectDelete(“TP2”);
ObjectDelete(“SL”);
ObjectDelete(“Calculation1”);
ObjectDelete(“Calculation2”);
}
相关资源
暂无评论...