龙听期货论坛's Archiver

C
+
+


 微信: QQ:

龙听 发表于 2021-1-29 15:34

multicharts关键词GetAppInfo

**** Hidden Message *****[/size]

龙听 发表于 2021-1-29 15:35

[code]GetAppInfo(aiBarSpacing)[/code]

—— 返回目前图表上的K棒宽度

龙听 发表于 2021-1-29 15:37

[code]GetAppInfo(aiCalcReason) [/code]
返回重新计算的原因 。

GetAppInfo返回初始化计算的原因:

            0   (CalcReason_default) - 默认当新的bar/tick出现时,计算会初始化

            1   (CalcReason_mouseLClick) - 鼠标在图表上左击后,计算会初始化

            2   (CalcReason_mouseRClick) - 鼠标在图表上右击后,计算会初始化

            3   (CalcReason_timer) - 在RecalcLastBarAfter期限超时后,计算会初始化

            4   (CalcReason_MPChange) - 在商品的图表部位即marketposition变动后,计算会初始化

            5   (CalcReason_OrderFilled) - 在委托单成交后,计算会初始化(仅用于信号)

龙听 发表于 2021-1-29 15:38

RecalcLastBarAfter
[table]
[tr][td]
超过指定时间,则初始化计算。指定时间为秒。 [/td][/tr]
[/table]

[table]
[tr][td][b]用法[/b]
RecalcLastBarAfter([i]Timeout[/i])
参数说明: [i]Timeout[/i] —— 秒数 (时间) [/td][/tr]
[/table]

[table]
[tr][td][b]范例[/b]
RecalcLastBarAfter(60) 自上次计算后如果超时1分钟的话,则启动新的脚本计算。 [/td][/tr]
[/table]

龙听 发表于 2021-1-29 15:41

实例:
[code]switch (getappinfo(aicalcreason)) begin
    case CalcReason_MouseLClick : if MouseClickCtrlPressed then begin
    var: var0(0), var1(0);
        repeat
            if 0 = var0 then begin
            var0 = MouseClickDateTime;
            break;
            end;
        until(false);
    end;
end;
var1 = datetime2eltime(var0);
print("Time of the Bar = ", var1);[/code]


Will return the time of the bar after left click on it pressing Ctrl button on the keyboard.左键单击键盘上的Ctrl按钮后,将返回该条的时间。

龙听 发表于 2021-1-29 15:43

实例:
Using GetAppInfo for Chart Window information
The example below uses the Print keyword to print information about the current Chart Window to the PowerLanguage Editor output log:


[code]// Example: Getting data about the chart window using GetAppInfo       
if LastBarOnChart_s = True then begin

        Print("The leftmost date on this chart is ", FormatDate("MM/dd/yyyy", GetAppInfo(aiLeftDispDateTime)),
                ", and the rightmost date on this chart is ", FormatDate("MM/dd/yyyy", GetAppInfo(aiRightDispDateTime)));
               
        Print(NewLine,
                "The leftmost bar closes at ", FormatTime("HH:mm:ss", GetAppInfo(aiLeftDispDateTime)),
                " and the rightmost bar closes at ", FormatTime("HH:mm:ss", GetAppInfo(aiRightDispDateTime)) );
               
        Print(NewLine,
                "The highest price on the Y axis (price scale) is ", NumToStr( GetAppInfo(aiHighestDispValue), 0),
                " and the lowest price on the same axis is ", NumToStr( GetAppInfo(aiLowestDispValue), 0));

end;[/code]


This would give an output similar to:


[code]The leftmost date on this chart is 01/20/2012, and the rightmost date on this chart is 01/20/2012

The leftmost bar closes at 12:31:16 and the rightmost bar closes at 21:56:15

The highest price on the Y axis (price scale) is 2438 and the lowest price on the same axis is 2411[/code]

龙听 发表于 2021-1-29 15:43

实例:
使用GetAppInfo监视ATS
在下面的简化示例中,GetAppInfo(aiStrategyAuto)用于监视自动交易策略的状态。如果ATS关闭,则会发出声音警报。


[code]//                Strategy that gets turned off.

Variables:
   IntraBarPersist PrevATSStatus(0),           // Holds the status of the ATS at the previous update
   atsStatus(0);                                                // Holds the current ATS status

if (LastBarOnChart_s = True) then begin

   atsStatus    = GetAppInfo(aiStrategyAuto);
   
   // If the current ATS Status is different from the previous, and the previous
   //      status was ON, give an sound alert.
   if (atsStatus <> PrevATSStatus) and (PrevATSStatus = 1) then begin
   
                PlaySound("C:\Temp\atsTurnedOff.wav");

   end;

   PrevATSStatus    = atsStatus;

   RecalcLastBarAfter(15);        // Update every 15 seconds, even if the data feed stops updating
   
end;[/code]

页: [1]
渠道·推广(20年运营值得信赖!)▼:温馨提示:期货论坛稳定、流畅的访问体验有赖于赞助商的广告支持,赞助商业务内容非本站官方业务,期货、证券及外汇投资均有亏损的风险,访问赞助商广告即代表您已了解其中的风险。欢迎意向赞助商联系客服或管理员咨询相关事宜。
                     
❤️2025年通过期货论坛开户享受如下优惠政策:政策一:手续费最低交易所+1分起,政策二:日内炒单及大资金享更高比率返还,政策三:保证金可申请交易所标准+0,政策四:开户即享有论坛Prime会员资格(价值199元/年),开户咨询管理员或右侧客服! 😋欧美期货杂志购买、下载与中文翻译:/thread-10603-1-1.html |TB/MC开户优惠政策:/thread-5986-1-1.html2025年最新交易所手续费表:/thread-7537-1-1.htmlSC2.png2025年最新中文翻译:/thread-160355-1-1.html;
欧美期货程序化期刊中文翻译目录: 【1982/83.01-12期】 【1984.01-12期】 【1985.01-12期】 【1986.01-12期】 【1987.01-12期】 【1988.01-12期】 【1989.01-12期】 【1990.01-12期】 【1991.01-12期】 【1992.01-12期】 【1993.01-12期】 【1994.01-12期】 【1995.01-12期】 【1996.01-12期】 【1997.01-12期】 【1998.01-12期】 【1999.01-12期】 【2000.01-12期】 【2001.01-12期】 【2002.01-12期】 【2003.01-12期】 【2004.01-12期】 【2005.01-12期】 【2006.01-12期】 【2007.01-12期】 【2008.01-12期】 【2009.01-12期】 【2010.01-12期】 【2011.01-12期】 【2012.01-12期】 【2013.01-12期】 【2014.01-12期】正在更新中...... 【2015.01-12期】待补 【2016.01-12期】待补 【2017.01-12期】正在更新中...... 【2018.01-12期】 【2019.01-12期】 【2020.01-12期】 【2021.01-12期】 【2022.01-12期】 【2023.01-12期】 【2024.01-12期】 【2025.01-12期】正在更新中......