Today's the day

向软件大牛炫耀我会焊单片机,向硬件大牛炫耀我会写 Rails,向软硬件大牛炫耀我生物,向软硬件生物大牛炫耀我会折腾期货 -_-bbb

期权初感受
从 EasyLanguage 迁移到 MC .NET (一):基本结构

C# 已经成为自动交易的标准了?

galeki posted @ 2012年8月02日 03:57 in 交易 with tags C# multicharts , 20678 阅读

交易一直在用的 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# 先~

Head_small
邱焜 说:
2012年8月02日 08:56

果然 C sharp 是 Java 一样的存在

free wsop chips onli 说:
2017年12月28日 17:49

Thanks to all play the game so quit the jumble solver keyboard.

router login 说:
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

five nights at fredd 说:
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!

Run 3 说:
2018年12月01日 09:40

I feel a lot more people need to read this, very good info!

soundcloud to mp3 说:
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

vex 3 说:
2019年1月03日 16:47

Thank you for sharing this tutorial, I love your post. I hope to receive more good articles.

enable flash in chro 说:
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

kevin 说:
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.

kevin 说:
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.

UMAIR 说:
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

UMAIR 说:
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

lsm99 说:
2020年12月21日 00:51

Your website is really cool and this is a great inspiring article. Abstract Canvas Art

lsm99 说:
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

lsm99 说:
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

lsm99 说:
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

lsm99 说:
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

lsm99 说:
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

lsm99 说:
2021年1月18日 00:17

This was really an interesting topic and I kinda agree with what you have mentioned here! Buy Vicoprofen Online

lsm99 说:
2021年1月22日 00:14

I have you bookmarked your site to check out the new stuff you post. รับผลิตสบู่

lsm99 说:
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

lsm99 说:
2021年2月02日 17:38

 

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. GraphPad Prism Full Crack
lsm99 说:
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

lsm99 说:
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

lsm99 说:
2021年3月01日 22:26

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. cbd oil bath bombs

lsm99 说:
2021年3月12日 02:15

i read a lot of stuff and i found that the way of writing to clearifing that exactly want to say was very good so i am impressed and ilike to come again in future.. 科技券

lsm99 说:
2021年3月12日 18:34

I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website. 迷你倉

lsm99 说:
2021年3月12日 19:47

I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. 利得稅

lsm99 说:
2021年3月14日 01:13

Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. watch bands

lsm99 说:
2021年3月14日 15:02 I am glad you take pride in what you write.  This makes you stand way out from many other writers that push poorly written content. 

Airforce

lsm99 说:
2021年3月14日 19:53

This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post! black and white abstract paintings on canvas

among 说:
2021年6月14日 17:41

Thanks so much for sharing this great information! I look forward to seeing more of your posts as soon as possible!


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter