กองทุน SPDR GOLD SHARES
ถือทองก่อนหน้า
ถือทองล่าสุด
0.00
*หน่วยตัน / ราคาอ้างอิงล่าสุดจากสมาคมค้าทองคำ
สถิติกองทุน SPDR
ราคาทองคำแท่ง 96.5%
ราคาอ้างอิงล่าสุดจากสมาคมค้าทองคำ
ครั้งที่
ราคาก่อนหน้า
ราคาล่าสุด
0
(หน่วย บาท*) / อัปเดตล่าสุดเมื่อวันที่ 13 ก.ค. 2566 เวลา 13:04 น.
สถิติราคาทองคำ ไทย

การลากเส้น Horizontal line

  • 2 replies
  • 1,980 views
การลากเส้น Horizontal line
« เมื่อ: 23, ตุลาคม 2020, 11:24:25 AM »
หากเราต้องการลากเส้น Horizontal line จากจุดที่ 1 ไปจุดที่สอง
เหมือนในรูป ต้องการลากจากวงแดงแรกไปจนถึงชนราคา แบบนี้เราต้องแก้โค๊ดตรงไหน และแก้อย่างไรได้บ้างครับ

                     if(ObjectFind("Horizontal"+IntegerToString(i))<0)
                       {
                        ObjectDelete("Horizontal"+IntegerToString(i));
                        ObjectCreate("Horizontal"+IntegerToString(i), OBJ_HLINE, 0, Time[1], O1, Time[Bars - 1], O1);
                        ObjectSet("Horizontal"+IntegerToString(i), OBJPROP_COLOR, Color_Open);
                        ObjectSet("Horizontal"+IntegerToString(i), OBJPROP_STYLE, Style);
                       }


//O1= Open;

*

iRuler

  • 1,282
Re: การลากเส้น Horizontal line
« ตอบกลับ #1 เมื่อ: 24, ตุลาคม 2020, 10:06:36 AM »
โค๊ด [Select]
int i=0;
   color Color_Open = clrBlue;
   double price = Bid;
   ENUM_LINE_STYLE Style=STYLE_SOLID;


//Horizontal Line
   if(ObjectFind("Horizontal"+IntegerToString(i))>-1)
     {
      ObjectDelete("Horizontal"+IntegerToString(i));
     
      if(ObjectCreate(0,"Horizontal"+IntegerToString(i), OBJ_HLINE, 0, 0, price))
        {
         ObjectSet("Horizontal"+IntegerToString(i), OBJPROP_COLOR, Color_Open);
         ObjectSet("Horizontal"+IntegerToString(i), OBJPROP_STYLE, Style);
        }
      else
        {
         Print("Create Horizontal line failed!");
        }
     }

//Trend Line
   double price1,price2;
   price1=price2=Ask;
   Color_Open = clrRed;

   if(ObjectFind("TrendLine"+IntegerToString(i))>-1)
     {
      ObjectDelete("TrendLine"+IntegerToString(i));

      if(ObjectCreate(0,"TrendLine"+IntegerToString(i), OBJ_TREND, 0, Time[0], price1,Time[5],price2))
        {
         ObjectSet("TrendLine"+IntegerToString(i), OBJPROP_COLOR, Color_Open);
         ObjectSet("TrendLine"+IntegerToString(i), OBJPROP_STYLE, Style);
         ObjectSet("TrendLine"+IntegerToString(i),OBJPROP_RAY, false);
         ObjectSet("TrendLine"+IntegerToString(i),OBJPROP_WIDTH, 3);
        }
      else
        {
         Print("Create Trend line failed!");
        }
     }

Re: การลากเส้น Horizontal line
« ตอบกลับ #2 เมื่อ: 24, ตุลาคม 2020, 01:26:41 PM »
อ้างจาก: iRuler ที่ 24, ตุลาคม  2020, 10:06:36 AM
โค๊ด [Select]
int i=0;
   color Color_Open = clrBlue;
   double price = Bid;
   ENUM_LINE_STYLE Style=STYLE_SOLID;


//Horizontal Line
   if(ObjectFind("Horizontal"+IntegerToString(i))>-1)
     {
      ObjectDelete("Horizontal"+IntegerToString(i));
     
      if(ObjectCreate(0,"Horizontal"+IntegerToString(i), OBJ_HLINE, 0, 0, price))
        {
         ObjectSet("Horizontal"+IntegerToString(i), OBJPROP_COLOR, Color_Open);
         ObjectSet("Horizontal"+IntegerToString(i), OBJPROP_STYLE, Style);
        }
      else
        {
         Print("Create Horizontal line failed!");
        }
     }

//Trend Line
   double price1,price2;
   price1=price2=Ask;
   Color_Open = clrRed;

   if(ObjectFind("TrendLine"+IntegerToString(i))>-1)
     {
      ObjectDelete("TrendLine"+IntegerToString(i));

      if(ObjectCreate(0,"TrendLine"+IntegerToString(i), OBJ_TREND, 0, Time[0], price1,Time[5],price2))
        {
         ObjectSet("TrendLine"+IntegerToString(i), OBJPROP_COLOR, Color_Open);
         ObjectSet("TrendLine"+IntegerToString(i), OBJPROP_STYLE, Style);
         ObjectSet("TrendLine"+IntegerToString(i),OBJPROP_RAY, false);
         ObjectSet("TrendLine"+IntegerToString(i),OBJPROP_WIDTH, 3);
        }
      else
        {
         Print("Create Trend line failed!");
        }
     }


เทรนไลน์ถ้าชนราคา ให้ ray = false ได้ไหมครับ