两个 K 线之间连线是屏显的重要内容。以下源码范例提交了静态和动态连线的方法:
- #property copyright "Copyright 2012, laoyee"
- #property link "http://www.docin.com/yiwence"
- //新价格到达时运行一次
- int start()
- {
- //两点间静态连线
- iTwoPointsLine("15-5",Time[15],High[15],Time[5],High[5],0,Red);
- //两点间动态连线
- ObjectDelete("动态虚线");
- iTwoPointsLine("动态虚线",Time[5],High[5],Time[0],Close[0],2,Blue);
- return(0);
- }
- //程序加载时运行一次
- int init()
- {
- return(0);
- }
- //程序卸载时运行一次
- int deinit()
- {
- return(0);
- }
- void iTwoPointsLine(string myLineName,int myFirstTime,double myFirstPrice,int mySecondTime,double mySecondPrice,int
- myLineStyle,color myLineColor)
- {
- ObjectCreate(myLineName,OBJ_TREND,0,myFirstTime,myFirstPrice,mySecondTime,mySecondPrice);//确定两点坐标
- ObjectSet(myLineName,OBJPROP_STYLE,myLineStyle); //线型
- ObjectSet(myLineName,OBJPROP_COLOR,myLineColor); //线色
- ObjectSet(myLineName,OBJPROP_WIDTH, 1); //线宽
- ObjectSet(myLineName,OBJPROP_RAY,false);
- }
|