龙听期货论坛's Archiver






 微信: QQ:

龙听 发表于 2024-2-5 15:47

【_SystemHistory function】

{
_SystemHistory 函数

作者:Alex Matulich 2003 年 11 月 8 日修订 独角兽研究公司版权所有 (c) 2003 年,保留所有权利。

在优化过程中,请将文件名参数设置为空字符串""。否则,每次重新计算策略时,该函数都会重新创建一个文件,这将大大降低优化速度。

该函数会输出每个平仓头寸的利润、初始风险、初始波动率、最大不利偏移 (MAE) 和最大有利偏移 (MFE)。输出单位是美元,而不是市场单位,尽管输入*是市场单位。

该函数的输入是文件名、止损价和波动率测量值,您可以在每条线上将其传递给该函数。

下面是一个如何使用 _SystemHistory 的示例,使用的是一个粗糙的 "海龟式 "交易系统:
-----------------------------------------------------------------------[code]
Inputs: filename(""), EntryLen(24), StopLength(12);
Vars: StopPrice(0), signl(0);

{Generate buy or sell signal}

signl = 0;
if Close > Highest(High, EntryLen)[1] then signl = 1; {buy signal}
if Close < Lowest(Low, EntryLen)[1] then signl = -1;  {sell signal}

{Execute buy or sell signal and set initial stop}

if signl > 0 then begin
     Buy("L") next bar open;
     if MarketPosition <= 0 then StopPrice = Highest(Low, StopLength);
     ExitLong("xl1") next bar at StopPrice stop;
end;

if signl < 0 then begin
     Sell("S") next bar open;
     if MarketPosition >= 0 then StopPrice = Lowest(High, StopLength);
     ExitShort("xs1") next bar at StopPrice stop;
end;

{Update stop for open position}

if MarketPosition > 0 then begin
     StopPrice = MinList(StopPrice, Highest(Low, StopLength));
     ExitLong("xl") next bar at StopPrice stop;
end;

if MarketPosition < 0 then begin
     StopPrice = MaxList(StopPrice, Lowest(High, StopLength));
     ExitShort("xs") next bar at StopPrice stop;
end;

{Output the history}
value1 = _SystemHistory(filename, StopPrice, AvgTrueRange(15));
[/code]-----------------------------------------------------------------------
}

**** Hidden Message *****

龙听 发表于 2024-2-5 15:50

**** Hidden Message *****

页: [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期】正在更新中......