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

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

股票量化軟件:燭臺方向統(tǒng)計再現(xiàn)的研究

2023-07-20 15:15 作者:大牛啊呢  | 我要投稿


燭臺方向上的重復變化表明趨勢產(chǎn)生了變化。

首先我們要在某些條款上達成一致。 盡管這些條款是常用的,但我們還是要再過一遍,避免曲解。 如果燭臺的開盤價小于收盤價 - 則被稱為上升燭(在給出的圖形中,它們均涂以白色),反之則為下降燭,均涂以黑色。 如果開盤價等于收盤價,這些燭臺將被稱為等價燭臺(我自己的術語)。 如果報價下跌了一段時間,則這段時間是下跌趨勢,反之則為上漲趨勢。

我們看一看圖片:

編輯

?

編輯

圖 1 USDJPY 的 4 小時時間范圍的燭臺圖,時間范圍為 2009 年 11 月 20 日至 2009 年 12 月 8 日

如圖 1 中所示,如果是下跌趨勢,則形成此趨勢的燭臺大部分是下跌的,如果是上漲趨勢,則燭臺也是上漲的。 如果是橫向的,則燭臺也會不停變換其方向。赫茲量化軟件

實際上,我們的問題?是確定燭臺中是否有再現(xiàn)情況,以及它相對于趨勢的變更會作出怎樣的反應?。赫茲量化軟件

當然,所有這些都可以手動完成,例如我們可以采用小時圖或任何其他類型的圖,在紙上寫下燭臺方向,并相互比較一段時間。 工作有很多,但都能完成。 不過我們還有 MQL4 編程語言這個神奇的工具,我們可以用它輕松創(chuàng)建 Expert Advisor,它將自己進行所有計算并告知我們計算結果的所有相關信息。

所以,我們要做的是:


  • 首先我們必須能夠指定一個感興趣的時間段。 15 分鐘燭臺是不太可能有的,因為在過去幾年,每天在 7 點 15 分時百分百是下跌趨勢。 然而,因為這種情況發(fā)生的概率雖小但仍存在,所以我們必須能夠至少對過去六個月的時段測試這種情況。


  • 第二,最好是能夠了解所研究期間有多少燭臺是上升燭,有多少是下降燭。 你必須同意這一點:如果在過去 10 天內(nèi),在 18:00 打開的小時燭臺上升了 6 次,下降了 4 次,則此信息不太可能會給我們提供重要的參考。 現(xiàn)在,如果 10 次中有 9 次下降,則此信息需被納入考慮范圍,用于確定今天 18:00 在哪個方向上建倉等。赫茲量化軟件


  • 第三,最好還能了解燭臺開盤價和收盤價之間的平均差距,以及它們在給定時段內(nèi)的平均高度。


  • 第四,我們應能夠在不同時間范圍上執(zhí)行我們的計算。赫茲量化軟件

所有這些都可在給出的腳本的外部變量?script_Statistics_candles 中定義?。

現(xiàn)在看看下圖。

編輯

圖 2 腳本的輸入?yún)?shù)

圖 2 顯示可在腳本中更改的輸入?yún)?shù)。

Open_session?- 研究時段的開始時間

Close_session -?研究時段的結束時間

Period_time?- 腳本考慮燭臺再現(xiàn)可能性時所處的時間范圍。 可取以下值之一 - 5、15、30、60、240。 請記住這些值,其他值都不是允許值。 相應地,這些值對應于 5 分鐘、15 分鐘、30 分鐘、1 小時和 4 小時的圖形周期。

下面是腳本代碼。 我在代碼中添加了盡可能多的注釋,因為我自己也在學習一本關于 MQL4 的教材,并且經(jīng)常求助于此網(wǎng)站上的 Expert Advisor,尤其是帶詳細注釋的 Expert Advisor。 應該承認,對于剛接觸 MQL4 的新手來說,此網(wǎng)站上的任何文章(除了其他東西)都有教學價值。

//+------------------------------------------------------------------+ //|???????????????????????????????? script_Statistics_candles_V2.mq4 | //|??????????????????????????????Copyright ? 2009, Igor Aleksandrov??| //|????????????????????????????????????????????????sydiya@rambler.ru | //+------------------------------------------------------------------+ #property copyright "Copyright ? 2009, Igor Aleksandrov" #property link??????"sydiya@rambler.ru" #property show_inputs //---- Input parameters extern string??Open_session ="2009.11.20";?? //Date of the opening of the studied session extern string??Close_session = "2009.11.26"; //Date of the closing of the studied session extern int???? Period_time = 60;???????????? //Period of the graph on which the Expert Advisor will be working, ???????????????????????????????????????????? //can take the value of 5;15;30;60;240 //----------------------------------------------------------------- int ????Day_bars_i;??????????????????????//Number for i bar in session double ????Mas_vira_maina[24,60]={0,0 0,0}, //Declare an array for bars with an equal opening-closing price ????Mas_vira[24,60]={0,0 0,0},?????? //Declare an array for calculating bullish bars ????Mas_maina[24,60]={0,0 0,0},??????//Declare an array for calculating bearish bars ????Mas_kol_vo[24,60]={0,0 0,0},???? //Declare an array for calculating the number of the counted bars ????Mas_profit[24,60]={0,0 0.0},???? //Declare an array of the calculation of profit by open-close ????Mas_H_L[24,60]={0,0 0.0};????????//Declare an array of calculating the profit by high-low string Symb;???????????????????????? //Name of the financial. instrument on which the script is executed bool New_day = false;????????????????//Flag of the new day //-------------------------------------------------------------------- //----------------------------Starting-------------------------------- int start() ??{??????????????????????????????????//-general opening bracket ?? ??Print("----------------------------------------------------------------------"); ??Print("??Results of the script's work- Statistics_candles- ",TimeToStr(TimeCurrent()) ); ??Print("??Calculations completed from ",Open_session," to ",Close_session); //------------------------Declare the variables ---------------------- ??int?? ?????? Hour_open_bars,??????????????????//Number of the hour of opening the i bar in session ?????? Minute_open_bars,????????????????//Number of the minute of opening??i bar in session ?????? Shift_open,??????????????????????//Number of bar with opening time Open_session?????????????? ?????? Shift_close,???????????????????? //Number of bar with opening time Close_session ?????? Shift_open_close,????????????????//Number of bars in session ?????? Total_day=0;???????????????????? //Counter of counted days???? ???????????????????? ??double Open_bars_price,?????????????? //Price of opening i bar of the session ???????? Close_bars_price,??????????????//Price of closing the i bar of the session ???????? Low_bars_price,????????????????//Minimum price of the i bar of the session ???????? High_bars_price,?????????????? //Maximum price of the i bar of the session ???????? Total_bars=0;??????????????????//Number of studied bars at the start of the script ???????? ??datetime Time_open_session,?????????? //Opening time of the first bar of the studied session ????????????????????????????????????????//in datatime format?????????? ?????????? Time_close_session,??????????//Opening time of the last bar of the studying ????????????????????????????????????????//session in datatime format ?????????? Time_open_bars;??????????????//Opening time of bars in datatime format ?????????????????????? ??bool??Session_vira=false,???????????? //Flag of the bullish session ????????Session_maina=false;????????????//Flag of the bearish session //-----------------------End of the variables declaration ------------------ ?????????????????? ??Symb=Symbol();????????????????????????//Name of the financial instrument ?? ??//Request the starting time of the studied session in datatime format ??Time_open_session= StrToTime(Open_session); ??//Request the closing time of the studied session in datatime format ??Time_close_session= StrToTime(Close_session); ??//Request the number of the bar, opening the session ??Shift_open=iBarShift( Symb,Period_time, Time_open_session,false); ??//Request the number of the bar, which closes the session ??Shift_close=iBarShift( Symb,Period_time, Time_close_session,false); //---------------------------------------------------------------------?? for(int i = Shift_open; i>=Shift_close; i --)????????//Cycle of bar searching in the session { //Opening bracket of the search cycle of bars ????Total_bars++;????????????????????????????????????//Counter of the number of studied bars ????static int New_day_shift=0;??????????????????????//Number of the day of starting the Expert Advisor ????//Request the opening of the i bar in session ????Time_open_bars=iTime( Symb,Period_time,Shift_open-Total_bars); ????//Request the opening hour of the i bar in session ????Hour_open_bars=TimeHour(Time_open_bars); ????//Request the opening minute of the i bar in session ????Minute_open_bars=TimeMinute(Time_open_bars); ????//Request the day number for the i bar in session ????Day_bars_i=TimeDayOfYear( Time_open_bars); ???? ????//If the number for the first bar in session is not equal to the i-th bar of the day,then ????if(New_day_shift!=Day_bars_i)?? ??????{???????????????????????????????????? ???????? New_day = true;?????????????? //flag for the new day is true ???????? New_day_shift=Day_bars_i;???? //and assign the number for the number of the i bar ???????? Total_day++;??????????????????//Increase the day counter by one ??????}?? ??????else???????????????????????????? //otherwise, ??????{ ??????New_day = false;???????????????? //Flag for the new day is false ??????}?????? ?????? //Request the opening price of the i-th bar ?????? Open_bars_price= iOpen( Symb, Period_time,i); ?????? //Request the closing price of the i-th bar ?????? Close_bars_price=iClose( Symb, Period_time,i); ?????? //Request the minimum price of the i-th bar ?????? Low_bars_price=iLow( Symb, Period_time,i); ?????? //Request the maximum price of the i-th bar ?????? High_bars_price=iHigh( Symb, Period_time,i); ???????? ?????? //If the opening price of the bar is lower than the closing price, then the session is bullish ?????? if(Open_bars_price<Close_bars_price) ??????????{?????????????????????????????????????? ??????????//Increase by one the values of the corrsponding element ??????????Mas_vira[Hour_open_bars,Minute_open_bars]=Mas_vira[Hour_open_bars,Minute_open_bars]+1; ??????????//Increase by one the values of the corrsponding element ??????????Mas_kol_vo[Hour_open_bars,Minute_open_bars]=Mas_kol_vo[Hour_open_bars,Minute_open_bars]+1; ??????????//Save the difference between the opening and closing price in points ??????????Mas_profit[Hour_open_bars,Minute_open_bars]= ??????????Mas_profit[Hour_open_bars,Minute_open_bars]+(Close_bars_price-Open_bars_price)/Point; ??????????//Save the difference between the maximum and minimum price in points ??????????Mas_H_L[Hour_open_bars,Minute_open_bars]= ??????????Mas_H_L[Hour_open_bars,Minute_open_bars]+(High_bars_price-Low_bars_price)/Point; ??????????}?????????? ?????? //If the opening price of the bar is higher than the closing price, then the session is bearish ?????? if(Open_bars_price>Close_bars_price) ??????????{ ?????????? //Increase by one the values of the corrsponding element ?????????? Mas_maina[Hour_open_bars,Minute_open_bars]=Mas_maina[Hour_open_bars,Minute_open_bars]+1; ?????????? //Increase by one the values of the corrsponding element ?????????? Mas_kol_vo[Hour_open_bars,Minute_open_bars]=Mas_kol_vo[Hour_open_bars,Minute_open_bars]+1; ??????????//Save the difference between the opening and closing price in points ?????????? Mas_profit[Hour_open_bars,Minute_open_bars]= ?????????? Mas_profit[Hour_open_bars,Minute_open_bars]+(Open_bars_price-Close_bars_price)/Point; ??????????//Save the difference between the maximum and minimum price in points ?????????? Mas_H_L[Hour_open_bars,Minute_open_bars]= ?????????? Mas_H_L[Hour_open_bars,Minute_open_bars]+(High_bars_price-Low_bars_price)/Point; ??????????} ????????//If the opening price is equal to the closing price, then session is undefined ????????if(Open_bars_price==Close_bars_price) ??????????{ ?????????? ///Increase by one the corresponding array elements ?????????? Mas_vira_maina[Hour_open_bars,Minute_open_bars]=Mas_vira_maina[Hour_open_bars,Minute_open_bars]+1; ?????????? //Increase by one the corresponding array elements ?????????? Mas_kol_vo[Hour_open_bars,Minute_open_bars]=Mas_kol_vo[Hour_open_bars,Minute_open_bars]+1; ?????????? ?????????? //Leave the value of the array as is ?????????? Mas_profit[Hour_open_bars,Minute_open_bars]= ?????????? Mas_profit[Hour_open_bars,Minute_open_bars]+0; ?????????? //Save the difference between maximum and minimum bar prices in points ?????????? Mas_H_L[Hour_open_bars,Minute_open_bars]= ?????????? Mas_H_L[Hour_open_bars,Minute_open_bars]+(High_bars_price-Low_bars_price)/Point; ??????????}?????????????????????????????????????????????????????????????????????????? ?????? } //Closing bracket of the bar search cycle //--------------------------Print the information to the Expert Advisor Journal------------------- Print("Processed - ",Total_day," days; ",Total_bars," bars, period ",Period_time," minutes"); for (int h=0; h<=23; h++) //Hours cycle { ??for (int m=0; m<=60; m++) //Minutes cycle ?? { ????if (Mas_kol_vo[h,m]!=0) //If the value of array is not equal to zero, then we continue counting ????{???? ??Print("For the period there are ",Mas_kol_vo[h,m], ?????? " bars with the time of the opening ",h,":",m, ?????? " .Bullish- ",Mas_vira[h,m], ?????? ".Bearish- ",Mas_maina[h,m], ?????? ".Equal - ",Mas_vira_maina[h,m]); ??Print("For the bars with the opening time ",h,":",m, ?????? " ,average distance between the Open-Close prices - ",Mas_profit[h,m]/Mas_kol_vo[h,m], ?????? " points. Between the High-Low prices - ",Mas_H_L[h,m]/Mas_kol_vo[h,m]," points.");?? ???? } ?????????? Mas_vira_maina[h,m]=0;??//set to zero ?????????? Mas_vira[h,m]=0;????????//set to zero ?????????? Mas_maina[h,m]=0;?????? //set to zero ?????????? Mas_kol_vo[h,m]=0;??????//set to zero ?????????? Mas_profit[h,m]=0;??????//set to zero ?????????? Mas_H_L[h,m]=0;???????? //set to zero ?? } //End of the minute cycle } //End of the hour cycle ???????????? Print("-------------- Script completed the work --------------------"); ?? return(0);???? ??}????????????????????????????????????????//-general closing bracket

如你所見,我宣布了六個正在計算的全局級數(shù)組。

double???? Mas_vira_maina[24,60]={0,0 0,0}, //Declare the bar array with an equal price of opening-closing Mas_vira[24,60]={0,0 0,0},?????? //Declare the array for calculating the bullish bars Mas_maina[24,60]={0,0 0,0},??????//Declare the array for calculating the bearish bars Mas_kol_vo[24,60]={0,0 0,0},???? //Declare the array for calculating the number of counted bars Mas_profit[24,60]={0,0 0.0},???? //Declare the array for calculating the profit for open-close Mas_H_L[24,60]={0,0 0.0};????????//Declare the array for calculating the profit for high-low


我們將把條柱計數(shù)記錄到?Mas_kol_vo?緩沖區(qū)中。 這么做的理由。 看起來,建倉-平倉和最高價-最低價的單元格數(shù)組的值能被計數(shù)天數(shù)除,尤其是代碼中有計數(shù)器時 -?Total_day?。 但我在處理腳本的過程中碰到了一個問題,即歷史記錄中缺少某些條柱,因此結果看上去非常有趣。 例如,所獲得的某些條柱的高度完全是不現(xiàn)實的。赫茲量化軟件

注釋中可以很明顯地看出剩余數(shù)組的用途。赫茲量化軟件

實際上現(xiàn)在要檢查不同趨勢方向時的條柱的可重復性。 為此,讓我們以 USDJPY 的小時圖為例,如圖 1 中所示。 我們可以看到,在 2009 年 11 月 20 日至 2009 年 11 月 26 日這段時間內(nèi),圖中呈下跌趨勢;從 2009 年 11 月 26 日至 2009 年 12 月 2 日,呈橫盤趨勢;從 2009 年 12 月 2 日至 2009 年 12 月 8 日,圖中表現(xiàn)出上漲趨勢。赫茲量化軟件

讓我們檢查這段時間內(nèi)是否有重復燭臺,如果有,則算出其變更方向。赫茲量化軟件

將腳本設置為小時圖。 對于不明白怎么做的讀者,我會提供更詳細的說明。 將腳本?script_Statistics_candles_V2.mq4?下載到文件夾 \Program Files\TerminalName\expert\scripts 中。 復制。 腳本顯示在“瀏覽器”窗口的左下角。 看起來就像這樣:

編輯

赫茲量化軟件

如果你用鼠標將腳本從此窗口拖動到終端窗口,你將看到一個屬性窗口 - 圖 2. 指定計算的開始和結束日期。赫茲量化軟件


股票量化軟件:燭臺方向統(tǒng)計再現(xiàn)的研究的評論 (共 條)

分享到微博請遵守國家法律
阿合奇县| 雷州市| 遂川县| 志丹县| 永年县| 宁阳县| 辽阳市| 星子县| 博乐市| 寿阳县| 商都县| 洛阳市| 满洲里市| 汕尾市| 钟山县| 隆林| 沾化县| 莱州市| 镶黄旗| 万荣县| 阜城县| 长垣县| 武宁县| 潜山县| 大悟县| 佛学| 洱源县| 竹山县| 长子县| 新郑市| 宜春市| 垫江县| 安国市| 望都县| 新乐市| 紫云| 通城县| 长宁县| 万源市| 泽普县| 板桥市|