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

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

赫茲期貨股票量化交易軟件:交易軟件指標(biāo)和信號(hào)盈利能力的可視化優(yōu)化

2023-08-14 13:37 作者:bili_45793681098  | 我要投稿

簡(jiǎn)介

首先,對(duì)所有圣杯獵人和吹毛求疵者提醒一句:就像上一篇文章中介紹的工具一樣,此工具并不是能夠幫助你完全避免虧損而僅獲得收益的魔術(shù)棒。 它僅僅是一個(gè)能夠讓你快速進(jìn)行計(jì)算并以直觀的可視化形式顯示計(jì)算結(jié)果的工具。 指標(biāo)圖應(yīng)被視為交易者思考使用的交易戰(zhàn)術(shù)和信號(hào)所用到的資料。 然而,在短期(尤其是日內(nèi))交易中,此指標(biāo)可成為一個(gè)很方便的工具。

有關(guān)修改舊指標(biāo)并為其提供新的形式的想法源自于一條天真而真誠(chéng)的評(píng)論,此評(píng)論是與有關(guān) Expert Advisor 的說(shuō)明一起在赫茲量化的一個(gè)論壇帖子中發(fā)布的。 “2009 年做的很好。 到目前為止,我很滿意。 為了促進(jìn)信號(hào)監(jiān)控,我...” Expert Advisor 的確表現(xiàn)良好,根據(jù)其開(kāi)發(fā)者指定的交易品種和時(shí)間范圍進(jìn)行交易。 但是,任何更改參數(shù)的嘗試會(huì)將一個(gè)良好的執(zhí)行者變成一個(gè)赤裸裸的殺手,幾乎在瞬間就會(huì)失去所有保證金。 盡管 Expert Advisor 的開(kāi)發(fā)者并不打算將其用于真實(shí)交易,但在我的腦海里總是出現(xiàn)這樣的想法:如何能夠不僅檢查預(yù)期交易結(jié)果,還能夠評(píng)估交易行為、結(jié)果的穩(wěn)定性(如果你愿意的話)。 我希望能夠快速而明顯地直觀展示一些信號(hào)和交易戰(zhàn)術(shù)的無(wú)效性。 此外,我的腦海中還有另一個(gè)想法:Expert Advisor 可以使用現(xiàn)有參數(shù)產(chǎn)生可觀的獲利交易。 我曾經(jīng)認(rèn)為,如果我能夠像這樣手動(dòng)交易,我會(huì)對(duì)結(jié)果非常滿意。 假設(shè)能夠進(jìn)一步改進(jìn)結(jié)果將會(huì)怎樣? 一般說(shuō)來(lái),此問(wèn)題本身似乎很有趣,我開(kāi)始尋找解決此問(wèn)題的方式。



問(wèn)題定義

很顯然,解決方案需要我在文章“指標(biāo)和提醒的盈利能力的可視化測(cè)試”中的指標(biāo),這意味著大部分的工作已完成,只需要進(jìn)行升級(jí)。 之前的實(shí)現(xiàn)缺少什么? 很明顯,它是一種便捷的參數(shù)選擇機(jī)制。 每次都需要檢查指標(biāo)參數(shù),進(jìn)行更改,然后再使用歷史數(shù)據(jù)分析產(chǎn)生的圖和訂單行,這項(xiàng)工作很累人。 這是可以理解的 - 原始指標(biāo)用于檢查就緒信號(hào),而在這種情況下還需要其他東西。 那會(huì)是什么? 在 MT 中積極使用策略測(cè)試程序的人員對(duì)此必須有非常清晰的了解。 要評(píng)估交易結(jié)果,赫茲量化首先需要余額圖表和修改用于計(jì)算信號(hào)值的初始參數(shù)的可能性。



余額圖表

這是最簡(jiǎn)單的事情。由于所有操作都繪制在圖表中,每個(gè)操作的結(jié)果都是已知的,赫茲量化需要做的是獲得所有這些結(jié)果并將它們加起來(lái)作為運(yùn)行總計(jì)。 可在單獨(dú)的窗口中顯示增加(或減少)圖表。 為了滿足那些希望分析以幣值或點(diǎn)數(shù)表示的結(jié)果的人員的需求,我們應(yīng)提供合適的參數(shù)。

編輯切換為居中


三角形滑塊模擬

相比于需要與交易者交互的任務(wù),調(diào)整面向交易的自動(dòng)化平臺(tái)是一件困難得多的事情。 標(biāo)準(zhǔn)資源僅允許我實(shí)現(xiàn)一系列操作:選擇指標(biāo)、調(diào)用其屬性、修改參數(shù)和重新計(jì)算。 這種至少十幾個(gè)變量的迭代需要花費(fèi)大量的時(shí)間。 等到你獲得第十個(gè)變量的結(jié)果時(shí),你已經(jīng)完全忘記了第一個(gè)變量的結(jié)果。

由于操作系統(tǒng)的標(biāo)準(zhǔn) GUI 元素(按鈕、復(fù)選框、組合框、滑塊等)無(wú)法用于指標(biāo)和 EA(除非你打算使用以其他編程語(yǔ)言編寫(xiě)的 DLL 庫(kù)),我不得不尋找一個(gè)適當(dāng)?shù)奶娲?我決定調(diào)整一個(gè)三角形,一個(gè)可輕松添加到任何圖表的對(duì)象,用作為標(biāo)準(zhǔn)滑塊,它可以在給定的最小值到給定的最大值范圍內(nèi)更改值。 如果它的兩個(gè)頂點(diǎn)垂直(或水平)分布,同時(shí)第三個(gè)頂點(diǎn)在這兩個(gè)頂點(diǎn)之間移動(dòng),赫茲量化可以獲得一個(gè)相當(dāng)合適的線性滑塊模型。 此類滑塊的垂直位置能夠獲得一系列更加平滑(連續(xù))的值。 為了能夠同時(shí)更改多個(gè)參數(shù),我們需要實(shí)現(xiàn)單獨(dú)處理不同三角形的可能性。

已編寫(xiě)了一個(gè)用于處理三角形滑塊的特殊函數(shù):

double ParamValue(int ParamNo, string ParamName, double ParamValue, double vMin, double vMax, color clr) { ?double Triangle[3],vCur, WMax, WMin; datetime tt1, tt2; ?// if there is no triangle, create it ?if(ObjectFind(ParamName) < 0) ?{ ? ?// determine the chart boundaries in the current scale vertically ? ?WMax = WindowPriceMax(); ?WMin = WindowPriceMin(); ? ?// calculate the coordinates of points by time... ? ?tt1 = Time[0] + Period()*60*ParamNo*20; tt2 = tt1 + Period()*60*20; ? ?// ... and "price" ? ?vCur = WMin + (ParamValue - vMin) * (WMax - WMin) / (vMax - vMin); ? ?// create an object and fill it with the color specified in the parameters ? ?ObjectCreate(ParamName,OBJ_TRIANGLE, 0, tt1,WMax, tt2,vCur, tt1,WMin); ? ?ObjectSet(ParamName,OBJPROP_COLOR,clr); ?} ?// the triangle exists - get its coordinates ?Triangle[0] = ObjectGet(ParamName,OBJPROP_PRICE1); ?Triangle[1] = ObjectGet(ParamName,OBJPROP_PRICE2); ?Triangle[2] = ObjectGet(ParamName,OBJPROP_PRICE3); ?// arrange the vertices in the order of "increase" ?ArraySort(Triangle); ?// convert the midpoint coordinate to the scale of real values between vMin and vMax ?vCur = vMin + (Triangle[1] - Triangle[0]) / (Triangle[2] - Triangle[0]) * (vMax - vMin); ?// write the value to the object comment ?ObjectSetText(ParamName,DoubleToStr(vCur,2)); ?// return the value to the main module ?return(vCur); }

注釋提供了此函數(shù)算法的非常詳細(xì)的說(shuō)明,因此我們將僅限于介紹函數(shù)參數(shù)的用途。

ParamNo – 使用的參數(shù)數(shù)量(它決定三角形沿時(shí)間軸相互之間移動(dòng)的方式)。 然后,你可以根據(jù)需要更改它們的位置和大小。

ParamName – 參數(shù)名稱,必須是唯一的以區(qū)分三角形,而且對(duì)顯示在工具提示中有意義。

ParamValue – 初始參數(shù)值(用于正確地放置在最小值 vMin 和最大值 vMax 之間的中間頂點(diǎn),將在優(yōu)化過(guò)程中使用)。

сlr – 三角形的顏色。

以下代碼用于處理三角形:

MAPeriod ?= ParamValue(0, SliderPrefix+"MA Period", MAPeriod, 5, 35, Blue); RSIPeriod = ParamValue(1, SliderPrefix+"RSI Period", RSIPeriod, 2, 25, Red); RSILevel ?= ParamValue(2, SliderPrefix+"RSI Level", RSILevel, 5, 95, Orange);

獲得的值進(jìn)一步用于計(jì)算相應(yīng)的信號(hào)。

為了闡明指標(biāo)開(kāi)發(fā)和調(diào)試,我選擇了用戶提議的一個(gè)指標(biāo) <s1>Helen</s1> (<a2>HI_Line_E_RSI_MA.mq4</a2>),基本上是此指標(biāo)激勵(lì)了我做這一切。 盡管代碼基本上保持不變,但信號(hào)計(jì)算塊需要重新編寫(xiě),以便適合在我的指標(biāo)中使用:

// fill signal arrays with values and count their number ?for(i=DisplayBars;i>=0;i--) ?{ ? ?double t1=iRSI(NULL,0,RSIPeriod,MAPrice,i+1); ? ?double t11=iRSI(NULL,0,RSIPeriod,MAPrice,i+2); ? ?double t2=iMA(NULL,0,MAPeriod,0,MAMode,MAPrice,i+1); ? ?double t3=iMA(NULL,0,MAPeriod*3,0,MAMode,MAPrice,i+1); ? ?if (t1>RSILevel&&t11<RSILevel&&t1>t11&&t1>RSILevel&&t2>t3) {sBuy[i]=1; sBuyCnt++;} ? ?if (t1<(100-RSILevel)&&t11>(100-RSILevel)&&t1<t11&&t1<(100-RSILevel)) {sCloseBuy[i]=1; sBuyCloseCnt++;} ? ?if (t1<(100-RSILevel)&&t11>(100-RSILevel)&&t1<t11&&t1<(100-RSILevel)&&t2<t3) {sSell[i]=1; sSellCnt++; } ? ?if (t1>RSILevel&&t11<RSILevel&&t1>t11&&t1>RSILevel) {sCloseSell[i]=1; sSellCloseCnt++;} ?}

我決定先不使用第四個(gè)參數(shù) - 用于獲取長(zhǎng)移動(dòng)平均線的周期放大率。 因此,我只是使用了比主移動(dòng)平均線長(zhǎng)三倍的 移動(dòng)平均線 (MAPeriod*3)。 如果你需要的話,你可以自己輕松地實(shí)現(xiàn)這一點(diǎn)。

還在原始指標(biāo)中添加了余額曲線計(jì)算和顯示塊。

// plot the balance chart // get profit values one by one and add them up i2 = DisplayBars; bBallance[i2] = 0; for(i=DisplayBars-1;i>=0;i--) { if(bBallance[i] != 0) { bBallance[i2] = bBallance[i2+1] + bBallance[i]; i2--; ?} } double multiplier; if(ProfitInPoints) multiplier = 1; else multiplier = ToCurrency; for(i=0;i<DisplayBars-2;i++) bBallance[i] = bBallance[i+i2+1] * multiplier; SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,ProfitWidth,Blue);

第一個(gè)回路逐步添加了之前設(shè)置的操作利潤(rùn)值,而第二個(gè)回路將它們聚集成一堆,相互之間沒(méi)有空格。 因此,值得注意的是,尋找上圖表和下圖表之間的任何對(duì)應(yīng)關(guān)系沒(méi)有任何意義:建立訂單和關(guān)閉訂單垂直線與下圖表沒(méi)有任何關(guān)聯(lián)(這就是它們默認(rèn)被禁用的原因)。

結(jié)果,此指標(biāo)的文本如下:

/*///—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ? ?IndicatorOptimizer.mq4 ? ? ?Visual testing of profitability of indicators and alerts ? ? ? ?Copyright ? 2009, Sergey Kravchuk, http://forextools.com.ua /*///—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— #property copyright "Copyright ? 2006-2009, Sergey Kravchuk. http://forextools.com.ua" #property link ? ? ?"http://forextools.com.ua" #property indicator_separate_window #property indicator_buffers 1 #property indicator_level1 0 // parameters for displaying chart elements extern bool ? ShowZZ ? ? ? ? ?= true; ? ? ? ? ? // whether to draw ZZ extern bool ? ShowMARKERS ? ? = false; ? ? ? ? ? // whether to draw vertical marker lines extern int ? ?ProfitWidth ? ? = 1; extern bool ? ProfitInPoints ?= true; //chart plotting dates extern datetime DateStart ? ? = D'1.01.1970'; extern datetime DateEnd ? ? ? = D'31.12.2037'; //profit calculation parameters extern double LotForCalc ? ? ?= 0.05; ? ? ? ? ? // lot size for profit calculation // RSI indicator parameters extern int ? ?RSIPeriod ? ? ? = 8; ? ? ? ? ? ? ?// RSI calculation period extern int ? ?RSILevel ? ? ? ?= 73; ? ? ? ? ? ? // RSI calculation level // MA indicator parameters extern int ? ?MAPeriod ? ? ? ?= 20; ? ? ? ? ? ? // МА calculation period extern int ? ?MAMode ? ? ? ? ?= 3; ? ? ? ? ? ? ?// 0-MODE_SMA 1-MODE_EMA 2-MODE_SMMA 3-MODE_LWMA extern int ? ?MAPrice ? ? ? ? = 6; ? ? ? ? ? ? ?// 0-Close 1-Open 2-High 3-Low 4-(H+L)/2 5-(H+L+C)/3 6-(H+L+2*C)/4 // MACD indicator parameters extern double MACDOpenLevel ? = 3; ? ? ? ? ? ? ? extern double MACDCloseLevel ?= 2; extern double MATrendPeriod ? = 26; // colors of Buy lines extern color ?ColorProfitBuy ?= Blue; ? ? ? ? ? // line color for profitable Buys extern color ?ColorLossBuy ? ?= Red; ? ? ? ? ? ?// line color for unprofitable Buys extern color ?ColorZeroBuy ? ?= Gray; ? ? ? ? ? // line color for zero-profit Buys // colors of Sell lines extern color ?ColorProfitSell = Blue; ? ? ? ? ? // line color for profitable Sells extern color ?ColorLossSell ? = Red; ? ? ? ? ? ?// line color for unprofitable Sells extern color ?ColorZeroSell ? = Gray; ? ? ? ? ? // line color for zero-profit Sells // colors of signal lines extern color ?ColorBuy ? ? ? ?= CornflowerBlue; // Buy signal line color extern color ?ColorSell ? ? ? = HotPink; ? ? ? ?// Sell signal line color extern color ?ColorClose ? ? ?= Gainsboro; ? ? ?// line color of the signal for closing //————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— double sBuy[],sCloseBuy[],sSell[],sCloseSell[]; // arrays for signals int sBuyCnt,sSellCnt,sBuyCloseCnt,sSellCloseCnt;// signal counters int i,DisplayBars; double bBallance[]; // for the balance on operations int IndicatorWindowNo; ?// indicator window number //————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— // service codes #define MrakerPrefix "IO_" #define SliderPrefix "SL_" #define OP_CLOSE_BUY ?678 #define OP_CLOSE_SELL 876 //————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— int init() ? { ?SetIndexBuffer(0,bBallance); ?IndicatorShortName("IndicatorOptimizer"); ? ?return(0); } int deinit() { ?ClearMarkers(); ?ClearSliders(); ?return(0); } double ParamValue(int ParamNo, string ParamName, double ParamValue, double vMin, double vMax, color clr) { ?double Triangle[3],vCur, WMax, WMin; datetime tt1, tt2; ?// if there is no triangle, create it ?if(ObjectFind(ParamName) < 0) ?{ ? ?// determine the chart boundaries in the current scale vertically ? ?WMax = WindowPriceMax(); ?WMin = WindowPriceMin(); ? ?// calculate the coordinates of points by time... ? ?tt1 = Time[0] + Period()*60*ParamNo*20; tt2 = tt1 + Period()*60*20; ? ?// ... and "price" ? ?vCur = WMin + (ParamValue - vMin) * (WMax - WMin) / (vMax - vMin); ? ?// create an object and fill it with the color specified in the parameters ? ?ObjectCreate(ParamName,OBJ_TRIANGLE, 0, tt1,WMax, tt2,vCur, tt1,WMin); ? ?ObjectSet(ParamName,OBJPROP_COLOR,clr);


赫茲期貨股票量化交易軟件:交易軟件指標(biāo)和信號(hào)盈利能力的可視化優(yōu)化的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
和林格尔县| 泸定县| 义乌市| 海盐县| 孝感市| 边坝县| 溧水县| 叙永县| 大埔区| 大同市| 石景山区| 辽阳县| 泰兴市| 三门峡市| 若尔盖县| 达拉特旗| 陇南市| 九寨沟县| 六枝特区| 东阳市| 洪雅县| 梁山县| 伊吾县| 铜梁县| 榆社县| 镇平县| 麻江县| 滦平县| 枣阳市| 普定县| 新兴县| 社旗县| 夹江县| 开封县| 滦南县| 孝昌县| 东宁县| 南郑县| 黑龙江省| 柞水县| 岳西县|