量化合约指的是目标或任务具体明确,可以清晰度量。根据不同情况,表现为数量多少,具体的统计数字,范围衡量,时间长度等等。所谓量化就是把经过抽样得到的瞬时值将其幅度离散,即用一组规定的电平,把瞬时抽样值用最接近的电平值来表示。经过抽样的图像,只是在空间上被离散成为像素(样本)的阵列。而每个样本灰度值还是一个由无穷多个取值的连续变化量,必须将其转化为有限个离散值,赋予不同码字才能真正成为数字图像。这种转化称为量化。
合约量化,就是系统根据设置,自动进行买卖交易,上涨到一定点数则卖出平仓,下跌至相应点数则进行加仓操作,等待价格回调则卖出。不断的操作,达到自动化交易,让交易者不用时时刻刻紧盯市场,使用自动化交易,摈弃了用户的个人主观情绪,让交易变得更为“理智”。
At present,the specific cash withdrawal of contract quantification is"quantitative system","quantitative software","quantitative robot,etc.",each of which is slightly different,but most of the core principle is the Martin multiple investment strategy,which comes from the spot market,but it is still reasonable to apply it to the contract.
交易策略是一套规则,包括进出条件、资金管理和风险控制等。有简单的策略也有复杂的策略。简单策略通常使用技术指标和价格行为,而复杂策略使用高阶数学和统计模型。通常我们认为复杂模型更好,但实证分析和学术研究表明,复杂模型往往过度挖掘历史数据,无法适应剧烈的市场变化,相反,简单模型从长期来看更稳定。
交易策略可以分为三个部分:指标、信号和规则。
1.指标用于产生交易信号。指标的计算方法有很多,It can be economic data or valuation indicators(such as PE and EBITDA),technical indicators(such as MACD,RSI,MA)to develop or time series models(ARIMA,GARCH).Technical indicators are widely used in foreign exchange transactions.They are functions of price or trading volume,which are mainly used to detect the direction of the trend,measure the overbought and oversold state,and judge the reversal of the trend.
2.价格和指数之间的相互作用形成了一个信号。Take the moving average crossing as an example.Buy when the 5-day moving average crosses the 10-day moving average,and sell when the 5-day moving average crosses the 10-day moving average.Signals are not limited to trading,but also include sieves,whose main function is to eliminate noise.In the moving average crossing,traders can add a trend screen:only when the price is higher than the 200 day moving average(upward trend)and the 5-day moving average crosses the 10 day moving average,if the price is lower than the 200 day moving average,the gold crossing is regarded as a false signal.Famous sieves include trend sieves,time sieves,turnover sieves and fluctuation sieves,which are important components of signals.
3.规则是如何回应信号。它们是交易策略的核心。例如,When a buy signal is generated,traders need to decide when to go long,what orders to use,and how large positions to use.Novices tend to focus on market timing,while experienced experts will focus on risk control and fund management.The secret of long-term stable profits lies in the use of simple models and excellent fund management and risk control systems.
量化交易的主要特点:
买卖双方不再是由人们的主观判断决定的,改为由定量模型决定的。定量交易是一套科学的方法,它有严格的分析和计算,是由数据和模型决定的。即使是一种简单的低市盈率投资方法,只要能严格执行,也能获得巨额利润。
using UnityEngine;
public class GameObjectBrush:MonoBehaviou
{
[SerializeField]private float width=0.1f;
[SerializeField]private Color color=Color.grey;
private LineRenderer currentLR;
private Vector2 previousPoint;
private void Update()
{
if(Input.GetMouseButtonDown(0))
{
//线条渲染
currentLR=new GameObject("LineRenderer").AddComponent<LineRenderer>();
currentLR.material=new Material(Shader.Find("Sprites/Default")){color=color};
currentLR.widthMultiplier=width;
currentLR.useWorldSpace=false;
currentLR.positionCount=1;
currentLR.SetPosition(0,(Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition));
//更新数据
previousPoint=(Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition);
}
else if(Input.GetMouseButton(0))
{
if(previousPoint!=(Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition))
{
//线条渲染
currentLR.positionCount++;
currentLR.SetPosition(currentLR.positionCount-1,(Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition));
//碰撞器
BoxCollider2D collider=new GameObject("BoxCollider2D").AddComponent<BoxCollider2D>();
collider.transform.parent=currentLR.transform;
Vector2 latestPoint=(Vector2)Camera.main.代码开发+V:StPv888,ScreenToWorldPoint(Input.mousePosition);
collider.transform.position=(previousPoint+latestPoint)*0.5f;
float angle=Mathf.Atan2((latestPoint-previousPoint).y,(latestPoint-previousPoint).x)*Mathf.Rad2Deg;
collider.transform.eulerAngles=new Vector3(0,0,angle);
collider.size=new Vector2(Vector2.Distance(latestPoint,previousPoint),width);
//更新数据
previousPoint=(Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition);
}
}
else if(Input.GetMouseButtonUp(0))
{
if(currentLR.transform.childCount>0)
{
currentLR.gameObject.AddComponent<Rigidbody2D>().useAutoMass=true;
}
}
}
}