Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the Multi-variety moving average Strategy of Commodity Futures in the Internet

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to realize the multi-variety moving average strategy of commodity futures on the Internet. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

As the simplest trend strategy, moving average strategy is usually a required course for procedural and quantitative trading. In this article, we do not explore the principle of strategy, we start from the level of strategy design, analyze a multi-variety strategy architecture design, and learn some experience of strategy architecture design.

The advantage of multi-variety strategy design is that it is easy to use, one strategy program controls the transaction of multiple varieties, and can display the information status uniformly. Trading multiple varieties relatively spread the risk and increase the trading opportunities. The disadvantage is that the design is more complex, the varieties can not influence each other, and the program execution efficiency is relatively high.

So the design is much more difficult than designing a single variety strategy. The first way is relatively simple, the inventor quantitative trading platform can use the "CTA function in the commodity futures trading class library" to easily realize the multi-variety strategy. The second way is to directly write the strategy, fortunately, the inventor quantitative trading platform provides a large number of strategy examples, providing us with a wealth of reference code, design ideas.

We use the "CTP commodity futures multi-variety sea turtle trading strategy" strategy as a reference to modify the multi-variety strategy we need, starting with a simple strategy, such as a multi-variety moving average strategy.

Excerpt part of the code:

Policy parameters:

Like the original "CTP Commodity Futures Multi-Variety Turtle Trading Strategy", this strategy also refers to the commodity futures trading class library. The policy code is relatively long, with comments at each key location, indicating the purpose of this code. After patiently comparing the original "CTP Commodity Futures Multi-Variety Turtle Trading Strategy", you will find that there is no change, only the logic code of the strategy trading part has been modified, and the other parts of the strategy code has been completely reused.

It has to be said that thanks to the ingenious design of the original strategy, the policy transaction logic and other non-policy-related functional codes such as policy order processing logic are well separated. The code is poorly coupled, so it is very easy to modify (provided you have read through the policy and fully understand the policy architecture). In fact, you can completely separate and delete the content related to the trading strategy in the original strategy, leaving only a multi-variety strategy framework, which can be developed at will according to your own needs.

Randomly set a set of parameters to test the latest market:

Thank you for reading! This is the end of the article on "how to realize the Multi-variety moving average Strategy of Commodity Futures on the Internet". I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report