COCO研究院

 找回密碼
 註冊
搜索
查看: 5560|回復: 3

[範例程式碼] 如何把文字加在橫線上

[複製鏈接]
發表於 17-6-21 21:51 | 顯示全部樓層 |閱讀模式
在圖中, 已有 indicator 畫出橫線, 現想把文字 ( 即 24950 )加在橫線上, 但如何找 text 所在的 date ,  time,

因圖是動的, 是否要 INDICATOR 不斷修正位置?
pic1.jpg
發表於 17-6-26 22:16 | 顯示全部樓層
試試.,,不知道和你想要的有沒有一樣


  1. inputs:
  2.    ShowPriceLine( True ),
  3.    LineColor( DarkGray ),
  4.    LineStyle( Tool_Dashed3 ),        
  5.    ShowText( True ),         
  6.    TextColor( RGB(255,104,32) ),  
  7.    TextSize( 14 ),   
  8.    TextShiftUp( 2 ) ;              

  9. variables:
  10.    TL_ID( 0 ),
  11.    int NumDecimals( 0 ),
  12.    Date_And_Time(0),
  13.    TheHigh(0),
  14.    Text_ID( 0 ) ;
  15. {
  16.    if Category = 12 then
  17.      NumDecimals = Log( PriceScale ) / Log( 10 ) - 1
  18.    else
  19.       NumDecimals = Log( PriceScale ) / Log( 10 ) ;
  20. }   
  21. if Date=1170509 and time=1315 and ShowPriceLine then begin
  22.    TheHigh=        H;
  23.    TL_ID = TL_New( D, T, H, D, T, H ) ;  
  24.    TL_SetColor( TL_ID, LineColor ) ;  
  25.    TL_SetStyle( TL_ID, LineStyle ) ;  
  26.    TL_SetSize( TL_ID, 0 ) ;  
  27.    TL_SetExtRight( TL_ID, True ) ;  
  28.    TL_SetExtLeft( TL_ID, false ) ;
  29.    TL_SetColor( TL_ID, LineColor ) ;
  30.    Date_And_Time = getappinfo(aiRightDispDateTime);       
  31.    Text_ID = Text_New( D, T, H, NumToStr( H, NumDecimals ) ) ;
  32.    if ShowText then begin
  33.       Text_SetLocation( Text_ID, D, T, H+ TextShiftUp ) ;
  34.       Text_SetColor( Text_ID, TextColor ) ;
  35.       Text_SetSize( Text_ID, TextSize ) ;
  36.       Text_SetString( Text_ID, Spaces( 0 ) + NumToStr( C, NumDecimals ) ) ;
  37.       Text_SetStyle( Text_ID, 0, 1 ) ;
  38.       
  39.    end ;           
  40. end ;
  41. Date_And_Time = getappinfo(aiRightDispDateTime);
  42. text_setLocation(Text_ID,JulianToDate(IntPortion(Date_And_Time)),datetime2eltime(Date_And_Time)-60,TheHigh);
  43.   

  44.    

  45.    
複製代碼

 樓主| 發表於 17-6-27 20:58 | 顯示全部樓層
和我想做的一樣, 謝謝你
發表於 21-5-25 17:19 | 顯示全部樓層
謝謝指導,正在學習multichart
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-4-26 11:22

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 | AI繪圖AI超擬真美女AI beauty AI Stable DiffusionAI正妹AI Lookbook