النتائج 1 إلى 5 من 5
الموضوع: طلب تعديل مؤشر
- 27-10-2019, 11:40 AM #1
طلب تعديل مؤشر
السلام عليكم وكل عام وانتم بخير
انا ارفقت مؤشر يقوم بتحديد القمه والقاع لاخر 360 شمعه ولكن مشكلة المؤشر هو عند رسم اى شئ اخر على الشارت مثل الترندات او اى خطوط يقوم بمسحها من تلقاء نفسه
ياريت لو ينفع ابطال المشكلة دى
ولكم جزيل الشكر
- 27-10-2019, 03:13 PM #2كود PHP:
//+------------------------------------------------------------------+
//| Virtecal_line.mq4 |
//| Copyright 2017, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 10
#property indicator_plots 10
//+------------------------------- تعريفات الموفيباتشي-----------------------------------+
bool HighToLow = true;
input double Fibo_Level_1 = 0.236;
input double Fibo_Level_2 = 0.382;
input double Fibo_Level_3 = 0.500;
input double Fibo_Level_4 = 0.618;
input double Fibo_Level_5 = 0.764;
input double Fibo_Level_6 = 0.886;
input int StartBar = 0;
input int BarsBack = 20;
input bool Pause = false;
color VerticalLinesColor = clrRed;
color FiboLinesColors = clrYellow;
//+------------------------------------------------------------------+
double Fibo_Level_0 = 0.000;
double Fibo_Level_7 = 1.000;
//+------------------------------------------------------------------+
double f_1[];
double f_2[];
double f_3[];
double f_4[];
double f_5[];
double f_6[];
double f_7[];
double f_8[];
//+------------------------------------------------------------------+
#define MODE_OPEN 0
#define MODE_LOW 1
#define MODE_HIGH 2
#define MODE_CLOSE 3
#define MODE_VOLUME 4
#define MODE_TIME 5
#define MODE_REAL_VOLUME 5
//+------------------------------------------------------------------+
/// خط عند النقطة 359
input string InpName="VLine"; // Line name
input int InpDate=25; // Event date, %
input color InpColor=clrRed; // Line color
input ENUM_LINE_STYLE InpStyle=STYLE_DASH; // Line style
input int InpWidth=1; // Line width
input bool InpBack=false; // Background line
input bool InpSelection=true; // Highlight to move
input bool InpHidden=true; // Hidden in the object list
input long InpZOrder=0; // Priority for mouse click
//+------------------------------- رسم خط القمة-----------------------------------+
//--- input parameters of the script
input string InpName1="HLine"; // Line name
input int InpPrice1=25; // Line price, %
input color InpColor1=clrBlue; // Line color
input ENUM_LINE_STYLE InpStyle1=STYLE_DASH; // Line style
input int InpWidth1=3; // Line width
input bool InpBack1=false; // Background line
input bool InpSelection1=true; // Highlight to move
input bool InpHidden1=true; // Hidden in the object list
input long InpZOrder1=0; // Priority for mouse click
//+------------------------------- رسم خط القاع-----------------------------------+
input string InpName2="LLine"; // Line name
input int InpPrice2=25; // Line price, %
input color InpColor2=clrRed; // Line color
input ENUM_LINE_STYLE InpStyle2=STYLE_DASH; // Line style
input int InpWidth2=3; // Line width
input bool InpBack2=false; // Background line
input bool InpSelection2=true; // Highlight to move
input bool InpHidden2=true; // Hidden in the object list
input long InpZOrder2=0; // Priority for mouse click
//+------------------------------- رسم ترند بين القمة والقاع-----------------------------------+
input string InpName_Trend="Trend"; // Line name
input int InpDate1_Trend=35; // 1 st point's date, %
input int InpPrice1_Trend=60; // 1 st point's price, %
input int InpDate2_Trend=65; // 2 nd point's date, %
input int InpPrice2_Trend=40; // 2 nd point's price, %
color InpColor_Trend; // Line color
input ENUM_LINE_STYLE InpStyle_Trend=STYLE_DASH; // Line style
input int InpWidth_Trend=2; // Line width
input bool InpBack_Trend=false; // Background line
input bool InpSelection_Trend=true; // Highlight to move
input bool InpRayLeft_Trend=false; // Line's continuation to the left
input bool InpRayRight_Trend=false; // Line's continuation to the right
input bool InpHidden_Trend=true; // Hidden in the object list
input long InpZOrder_Trend=0; // Priority for mouse click
//+------------------------------- عملية رسم مؤشر على القمة او القاع حسب الفيبوناتشية-----------------------------------+
input string InpName_Check="ArrowCheck"; // Sign name
input int InpDate_Check=10; // Anchor point date in %
input int InpPrice_Check=50; // Anchor point price in %
input ENUM_ARROW_ANCHOR InpAnchor_Check=ANCHOR_TOP; // Anchor type
input color InpColor_Check_Sup=clrLime; // Sign color
input color InpColor_Check_In=clrRed; // Sign color
input ENUM_LINE_STYLE InpStyle_Check=STYLE_DOT; // Border line style
input int InpWidth_Check=5; // Sign size
input bool InpBack_Check=false; // Background sign
input bool InpSelection_Check=false; // Highlight to move
input bool InpHidden_Check=true; // Hidden in the object list
input long InpZOrder_Check=0; // Priority for mouse click
//+------------------------------- تعريفات خاصة بتحديد القمة والقاع-----------------------------------+
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
datetime date_High[],date_Low[];
double Max_High_Point[],Min_Low_Point[];
int x_High,x_Low;
int CA_COUNT=359;
int OnInit()
{
//+------------------------------- تحديد مؤشرات الفيبوناتشي-----------------------------------+
SetIndexBuffer(0,f_1,INDICATOR_DATA);
SetIndexBuffer(1,f_2,INDICATOR_DATA);
SetIndexBuffer(2,f_3,INDICATOR_DATA);
SetIndexBuffer(3,f_4,INDICATOR_DATA);
SetIndexBuffer(4,f_5,INDICATOR_DATA);
// SetIndexBuffer(5,f_6,INDICATOR_DATA);
// SetIndexBuffer(6,f_7,INDICATOR_DATA);
SetIndexBuffer(7,f_8,INDICATOR_DATA);
PlotIndexSetString(0,PLOT_LABEL,"Fibo_"+DoubleToString(Fibo_Level_0,4));
PlotIndexSetString(1,PLOT_LABEL,"Fibo_"+DoubleToString(Fibo_Level_1,4));
PlotIndexSetString(2,PLOT_LABEL,"Fibo_"+DoubleToString(Fibo_Level_2,4));
PlotIndexSetString(3,PLOT_LABEL,"Fibo_"+DoubleToString(Fibo_Level_3,4));
PlotIndexSetString(4,PLOT_LABEL,"Fibo_"+DoubleToString(Fibo_Level_4,4));
// PlotIndexSetString(5,PLOT_LABEL,"Fibo_"+DoubleToString(Fibo_Level_5,4));
// PlotIndexSetString(6,PLOT_LABEL,"Fibo_"+DoubleToString(Fibo_Level_6,4));
PlotIndexSetString(7,PLOT_LABEL,"Fibo_"+DoubleToString(Fibo_Level_7,4));
//ObjectsDeleteAll(0);
SetIndexBuffer(8,Max_High_Point);
SetIndexBuffer(9,Min_Low_Point);
return(INIT_SUCCEEDED);
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
/////////////////// بداية عمليات تحديد القمة
//////////////////////////////// حلقات الخاصة بالسعر والتوقيت للقمة بداية
//حلقة لاستخراج عنوان اعلى سعر للقمة
x_High=0;
for(int i=1;i < CA_COUNT;i++)
{
if(high[i]>high[i-1] && high[i]>high[i+1] )
{
Max_High_Point[x_High]=high[i];
x_High++;
}
}
//حلقة لاستخراج وقت اعلى سعر للقمة
datetime Max_High_date[]; // مصفوفة لتخزين اوقات اعلى القمم الموجودة
ArrayResize(Max_High_date,x_High);// اعطاء عداد للمصفوفة الوقت ماخوذ من الحلقة السابقة
x_High=0;
for(int i=1;i < CA_COUNT;i++)
{
if(high[i]>high[i-1] && high[i]>high[i+1] )
{
Max_High_date[x_High]=time[i];
x_High++;
}
}
////////////////////////////////حلقات لاستخراج الوقت والسعر للقمة نهاية
int Max_High_p=ArrayMaximum(Max_High_Point,x_High,0); // استخراج عنوان اعلى سعر للقمة
double Price_High=Max_High_Point[Max_High_p];//أعلى سعر للقمة
// رسم خط افقي يحدد القمة بناءا على اعلى سعر للقمة
HLineCreate_High(0,InpName1,0,Price_High,InpColor1,InpStyle1,InpWidth1,InpBack1, InpSelection1,InpHidden1,InpZOrder1);
/////////////////// نهاية عمليات تحديد القمة
/////////////////// بداية عمليات تحديد القعر
//////////////////////حلقات لحساب اسعار واوقات القعر
///////////////////حلقة لحساب ادنى سعر للقعر
x_Low=0;
for(int i=1;i < CA_COUNT;i++)
{
if(low[i] < low[i-1] && low[i] < low[i+1] )
{
Min_Low_Point[x_Low]=low[i];
x_Low++;
}
}
////////////////نهاية حلقة حساب السعر للقعر
//حلقة لحساب اوقات القعر
datetime Min_Low_date[];
ArrayResize(Min_Low_date,x_Low);
x_Low=0;
for(int i=1;i < CA_COUNT;i++)
{
if(low[i] < low[i-1] && low[i] < low[i+1] )
{
Min_Low_date[x_Low]=time[i];
x_Low++;
}
}
//////////////////نهاية حلقة حساب اوقات القعر
int Min_Low_p=ArrayMinimum(Min_Low_Point,x_Low,0); //استخراج عنوان ادنى سعر للقعر
double Price_Low=Min_Low_Point[Min_Low_p];// ادنى سعر للقعر
// خط افقي لتحديد القعر بناءا على ادنى سعر للقعر
//Comment(Price_Low,"\n",Min_Low_date[Min_Low_p]);
HLineCreate_Low(0,InpName2,0,Price_Low,InpColor2,InpStyle2,InpWidth2,InpBack2,InpSelection2,InpHidden2,InpZOrder2);
/////////////////// نهاية عمليات تحديد القعر
//رسم خط عند 360 درجة
VLineCreate(0,InpName,0,time[360],InpColor,InpStyle,InpWidth,InpBack,
InpSelection,InpHidden,InpZOrder);
// تحديد الاتجاه
if(Direction (Min_Low_date[Min_Low_p],Max_High_date[Max_High_p]))
{
//صاعد
HighToLow=false;
InpColor_Trend=clrLimeGreen;
//Comment("up");
}
else
{
//هابط
HighToLow=true;
InpColor_Trend=clrMediumSeaGreen;
//Comment("doun");
}
/////رسم الترند الواصل بين القمة والقاع فرضا الترند صاعد
TrendCreate(0,InpName_Trend,0,Min_Low_date[Min_Low_p],Price_Low,Max_High_date[Max_High_p],Price_High,InpColor_Trend,InpStyle_Trend,
InpWidth_Trend,InpBack_Trend,InpSelection_Trend,InpRayLeft_Trend,InpRayRight_Trend,InpHidden_Trend,InpZOrder_Trend);
/////// نهاية الترند
//+------------------------------- عمليات تحديد خطوط الفيبوناتشي-----------------------------------+
if(Pause==false)
{
//+------------------------------- الاتجاه هابط-----------------------------------+
if(HighToLow)
{
/*
DrawVerticalLine("v_u_hl",Max_High_p,VerticalLinesColor);
DrawVerticalLine("v_l_hl",Min_Low_p,VerticalLinesColor);
if(ObjectFind(0,"trend_hl")<0)
ObjectCreate(0,"trend_hl",OBJ_TREND,0,Max_High_date[Max_High_p],Price_High,Min_Low_date[Min_Low_p],Price_Low);
ObjectSetInteger(0,"trend_hl",OBJPROP_TIME,0,Max_High_date[Max_High_p]);
ObjectSetInteger(0,"trend_hl",OBJPROP_TIME,1,Min_Low_date[Min_Low_p]);
ObjectSetDouble(0,"trend_hl",OBJPROP_PRICE,0,Price_High);
ObjectSetDouble(0,"trend_hl",OBJPROP_PRICE,1,Price_Low);
ObjectSetInteger(0,"trend_hl",OBJPROP_COLOR,VerticalLinesColor);
ObjectSetInteger(0,"trend_hl",OBJPROP_STYLE,STYLE_DOT);
ObjectSetInteger(0,"trend_hl",OBJPROP_RAY,false);
*/
if(ObjectFind(0,"Fibo_hl")<0)
ObjectCreate(0,"Fibo_hl",OBJ_FIBO,0,Max_High_date[Max_High_p],Price_High,Min_Low_date[Min_Low_p],Price_Low);
ObjectSetDouble(0,"Fibo_hl",OBJPROP_PRICE,0,Price_High);
ObjectSetDouble(0,"Fibo_hl",OBJPROP_PRICE,1,Price_Low);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_TIME,0,Max_High_date[Max_High_p]);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_TIME,1,Min_Low_date[Min_Low_p]);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_COLOR,FiboLinesColors);
/*
ObjectSetInteger(0,"Fibo_hl",OBJPROP_LEVELCOLOR,0,FiboLinesColors);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_LEVELCOLOR,1,FiboLinesColors);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_LEVELCOLOR,2,FiboLinesColors);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_LEVELCOLOR,3,FiboLinesColors);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_LEVELCOLOR,4,FiboLinesColors);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_LEVELCOLOR,5,FiboLinesColors);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_LEVELCOLOR,6,FiboLinesColors);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_LEVELCOLOR,7,FiboLinesColors);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_LEVELS,8);
ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,0,Fibo_Level_0);
ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,1,Fibo_Level_1);
ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,2,Fibo_Level_2);
ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,3,Fibo_Level_3);
ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,4,Fibo_Level_4);
//ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,5,Fibo_Level_5);
//ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,6,Fibo_Level_6);
ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,7,Fibo_Level_7);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_RAY_RIGHT,true);
ChartRedraw();
*/
for(int i=prev_calculated;i<rates_total;i++)
{
f_8[i] = NormalizeDouble(Price_Low+(Price_High-Price_Low)*Fibo_Level_7,_Digits);
// f_7[i] = NormalizeDouble(Price_Low+(Price_High-Price_Low)*Fibo_Level_6,_Digits);
//f_6[i] = NormalizeDouble(Price_Low+(Price_High-Price_Low)*Fibo_Level_5,_Digits);
f_5[i] = NormalizeDouble(Price_Low+(Price_High-Price_Low)*Fibo_Level_4,_Digits);
f_4[i] = NormalizeDouble(Price_Low+(Price_High-Price_Low)*Fibo_Level_3,_Digits);
f_3[i] = NormalizeDouble(Price_Low+(Price_High-Price_Low)*Fibo_Level_2,_Digits);
f_2[i] = NormalizeDouble(Price_Low+(Price_High-Price_Low)*Fibo_Level_1,_Digits);
f_1[i] = NormalizeDouble(Price_Low+(Price_High-Price_Low)*Fibo_Level_0,_Digits);
}
// Comment("0.. ",f_1[0],"\n 23.. " ,f_2[0],"\n 38.." ,f_3[0],"\n 50.. ",f_4[0],"\n 60.. ",f_5[0],"\n 100 .. ",f_8[0]);
}
//+------------------------------- الاتجاه صاعد-----------------------------------+
else //LowToHigh
{
/*
DrawVerticalLine("v_u_hl",Max_High_p,VerticalLinesColor);
DrawVerticalLine("v_l_hl",Min_Low_p,VerticalLinesColor);
if(ObjectFind(0,"trend_hl")<0)
ObjectCreate(0,"trend_hl",OBJ_TREND,0,Min_Low_date[Min_Low_p],Price_Low,Max_High_date[Max_High_p],Price_High);
ObjectSetInteger(0,"trend_hl",OBJPROP_TIME,0,Min_Low_date[Min_Low_p]);
ObjectSetInteger(0,"trend_hl",OBJPROP_TIME,1,Max_High_date[Max_High_p]);
ObjectSetDouble(0,"trend_hl",OBJPROP_PRICE,0,Price_Low);
ObjectSetDouble(0,"trend_hl",OBJPROP_PRICE,1,Price_High);
ObjectSetInteger(0,"trend_hl",OBJPROP_STYLE,STYLE_DOT);
ObjectSetInteger(0,"trend_hl",OBJPROP_RAY,false);
*/
if(ObjectFind(0,"Fibo_hl")<0)
ObjectCreate(0,"Fibo_hl",OBJ_FIBO,0,Min_Low_date[Min_Low_p],Price_Low,Max_High_date[Max_High_p],Price_High);
ObjectSetDouble(0,"Fibo_hl",OBJPROP_PRICE,0,Price_Low);
ObjectSetDouble(0,"Fibo_hl",OBJPROP_PRICE,1,Price_High);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_TIME,0,Min_Low_date[Min_Low_p]);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_TIME,1,Max_High_date[Max_High_p]);
ObjectSetInteger(0,"Fibo_hl",OBJPROP_LEVELCOLOR,FiboLinesColors);
/*
ObjectSetInteger(0,"Fibo_hl",OBJPROP_LEVELS,8);
ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,0,Fibo_Level_0); //ObjectSetFiboDescription("Fibo_hl",0,DoubleToStr(Fibo_Level_0,4));
ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,1,Fibo_Level_1); //ObjectSetFiboDescription("Fibo_hl",1,DoubleToStr(Fibo_Level_1,4));
ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,2,Fibo_Level_2); //ObjectSetFiboDescription("Fibo_hl",2,DoubleToStr(Fibo_Level_2,4));
ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,3,Fibo_Level_3); //ObjectSetFiboDescription("Fibo_hl",3,DoubleToStr(Fibo_Level_3,4));
ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,4,Fibo_Level_4); //ObjectSetFiboDescription("Fibo_hl",4,DoubleToStr(Fibo_Level_4,4));
// ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,5,Fibo_Level_5); //ObjectSetFiboDescription("Fibo_hl",5,DoubleToStr(Fibo_Level_5,4));
// ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,6,Fibo_Level_6); //ObjectSetFiboDescription("Fibo_hl",6,DoubleToStr(Fibo_Level_6,4));
ObjectSetDouble(0,"Fibo_hl",OBJPROP_LEVELVALUE,7,Fibo_Level_7); //ObjectSetFiboDescription("Fibo_hl",7,DoubleToStr(Fibo_Level_7,4));
ObjectSetInteger(0,"Fibo_hl",OBJPROP_RAY_RIGHT,true);
ChartRedraw();
*/
for(int i=prev_calculated;i<rates_total;i++)
{
f_8[i] = NormalizeDouble(Price_Low,_Digits);
//f_7[i] = NormalizeDouble(Price_High-(Price_High-Price_Low)*Fibo_Level_6,_Digits);
//f_6[i] = NormalizeDouble(Price_High-(Price_High-Price_Low)*Fibo_Level_5,_Digits);
f_5[i] = NormalizeDouble(Price_High-(Price_High-Price_Low)*Fibo_Level_4,_Digits);
f_4[i] = NormalizeDouble(Price_High-(Price_High-Price_Low)*Fibo_Level_3,_Digits);
f_3[i] = NormalizeDouble(Price_High-(Price_High-Price_Low)*Fibo_Level_2,_Digits);
f_2[i] = NormalizeDouble(Price_High-(Price_High-Price_Low)*Fibo_Level_1,_Digits);
f_1[i] = NormalizeDouble(Price_High,_Digits);
}
}
}
//+------------------------------- عملية رسم مؤشر على القمة او القاع حسب الفيبوناتشية-----------------------------------+
if(SymbolInfoDouble(_Symbol,SYMBOL_ASK) > f_4[0])
{
ArrowCheckCreate(0,InpName_Check,0,Min_Low_date[Min_Low_p],Min_Low_Point[Min_Low_p-1],InpAnchor_Check,InpColor_Check_Sup,
InpStyle_Check,InpWidth_Check,InpBack_Check,InpSelection_Check,InpHidden_Check,InpZOrder_Check);
}
else if(SymbolInfoDouble(_Symbol,SYMBOL_BID) < f_4[0])
{
ArrowCheckCreate(0,InpName_Check,0,Max_High_date[Max_High_p],Price_High,InpAnchor_Check,InpColor_Check_In,
InpStyle_Check,InpWidth_Check,InpBack_Check,InpSelection_Check,InpHidden_Check,InpZOrder_Check);
}
return(rates_total);
}
//+------------------------------- التوابع-----------------------------------+
//+------------------------------- تابع عائد الى عمليات الفيبوناتشي-----------------------------------+
ENUM_TIMEFRAMES ToTimeFrame(int timeframe)
{
switch(timeframe)
{
case 0: return(PERIOD_CURRENT);
case 1: return(PERIOD_M1);
case 5: return(PERIOD_M5);
case 15: return(PERIOD_M15);
case 30: return(PERIOD_M30);
case 60: return(PERIOD_H1);
case 240: return(PERIOD_H4);
case 1440: return(PERIOD_D1);
case 10080: return(PERIOD_W1);
case 43200: return(PERIOD_MN1);
}
return(PERIOD_CURRENT);
}
//+------------------------------- تابع عائد الى عمليات الفيبوناتشي-----------------------------------+
datetime iTTime(string symbol, int timeframe, int shift)
{
if(shift < 0) return(-1);
datetime Arr[];
if(CopyTime(symbol, ToTimeFrame(timeframe), shift, 1, Arr)>0) return(Arr[0]);
return(-1);
}
datetime TTime(int bar=0) {return (iTTime(Symbol(),0,bar));}
//+------------------------------------------------------------------+
//+------------------------------- تابع عائد الى عمليات الفيبوناتشي-----------------------------------+
void DrawVerticalLine(string name , int bar , color clr)
{
if(ObjectFind(0,name)<0)
{
ObjectCreate(0,name,OBJ_VLINE,0,TTime(bar),0);
ObjectSetInteger(0,name,OBJPROP_COLOR,clr);
ObjectSetInteger(0,name,OBJPROP_STYLE,STYLE_DASH);
ObjectSetInteger(0,name,OBJPROP_WIDTH,1);
ChartRedraw();
}
else
{
ObjectSetInteger(0,name,OBJPROP_TIME,TTime(bar));
ObjectSetInteger(0,name,OBJPROP_COLOR,clr);
ObjectSetInteger(0,name,OBJPROP_STYLE,STYLE_DASH);
ObjectSetInteger(0,name,OBJPROP_WIDTH,1);
ChartRedraw();
}
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
bool VLineCreate(const long chart_ID=0, // chart's ID
const string name="VLine", // line name
const int sub_window=0, // subwindow index
datetime time=0, // line time
const color clr=clrRed, // line color
const ENUM_LINE_STYLE style=STYLE_SOLID, // line style
const int width=1, // line width
const bool back=false, // in the background
const bool selection=true, // highlight to move
const bool hidden=true, // hidden in the object list
const long z_order=0) // priority for mouse click
{
//--- if the line time is not set, draw it via the last bar
if(!time)
time=TimeCurrent();
//--- reset the error value
ResetLastError();
//--- create a vertical line
if(!ObjectCreate(chart_ID,name,OBJ_VLINE,sub_window,time,0))
{
Print(__FUNCTION__,
": failed to create a vertical line! Error code = ",GetLastError());
return(false);
}
//--- set line color
ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set line display style
ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set line width
ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- display in the foreground (false) or background (true)
ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the line by mouse
//--- when creating a graphical object using ObjectCreate function, the object cannot be
//--- highlighted and moved by default. Inside this method, selection parameter
//--- is true by default making it possible to highlight and move the object
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list
ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart
ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution
return(true);
}
//+------------------------------- تابع لتحديد الاتجاه صاعد او هابط ضمن 360 شمعة-----------------------------------+
bool Direction (datetime Date_Support,datetime Date_Resistance)
{
if(Date_Support < Date_Resistance)
return(true);
else
return(false);
}
//+------------------------------- حساب خط افقي لتحديد القمة-----------------------------------+
bool HLineCreate_High(const long chart_ID=0, // chart's ID
const string name="HLine", // line name
const int sub_window=0, // subwindow index
double price=0, // line price
const color clr=clrRed, // line color
const ENUM_LINE_STYLE style=STYLE_SOLID, // line style
const int width=1, // line width
const bool back=false, // in the background
const bool selection=true, // highlight to move
const bool hidden=true, // hidden in the object list
const long z_order=0) // priority for mouse click
{
//--- if the price is not set, set it at the current Bid price level
if(!price)
price=SymbolInfoDouble(Symbol(),SYMBOL_BID);
//--- reset the error value
ResetLastError();
//--- create a horizontal line
if(!ObjectCreate(chart_ID,name,OBJ_HLINE,sub_window,0,price))
{
Print(__FUNCTION__,
": failed to create a horizontal line! Error code = ",GetLastError());
return(false);
}
//--- set line color
ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set line display style
ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set line width
ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- display in the foreground (false) or background (true)
ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the line by mouse
//--- when creating a graphical object using ObjectCreate function, the object cannot be
//--- highlighted and moved by default. Inside this method, selection parameter
//--- is true by default making it possible to highlight and move the object
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list
ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart
ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution
return(true);
}
//+------------------------------- حساب خط افقي لتحديد القمةنهاية-----------------------------------+
//+------------------------------- حساب خط افقي لتحديد القعر-----------------------------------+
bool HLineCreate_Low(const long chart_ID=0, // chart's ID
const string name="HLine", // line name
const int sub_window=0, // subwindow index
double price=0, // line price
const color clr=clrRed, // line color
const ENUM_LINE_STYLE style=STYLE_SOLID, // line style
const int width=1, // line width
const bool back=false, // in the background
const bool selection=true, // highlight to move
const bool hidden=true, // hidden in the object list
const long z_order=0) // priority for mouse click
{
//--- if the price is not set, set it at the current Bid price level
if(!price)
price=SymbolInfoDouble(Symbol(),SYMBOL_BID);
//--- reset the error value
ResetLastError();
//--- create a horizontal line
if(!ObjectCreate(chart_ID,name,OBJ_HLINE,sub_window,0,price))
{
Print(__FUNCTION__,
": failed to create a horizontal line! Error code = ",GetLastError());
return(false);
}
//--- set line color
ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set line display style
ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set line width
ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- display in the foreground (false) or background (true)
ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the line by mouse
//--- when creating a graphical object using ObjectCreate function, the object cannot be
//--- highlighted and moved by default. Inside this method, selection parameter
//--- is true by default making it possible to highlight and move the object
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list
ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart
ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution
return(true);
}
//+------------------------------- نهاية حساب خط افقي لتحديد القعر-----------------------------------+
//+------------------------------- ترند يصل بين القمة والقعر-----------------------------------+
bool TrendCreate(const long chart_ID=0, // chart's ID
const string name="TrendLine", // line name
const int sub_window=0, // subwindow index
datetime time1=0, // first point time
double price1=0, // first point price
datetime time2=0, // second point time
double price2=0, // second point price
const color clr=clrRed, // line color
const ENUM_LINE_STYLE style=STYLE_SOLID, // line style
const int width=1, // line width
const bool back=false, // in the background
const bool selection=true, // highlight to move
const bool ray_left=false, // line's continuation to the left
const bool ray_right=false, // line's continuation to the right
const bool hidden=true, // hidden in the object list
const long z_order=0) // priority for mouse click
{
//--- set anchor points' coordinates if they are not set
//--- reset the error value
ResetLastError();
//--- create a trend line by the given coordinates
if(!ObjectCreate(chart_ID,name,OBJ_TREND,sub_window,time1,price1,time2,price2))
{
Print(__FUNCTION__,
": failed to create a trend line! Error code = ",GetLastError());
return(false);
}
//--- set line color
ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set line display style
ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set line width
ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- display in the foreground (false) or background (true)
ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the line by mouse
//--- when creating a graphical object using ObjectCreate function, the object cannot be
//--- highlighted and moved by default. Inside this method, selection parameter
//--- is true by default making it possible to highlight and move the object
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- enable (true) or disable (false) the mode of continuation of the line's display to the left
ObjectSetInteger(chart_ID,name,OBJPROP_RAY_LEFT,ray_left);
//--- enable (true) or disable (false) the mode of continuation of the line's display to the right
ObjectSetInteger(chart_ID,name,OBJPROP_RAY_RIGHT,ray_right);
//--- hide (true) or display (false) graphical object name in the object list
ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart
ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution
return(true);
}
//+------------------------------- مؤشر تحديد القاع في حال كان الاتجا ه صاعد والسعر لم يكسر خط 50-----------------------------------+
bool ArrowCheckCreate(const long chart_ID=0, // chart's ID
const string name="ArrowCheck", // sign name
const int sub_window=0, // subwindow index
datetime time=0, // anchor point time
double price=0, // anchor point price
const ENUM_ARROW_ANCHOR anchor=ANCHOR_BOTTOM, // anchor type
const color clr=clrRed, // sign color
const ENUM_LINE_STYLE style=STYLE_SOLID, // border line style
const int width=3, // sign size
const bool back=false, // in the background
const bool selection=true, // highlight to move
const bool hidden=true, // hidden in the object list
const long z_order=0) // priority for mouse click
{
//--- set anchor point coordinates if they are not set
//--- reset the error value
ResetLastError();
//--- create the sign
if(!ObjectCreate(chart_ID,name,OBJ_ARROW_CHECK,sub_window,time,price))
{
Print(__FUNCTION__,
": failed to create \"Check\" sign! Error code = ",GetLastError());
return(false);
}
//--- set anchor type
ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
//--- set a sign color
ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set the border line style
ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set the sign size
ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
//--- display in the foreground (false) or background (true)
ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the sign by mouse
//--- when creating a graphical object using ObjectCreate function, the object cannot be
//--- highlighted and moved by default. Inside this method, selection parameter
//--- is true by default making it possible to highlight and move the object
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list
ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart
ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution
return(true);
}
- 27-10-2019, 03:16 PM #3
للمعلومة اخي تم ازالة ObjectDeletAll() كود يزيل اجباريا كل الاوبجيكت المرسومة من طرف المؤشر في الشارت لهذا ازالنا ذالك الكود
- 27-10-2019, 05:08 PM #4
اشكرك يااخى الفاضل
- 27-10-2019, 06:48 PM #5
العفو اخويا ....