最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

量化交易軟件:指標噴發(fā)整體特征的計算

2023-07-28 16:04 作者:bili_45793681098  | 我要投稿

簡介

指標噴發(fā)代表著時間序列研究領(lǐng)域的一種非常有前景的新方向。其特點在于:分析重點并不在于指標本身,而是其進入未來或過去的噴發(fā)。以此為基礎(chǔ),赫茲量化可以針對市場環(huán)境做出切實的預(yù)測:

  • 未來的支撐位和阻力位;

  • 趨勢方向(價格變動);

  • 過去積累的變動強度。

我的前一篇文章《用 MQL5 繪制指標的噴發(fā)》講述的是噴發(fā)繪制算法并指定其關(guān)鍵功能。我提醒一下大家:

噴發(fā)是所考慮的指標特定線交叉點上的一組點。

反過來,噴發(fā)點也有一些特性:

  • 同一類型的噴發(fā)點有集群傾向。

  • 密集的集群可吸引價格,或反過來排斥價格。

噴發(fā)圖集:


圖 1. 指標噴發(fā)標繪示例左:DCMV 指標的噴發(fā)。右:iMAiEnvelopes 指標的噴發(fā)。

在闡釋噴發(fā)整體特性計算的過程中,赫茲量化會如下處理移動平均線軌道線和帶有輸入?yún)?shù)的移動平均線本身:

//--- external variable for storing averaging period of the iEnvelopes indicator input int ? ma_period=140; // averaging period of the iEnvelopes indicator //--- array for storing deviations of the iEnvelopes indicator double ? ? ?ENV[]={0.01,0.0165,0.0273,0.0452,0.0747,01234,0.204,0.3373,0.5576,0.9217,1.5237}; //--- array for storing iMA indicator periods int ? ? ? ? MA[]={4,7,11,19,31,51,85};

這樣一來,赫茲量化會查找選定指標特有線的交叉點。線數(shù)及其特征(平均周期與方差)為隨機選擇。實際上,噴發(fā)可利用這些指標的任何一組參數(shù)來標繪(只要它們在空間上有交叉)。

現(xiàn)在,指標已選取,赫茲量化繼續(xù)創(chuàng)建一個 EA 交易,將來用其充當(dāng)噴發(fā)分析的一個基礎(chǔ)程序。我們需要從 iMAiEnvelopes 技術(shù)指標中獲取計算得出的數(shù)據(jù)。我提議使用《在 EA 交易中使用技術(shù)指標的指南》一文中講到的一種方法。

要標繪需要找到交點的線,赫茲量化只需為每條線設(shè)置兩個點。由此,只取得兩個柱的指標值(比如當(dāng)前和前一個柱)就足夠了。前一柱上的價格是靜態(tài),而當(dāng)前柱上的價格為動態(tài),因此每一新的價格變動均會持續(xù)生成新點。代碼如下:

//+------------------------------------------------------------------+ //| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?emission_of_MA_envelope.mq5 | //| ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Copyright 2013, DC2008 | //| ? ? ? ? ? ? ? ? ? ? ? ? ? https://www.mql5.com/ru/users/DC2008 | //+------------------------------------------------------------------+ #property copyright "Copyright 2013, DC2008" #property link ? ? ?"https://www.mql5.com/ru/users/DC2008" #property version ? "1.00" //--- #include <GetIndicatorBuffers.mqh> #include <Emission.mqh> //--- external variable for storing averaging period of the iEnvelopes indicator input int ? ma_period=140; ? ? ?// averaging period of the iEnvelopes indicator //--- array for storing deviations of the iEnvelopes indicator double ? ? ?ENV[]={0.01,0.0165,0.0273,0.0452,0.0747,01234,0.204,0.3373,0.5576,0.9217,1.5237}; //--- array for storing the iMA indicator periods int ? ? ? ? MA[]={4,7,11,19,31,51,85}; //--- array for storing pointers to the iMA and iEnvelopes indicators int ? ? ? ? handle_MA[]; int ? ? ? ? handle_Envelopes[]; //--- market data datetime ? ?T[],prevTimeBar=0; double ? ? ?H[],L[]; #define ? ? HL(a, b) (a+b)/2 //--- class instances CEmission ? ? ?EnvMa(0,300); PointEmission ?pEmission; //--- drawing styles for points of emission #define ? ? COLOR_UPPER ?C'51,255,255' #define ? ? COLOR_LOWER ?C'0,51,255' #define ? ? COLOR_MA ? ? C'255,51,255' color ? ? ? colorPoint[]={COLOR_UPPER,COLOR_LOWER,COLOR_MA}; CodeColor ? styleUpper={158,COLOR_UPPER,SMALL}; CodeColor ? styleLower={158,COLOR_LOWER,SMALL}; CodeColor ? styleMA={158,COLOR_MA,SMALL}; //+------------------------------------------------------------------+ //| Expert initialization function ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | //+------------------------------------------------------------------+ int OnInit() ?{ ? ArraySetAsSeries(T,true); ? ArraySetAsSeries(H,true); ? ArraySetAsSeries(L,true); //--- ? int size=ArraySize(MA); ? ArrayResize(handle_MA,size); //--- create a pointer to the object - the iMA indicator ? for(int i=0; i<size; i++) ? ? { ? ? ?handle_MA[i]=iMA(NULL,0,MA[i],0,MODE_SMA,PRICE_MEDIAN); ? ? ?//--- if an error occurs when creating the object, print the message ? ? ?if(handle_MA[i]<0) ? ? ? ?{ ? ? ? ? Print("The iMA object[",MA[i],"] has not been created: Error = ",GetLastError()); ? ? ? ? //--- forced program termination ? ? ? ? return(-1); ? ? ? ?} ? ? } //--- ? size=ArraySize(ENV); ? ArrayResize(handle_Envelopes,size); //--- create a pointer to the object - the iEnvelopes indicator ? for(int i=0; i<size; i++) ? ? { ? ? ?handle_Envelopes[i]=iEnvelopes(NULL,0,ma_period,0,MODE_SMA,PRICE_MEDIAN,ENV[i]); ? ? ?//--- if an error occurs when creating the object, print the message ? ? ?if(handle_Envelopes[i]<0) ? ? ? ?{ ? ? ? ? Print("The iEnvelopes object[",ENV[i],"] has not been created: Error = ",GetLastError()); ? ? ? ? //--- forced program termination ? ? ? ? return(-1); ? ? ? ?} ? ? } //--- ? return(0); ?} //+------------------------------------------------------------------+ //| Expert deinitialization function ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | //+------------------------------------------------------------------+ void OnDeinit(const int reason) ?{ //--- ?} //+------------------------------------------------------------------+ //| Expert tick function ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | //+------------------------------------------------------------------+ void OnTick() ?{ //--- market data ? CopyTime(NULL,0,0,2,T); ? CopyHigh(NULL,0,0,2,H); ? CopyLow(NULL,0,0,2,L); //--- fill the declared arrays with current values from all indicator buffers ? string name; ? uint GTC=GetTickCount(); //---- indicator buffers ? double ? ibMA[],ibMA1[]; ? ? ?// arrays for the iMA indicator ? double ? ibEnvelopesUpper[]; ?// array for the iEnvelopes indicator (UPPER_LINE) ? double ? ibEnvelopesLower[]; ?// array for the iEnvelopes indicator (LOWER_LINE) ? for(int i=ArraySize(handle_MA)-1; i>=0; i--) ? ? { ? ? ?if(!CopyBufferAsSeries(handle_MA[i],0,0,2,true,ibMA)) ? ? ? ? return; ? ? ?//--- ? ? ?for(int j=ArraySize(handle_Envelopes)-1; j>=0; j--) ? ? ? ?{ ? ? ? ? if(!GetEnvelopesBuffers(handle_Envelopes[j],0,2,ibEnvelopesUpper,ibEnvelopesLower,true)) ? ? ? ? ? ?return; ? ? ? ? //--- find the intersection point of the iEnvelopes(UPPER_LINE) and iMA indicators ? ? ? ? pEmission=EnvMa.CalcPoint(ibEnvelopesUpper[1],ibEnvelopesUpper[0],ibMA[1],ibMA[0],T[0]); ? ? ? ? if(pEmission.real) // if the intersection point is found, draw it in the chart ? ? ? ? ? { ? ? ? ? ? ?name="iEnvelopes(UPPER_LINE)"+(string)j+"=iMA"+(string)i+(string)GTC; ? ? ? ? ? ?EnvMa.CreatePoint(name,pEmission,styleUpper); ? ? ? ? ? } ? ? ? ? //--- find the intersection point of the iEnvelopes(LOWER_LINE) and iMA indicators ? ? ? ? pEmission=EnvMa.CalcPoint(ibEnvelopesLower[1],ibEnvelopesLower[0],ibMA[1],ibMA[0],T[0]); ? ? ? ? if(pEmission.real) // if the intersection point is found, draw it in the chart ? ? ? ? ? { ? ? ? ? ? ?name="iEnvelopes(LOWER_LINE)"+(string)j+"=iMA"+(string)i+(string)GTC; ? ? ? ? ? ?EnvMa.CreatePoint(name,pEmission,styleLower); ? ? ? ? ? } ? ? ? ?} ? ? ?//--- ? ? ?for(int j=ArraySize(handle_MA)-1; j>=0; j--) ? ? ? ?{ ? ? ? ? if(i!=j) ? ? ? ? ? { ? ? ? ? ? ?if(!CopyBufferAsSeries(handle_MA[j],0,0,2,true,ibMA1)) ? ? ? ? ? ? ? return; ? ? ? ? ? ?//--- find the intersection point of the iMA and iMA indicators ? ? ? ? ? ?pEmission=EnvMa.CalcPoint(ibMA1[1],ibMA1[0],ibMA[1],ibMA[0],T[0]); ? ? ? ? ? ?if(pEmission.real) // if the intersection point is found, draw it in the chart ? ? ? ? ? ? ?{ ? ? ? ? ? ? ? name="iMA"+(string)j+"=iMA"+(string)i+(string)GTC; ? ? ? ? ? ? ? EnvMa.CreatePoint(name,pEmission,styleMA); ? ? ? ? ? ? ?} ? ? ? ? ? } ? ? ? ?} ? ? } //--- deletion of the graphical objects of emission not to stuff the chart ? if(T[0]>prevTimeBar) // delete once per bar ? ? { ? ? ?int ?total=ObjectsTotal(0,0,-1); ? ? ?prevTimeBar=T[0]; ? ? ?for(int obj=total-1;obj>=0;obj--) ? ? ? ?{ ? ? ? ? string obj_name=ObjectName(0,obj,0,OBJ_TEXT); ? ? ? ? datetime obj_time=(datetime)ObjectGetInteger(0,obj_name,OBJPROP_TIME); ? ? ? ? if(obj_time<T[0]) ? ? ? ? ? ?ObjectDelete(0,obj_name); ? ? ? ?} ? ? ?Comment("Emission ? DC2008 ? ? ? Objects = ",total); ? ? } //--- ?}

我不會詳細講解此 EA 交易的每一個細節(jié)。這里要注意的主要就是標繪噴發(fā),赫茲量化采用負責(zé)任何兩條線交叉點的計算和顯示的 CEmission 類實例。


量化交易軟件:指標噴發(fā)整體特征的計算的評論 (共 條)

分享到微博請遵守國家法律
香港 | 措勤县| 商南县| 玛纳斯县| 临泽县| 分宜县| 房山区| 庐江县| 全州县| 阜康市| 澳门| 海晏县| 西林县| 黄龙县| 正定县| 长子县| 涿州市| 黄大仙区| 巴里| 延吉市| 通许县| 信丰县| 宣化县| 广州市| 万年县| 通州区| 宜黄县| 阿克陶县| 漳平市| 黔东| 新龙县| 无锡市| 凤翔县| 古丈县| 化隆| 黎川县| 鹤壁市| 马尔康县| 六盘水市| 法库县| 岑溪市|