C# 已经成为自动交易的标准了?
交易一直在用的 Multicharts 用的语言是内置的 EasyLanguage。昨天这个软件发布了 .net 的版本,也就是 Multicharts .NET,和前者的区别在于可以使用 C# 作为策略和指标的编写语言了。
稍微查了查,发现几个比较有名的自动交易软件(比如 Ninja Trader、SmartQuanter)都是支持 C# 的,估计 Multicharts 也是被逼的吧 XD。难道 C# 已经成为自动交易的标准了吗?
一开始我以为只是语法仿照 C#,试用了一下发现是原生的 C# 程序(或者说库),编译后直接运行在 .net framwork 上的,这样的就有些优势:
- 可以直接调用 .net 库,也可以调用第三方库,基本上现在可以在交易程序里面干任何事情了。
- 可以直接用 Visual Studio 来编辑和 debug 代码。
- 可以直接调用 GDI 来高效率绘图。
而 EasyLanguage 只可以在程序里发交易单和数值计算而已,也没法获得账户的详细的信息。
也就是说 C# 版本相当于提供了更底层的操作,所以如果你觉得 EasyLanguage 的功能太少,又不想自己去翻 broker 的 API 文档从头写程序的话,那么这个 .net 版本是非常不错的选择。
虽然我目前的策略都很简单,EasyLanguage 完全可以胜任,不过我还是很有兴趣用这个 .net 版本弄个类似 “如果开仓了就在 Twitter 上 @ 我一下” 的功能,肯定非常有趣呐~
当然用 C# 做更底层的操作,也是有代价的,那就是代码的复杂度上升了。
比如,突破前 n 日高点买一手,用 EasyLanguage 编写的话就是这样:
input: Price( High ), Length( 20 ) ; Buy 1 share next bar at Highest( Price, Length ) + 1 point stop;
相信即使是不懂 EasyLanguage 的人,也能大致看懂这个代码是什么意思吧~
但是如果用 C#,看起来就像这样:
using System; using PowerLanguage.Function; namespace PowerLanguage.Strategy { public class Channel_Breakout_LE : SignalObject { private ISeries<Double> m_price; private int m_length = 20; private HighestFC m_highestfc; private IOrderPriced m_Order; public Channel_Breakout_LE(object ctx) : base(ctx) {} private ISeries<Double> price{ get { return m_price; } } [Input] public int length{ get { return m_length; } set { m_length = value; } } protected override void Create(){ m_highestfc = new HighestFC(this); m_Order = OrderCreator.Stop(new SOrderParameters(Contracts.Default, "ChBrkLE", EOrderAction.Buy)); } protected override void StartCalc(){ m_price = Bars.High; m_highestfc.pricevalue = price; m_highestfc.len = new Lambda<Int32>(delegate { return length; }); } protected override void CalcBar(){ m_Order.Send((m_highestfc[0] + (1*Bars.Point))); } } }
……囧
如果说 EasyLanguage 即使是不懂程序的人也可以看两天就上手的话,那么这个 C# 版本的肯定只能是程序员的菜了。
好歹前两年也写过几个 .net 的程序,翻出书复习一下 C# 先~
2012年8月02日 08:56
果然 C sharp 是 Java 一样的存在
2012年8月02日 09:57
+1
2017年12月28日 17:49
Thanks to all play the game so quit the jumble solver keyboard.
2018年6月15日 11:31
I am grateful to have opened this discussion. This question is quite interesting to me. Finally the answer was found
2018年8月21日 11:25
Thank you for posting such a great article! I found your website perfect for my needs. It contains wonderful and helpful posts. Keep up the good work!. Thank you for this wonderful Article!
2018年10月30日 15:08
This is a very amazing post.
2018年12月01日 09:40
I feel a lot more people need to read this, very good info!
2018年12月01日 17:24
Your sharing is great. I am they are a lot of things from your article. That is a very interesting experience
2019年1月03日 16:47
Thank you for sharing this tutorial, I love your post. I hope to receive more good articles.
2019年11月25日 17:10
It is wonderful to be here with everyone, I have a lot of knowledge from what you share, to say thank you, the information and knowledge here helps me a lot
2020年12月01日 16:05
when something is introduced in the market people have some problem in getting adjusted to it. For that matter <a href="https://de.altosignpdf.com/">https://de.altosignpdf.com/</a> is there to ask any kind of question. Quick responses are there and that can allow to work continiously.
2020年12月01日 16:05
when something is introduced in the market people have some problem in getting adjusted to it. For that matter https://de.altosignpdf.com/ is there to ask any kind of question. Quick responses are there and that can allow to work continiously.
2020年12月10日 16:12
MP Board 10th Class Model Sample Guess Questions Papers Download 2021 Exam, MP Board Subject Wise 10th Class MP Board English Questions <a href="https://boardmodelpaper.com/mp-board-10th-model-paper-mpbse-hsc-sample-paper-blue-print/">Pdf download</a> and Madhya Pradesh Sample Hindi Model bit Bank Papers MPBSE Final Exam Mathematics Previous Years Sample Questions Papers MPBSE 10th Annual Exam Social Studies and Geography, History, Civics, Disaster Guessing Questions Namuna Papers Madhya Pradesh Educational Board Science Pdf Questions Download
2020年12月10日 16:13
MP Board 10th Class Model Sample Guess Questions Papers Download 2021 Exam, MP Board Subject Wise 10th Class MP Board Pdf download English Questions and Madhya Pradesh Sample Hindi Model bit Bank Papers MPBSE Final Exam Mathematics Previous Years Sample Questions Papers MPBSE 10th Annual Exam Social Studies and Geography, History, Civics, Disaster Guessing Questions Namuna Papers Madhya Pradesh Educational Board Science Pdf Questions Download
2020年12月21日 00:51
Your website is really cool and this is a great inspiring article. Abstract Canvas Art
2020年12月21日 01:23
Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post with people.. Singapore digital marketing agency
2021年1月13日 11:30
If you set out to make me think today; mission accomplished! I really like your writing style and how you express your ideas. Thank you. kiss918 Malaysia
2021年1月14日 01:19
Your article has piqued a lot of positive interest. I can see why since you have done such a good job of making it interesting. online casino in singapore
2021年1月15日 01:20
i am for the first time here. I found this board and I in finding It truly helpful & it helped me out a lot. I hope to present something back and help others such as you helped me. invest in Breezeway desa park
2021年1月15日 01:58
Succeed! It could be one of the most useful blogs we have ever come across on the subject. Excellent info! I’m also an expert in this topic so I can understand your effort very well. Thanks for the huge help. Singapore SEO services
2021年1月18日 00:17
This was really an interesting topic and I kinda agree with what you have mentioned here! Buy Vicoprofen Online
2021年1月22日 00:14
I have you bookmarked your site to check out the new stuff you post. รับผลิตสบู่
2021年1月30日 21:15
Thanks so much for sharing this awesome info! I am looking forward to see more postsby you! How can I stop my insomnia
2021年2月02日 17:38
2021年2月17日 22:23
That is the excellent mindset, nonetheless is just not help to make every sence whatsoever preaching about that mather. Virtually any method many thanks in addition to i had endeavor to promote your own article in to delicius nevertheless it is apparently a dilemma using your information sites can you please recheck the idea. thanks once more. Buy OxyNorm Online
2021年2月26日 14:36
That is the excellent mindset, nonetheless is just not help to make every sence whatsoever preaching about that mather. Virtually any method many thanks in addition to i had endeavor to promote your own article in to delicius nevertheless it is apparently a dilemma using your information sites can you please recheck the idea. thanks once more. just cbd