📅 财经日历 📊 实时波动 📈 大盘云图 📶 行情走势 🆚 投机情绪 🚀 今日热点

    K线定位显示文本模块

    老周 LV16
    2016-11-09 · 3630 阅读
    k 线定位显示方法的关键点是当前图表价格和时间两个元素组成的坐标系,与屏幕定位显示方式不同,所以必须采用另一个标准模块 iBarText()。源码范例如下:


    1. #property copyright "Copyright 2012, laoyee"
    2. #property link "http://www.docin.com/yiwence"
    3. //新价格到达时运行一次
    4. int start()
    5. {
    6. return(0);
    7. }
    8. //程序加载时运行一次
    9. int init()
    10. {
    11. iBarText("5",5,Low[5],"黑体",14,Red);
    12. iBarText("r",5,Low[5],"wingdings 3",18,Blue);
    13. return(0);
    14. }
    15. //程序卸载时运行一次
    16. int deinit()
    17. {
    18. return(0);
    19. }
    20. /*
    21. 函 数:标注 k 线文字
    22. 参数说明:string myString 文字内容,在指定的蜡烛位置显示文字
    23. int myBarPos 指定 k 线序号
    24. double myPrice 指定价格
    25. string myDocStyle 指定字符集
    26. int myDocSize 指定字体
    27. color myColor 指定颜色
    28. 函数返回:在指定的 k 线价格位置上标注文字
    29. */
    30. void iBarText(string myString,int myBarPos,double myPrice,string myDocStyle,int myDocSize,color myColor)
    31. {
    32. string TextBarString=myString+Time[myBarPos]; //定义文本对象名称
    33. ObjectCreate(TextBarString,OBJ_TEXT,"",Time[myBarPos],myPrice); //建立一个文本对象
    34. ObjectSetText(TextBarString,myString,myDocSize,myDocStyle,myColor);//文字内容
    35. }
    复制代码

    在第 5 个 k 线最低价位置分别显示蓝色三角符号和红色数字 5。

    QQ截图20161109173334.png


    ""
    还没有人打赏,支持一下
    回复

    举报

     
    您需要登录后才可以回帖 登录 | 注册

    提醒: 禁止引战、谩骂、灌水内容

    微信二维码

    有问题联系客服