ابدأ من داخل نفسك
Printable View
تجعل OBJPROP_RAY_RIGHT بقيمة FALSEاقتباس:
وظهرت معي الخطوط إلى نهاية الشارت وليست إلى نهاية اليوم مثلا 7 مايو 2019
OBJPROP_RAY مادخلها بالترند؟؟
الترندات تستخدم:
OBJPROP_RAY_RIGHT
ليش معقد الشغة كذا؟
كود:void Draw(string name, double price,color clr)
{
datetime now = TimeCurrent();
int TOD = now % HR24 ; // Time of day (date+time)
datetime BOD = now - TOD; // Beginning of day+0000z
datetime END = TOD - now ; // Ending of day+0000z
if(ObjectFind(name)==-1)
ObjectCreate(name,OBJ_TREND,0,BOD,price,END,price);
ObjectSet(name,OBJPROP_TIME1,BOD);
ObjectSet(name,OBJPROP_TIME2,END);
ObjectSet(name,OBJPROP_PRICE1,price);
ObjectSet(name,OBJPROP_PRICE2,price);
ObjectSet(name,OBJPROP_STYLE,STYLE_SOLID);
ObjectSet(name,OBJPROP_RAY,false);
ObjectSet(name, OBJPROP_WIDTH, 5);
ObjectSet(name, OBJPROP_COLOR, clr);
}
احذف بعض الاسطر غير المهمة او مالها علاقة,:
اختصره الى:
جرب واخبرني وانا موجودكود:void Draw(string name, double price,color clr)
{
datetime now = TimeCurrent();
int TOD = now % HR24 ; // Time of day (date+time)
datetime BOD = now - TOD; // Beginning of day+0000z
datetime END = TOD - now ; // Ending of day+0000z
ObjectCreate(name,OBJ_TREND,0,BOD,price,END,price);
ObjectSet(name,OBJPROP_STYLE,STYLE_SOLID);
ObjectSet(name,OBJPROP_RAYRIGHT,false);
ObjectSet(name, OBJPROP_WIDTH, 5);
ObjectSet(name, OBJPROP_COLOR, clr);
}
عندك مشكلة في هذا السطر: كيف تطرح رقم صغير جدا من رقم كبير جدا--الناتج سيكون تايم بالسالب وهذه لايستوعبها الجهاز ويمد الخط عند الى ما لانهاية
datetime END = TOD - now ;
TOD عندك هي فرق الثواني لاخر يوم وقيمتها حسب كودك ستكون اقل من عدد ثواني اليوم 86400 ثانية!!
بينما قيمة التايم-كرنت فوق عئرات الملايين!!
أيضا لاحظت أخي انك صممته كمؤشر بينما الأفضل تصممه كخبير, لأنك لن تستخدم الداتا سريييييييز
save under experts
كود:#define HR24 86400 // 24*3600
extern double TakeProfit_1 = 0.0;
extern double TakeProfit_2 = 0.0;
extern double TakeProfit_3 = 0.0;
extern double TakeProfit_4 = 0.0;
extern string F5= "-----------------------------------------------------------------------------------------------";
extern double Support_1 = 0;
extern double Support_2 = 0;
extern double Support_3 = 0;
extern double Support_4 = 0;
extern string F8= "-----------------------------------------------------------------------------------------------";
extern double Resistant_1 = 0;
extern double Resistant_2 = 0;
extern double Resistant_3 = 0;
extern double Resistant_4 = 0;
color TakeProfit_1_color = Green;
color TakeProfit_2_color = Green;
color TakeProfit_3_color = Green;
color TakeProfit_4_color = Green;
color TakeProfit_5_color = Green;
//-------------------------------------------
color Support_1_color = Red;
color Support_2_color = Red;
color Support_3_color = Red;
color Support_4_color = Red;
//-------------------------------------------
color Resistant_1_color = Red;
color Resistant_2_color = Red;
color Resistant_3_color = Red;
color Resistant_4_color = Red;
//+------------------------------------------------------------------+
int OnInit()
{
//--- create timer
EventSetTimer(1);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
Draw("TAKE PROFIT 1",TakeProfit_1,TakeProfit_1_color);
Draw("TAKE PROFIT 2",TakeProfit_2,TakeProfit_2_color);
Draw("TAKE PROFIT 3",TakeProfit_3,TakeProfit_3_color);
Draw("TAKE PROFIT 4",TakeProfit_4,TakeProfit_4_color);
Draw("SUPPORT 1",Support_1,Support_1_color);
Draw("SUPPORT 2",Support_2,Support_2_color);
Draw("SUPPORT 3",Support_3,Support_3_color);
Draw("SUPPORT 4",Support_4,Support_4_color);
Draw("RESISTANT 1",Resistant_1,Resistant_1_color);
Draw("RESISTANT 2",Resistant_2,Resistant_2_color);
Draw("RESISTANT 3",Resistant_3,Resistant_3_color);
Draw("RESISTANT 4",Resistant_4,Resistant_4_color);
}
void Draw(string name, double price,color clr)
{
datetime now = TimeCurrent();
int TOD = now % HR24 ; // Time of day (date+time)
datetime BOD = now - TOD; // Beginning of day+0000z
datetime END = TOD + now ; // Ending of day+0000z
if(ObjectFind(name)==-1)
ObjectCreate(name,OBJ_TREND,0,BOD,price,END,price);
ObjectSet(name,OBJPROP_TIME1,BOD);
ObjectSet(name,OBJPROP_TIME2,END);
ObjectSet(name,OBJPROP_PRICE1,price);
ObjectSet(name,OBJPROP_PRICE2,price);
ObjectSet(name,OBJPROP_STYLE,STYLE_SOLID);
ObjectSet(name,OBJPROP_RAY,false);
ObjectSet(name, OBJPROP_WIDTH, 5);
ObjectSet(name, OBJPROP_COLOR, clr);
}
جربت أخي الفاضل وعملته اكسبيرت وليس مؤشر وعدلت أيضا في قيمة END الخطوط تظهر ممتده ولا تنتهي عند نهاية اليوم حتى بداية اليوم غير دقيقه
كما أحتاج باقي الاضافات كما في مشاركتي السابقه هنا
كما يظهر بالصورة
الملف المرفق 511601
الزمن لايظهر في صورتك اخي!!
الكود أعلاه شغال معي حسب وصف الموضوع
والاثبات الصورة في اخر رد
أيضا لاحظت انك لم تعلق على هه الجزئية رغم انها كتبت لك وليس لنا:
هل أنت تريد زمن بالسالباقتباس:
datetime END = TOD - now ;
زمن بالسالب سينقلك لسنة 1969--لان بداية الزمن سنة 1970
اشكرك لردك وتعبك معي
بس بعد اذنك الموضوع موجه لمشرف المنتدى الاستاذ أسامه
بشكرك مرة تاني