Contents

  • 编写K线剩余时间功能

编写K线剩余时间功能

1.4K
1. `double i;` * 声明一个双精度浮点数变量`i`。 2. `int m,s,k;` * 声明三个整数变量`m`(分钟)、`s`(秒)和`k`(虽然`k`在给出的代码段中未使用)。 3. `m=Time[0]+Period()*60-CurTime();` * 计算剩余时间(以分钟为单位)。`Time[0]`可能是当前K线的开始时间,`Period()`可能是K线的周期(例如,5分钟、15分钟等),`CurTime()`可能是当前时间。这三者结合计算得出剩余时间。 4. `i=m/60.0;` * 将剩余时间转换为小时(`i`为双精度浮点数,所以结果是小时加小数部分)。 5. `s=m;` * 这里似乎有一个错误。如果`m`是分钟数,那么`s`应该是`m`除以60的余数,即`s=m%60`。 6. `m=(m-m`)/60;` * 这行代码存在语法错误。`m`后面的反引号(`)是不合法的。如果目的是计算剩余的分钟数,应该是`m = m / 60;`。 7. `ObjectDelete("time");` * 删除名为"time"的对象(可能是一个文本标签或图形元素)。 8. `if (ObjectFind("time") != 0)` * 检查名为"time"的对象是否存在。`ObjectFind`函数可能返回0表示对象不存在,非0表示存在。 9. `ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0]-10);` * 如果"time"对象不存在,则创建一个新的文本对象,并设置其位置和属性。 10. `ObjectSetText("time", "K线剩余"+m+"分"+s+"秒", 13, "Verdana", Yellow);` * 设置"time"对象的文本内容,显示剩余时间。 11. `else ObjectMove("time", 0, Time[0], Close[0] + 0.0002);` * 如果"time"对象已经存在,则移动它的位置。 12. `return(0);`
iebb.cn

Recommended

Leave a Comment

0/1000
Popular Recent
About Us User AgreementPrivacy PolicyRisk DisclosurePartner Program AgreementCommunity Guidelines Help Center Feedback
App Store Android

Risk Disclosure

Trading in financial instruments involves high risks including the risk of losing some, or all, of your investment amount, and may not be suitable for all investors. Any opinions, chats, messages, news, research, analyses, prices, or other information contained on this Website are provided as general market information for educational and entertainment purposes only, and do not constitute investment advice. Opinions, market data, recommendations or any other content is subject to change at any time without notice. Trading.live shall not be liable for any loss or damage which may arise directly or indirectly from use of or reliance on such information.

© 2025 Tradinglive Limited. All Rights Reserved.