[求助]老師能幫忙吧MT5的這個(gè)MACD改成WH7的嗎 [文華財(cái)經(jīng)]

  • 咨詢內(nèi)容: ??
    取指標(biāo)數(shù)據(jù)
    通過(guò)獲取系統(tǒng)自帶的MACD指標(biāo)數(shù)據(jù),進(jìn)行變色重建,實(shí)現(xiàn)起來(lái)非常方便,可以直接取到需要的數(shù)據(jù)。需要先建立指標(biāo)句柄,再用CopyBuffer()函數(shù)取數(shù)據(jù)。
    intmacd_handle?=0;macd_handle?=iMACD(Symbol(),Period(),12,26,9,PRICE_CLOSE);//取指標(biāo)數(shù)據(jù)CopyBuffer(macd_handle,0,0,rates_total,macdBuffer);CopyBuffer(macd_handle,1,0,rates_total,signalBuffer);
    填充緩沖區(qū)

    生成自定義指標(biāo),其實(shí)就是填充緩沖區(qū)的過(guò)程,將指標(biāo)線、柱圖、填充區(qū)、箭頭緩沖區(qū)數(shù)據(jù)進(jìn)行賦值,就可以實(shí)現(xiàn)我們需要的效果。
    在填充箭頭緩沖區(qū)時(shí),需要更改箭頭的樣式,并且只是在雙線出現(xiàn)金叉、死叉時(shí)才賦值,所以還需要將0值位置設(shè)為空繪制區(qū)PLOT_EMPTY_VALUE。
    ??PlotIndexSetInteger(5,PLOT_ARROW,225);??PlotIndexSetInteger(6,PLOT_ARROW,226);??PlotIndexSetDouble(5,PLOT_EMPTY_VALUE,0);??PlotIndexSetDouble(6,PLOT_EMPTY_VALUE,0);

    需要注意的是,采用循環(huán)遍歷賦值的方式,循環(huán)變量起始值在初始加載指標(biāo)時(shí)為1,加載之后為prev_calculated?-?1,這樣在循環(huán)體內(nèi),即加載了所有歷史數(shù)據(jù),也實(shí)時(shí)更新最新數(shù)據(jù),不會(huì)重新計(jì)算所有歷史值。
    //給緩沖區(qū)賦值,起始值intstart?=1;if(prev_calculated?>1)???{?????start?=?prev_calculated?-1;???}for(inti?=?start;?i?<?rates_total;?i++)??{//循環(huán)體??}


    實(shí)現(xiàn)源碼
    #propertycopyright"->?wentxiong"#propertylink??????"https://www.mql5.com/zh/users/xiongsir/seller"#propertyversion??"1.00"#propertyindicator_separate_window#propertyindicator_buffers12#propertyindicator_plots??7//---?plot?macd#propertyindicator_label1??"macd"#propertyindicator_type1??DRAW_LINE#propertyindicator_color1??clrRed#propertyindicator_style1??STYLE_SOLID#propertyindicator_width1??1//---?plot?signal#propertyindicator_label2??"signal"#propertyindicator_type2??DRAW_LINE#propertyindicator_color2??clrBlue#propertyindicator_style2??STYLE_SOLID#propertyindicator_width2??1//---?plot?upper#propertyindicator_label3??"upper"#propertyindicator_type3??DRAW_COLOR_HISTOGRAM#propertyindicator_color3??clrPurple,clrDimGray#propertyindicator_style3??STYLE_SOLID#propertyindicator_width3??2//---?plot?down#propertyindicator_label4??"down"#propertyindicator_type4??DRAW_COLOR_HISTOGRAM#propertyindicator_color4??clrPurple,clrDimGray#propertyindicator_style4??STYLE_SOLID#propertyindicator_width4??2//---?plot?fill#propertyindicator_label5??"fill"#propertyindicator_type5??DRAW_FILLING#propertyindicator_color5??clrRed,clrBlue#propertyindicator_style5??STYLE_SOLID#propertyindicator_width5??1//---?plot?arrow#propertyindicator_label6??"arrow"#propertyindicator_type6??DRAW_COLOR_ARROW#propertyindicator_color6??clrRed,clrBlue#propertyindicator_style6??STYLE_SOLID#propertyindicator_width6??1#propertyindicator_label7??"arrow2"#propertyindicator_type7??DRAW_COLOR_ARROW#propertyindicator_color7??clrRed,clrBlue#propertyindicator_style7??STYLE_SOLID#propertyindicator_width7??1//---?indicator?buffersdouble?????????macdBuffer[];double?????????signalBuffer[];double?????????upperBuffer[];double?????????upperColors[];double?????????downBuffer[];double?????????downColors[];double?????????fillBuffer1[];double?????????fillBuffer2[];double?????????arrowBuffer[];double?????????arrowColors[];double?????????arrow2Buffer[];double?????????arrow2Colors[];intmacd_handle?=0;//+------------------------------------------------------------------+//|?Custom?indicator?initialization?function?????????????????????????|//+------------------------------------------------------------------+intOnInit()??{//---?indicator?buffers?mapping??SetIndexBuffer(0,macdBuffer,INDICATOR_DATA);??SetIndexBuffer(1,signalBuffer,INDICATOR_DATA);??SetIndexBuffer(2,upperBuffer,INDICATOR_DATA);??SetIndexBuffer(3,upperColors,INDICATOR_COLOR_INDEX);??SetIndexBuffer(4,downBuffer,INDICATOR_DATA);??SetIndexBuffer(5,downColors,INDICATOR_COLOR_INDEX);??SetIndexBuffer(6,fillBuffer1,INDICATOR_DATA);??SetIndexBuffer(7,fillBuffer2,INDICATOR_DATA);??SetIndexBuffer(8,arrowBuffer,INDICATOR_DATA);??SetIndexBuffer(9,arrowColors,INDICATOR_COLOR_INDEX);??SetIndexBuffer(10,arrow2Buffer,INDICATOR_DATA);??SetIndexBuffer(11,arrow2Colors,INDICATOR_COLOR_INDEX);//---?setting?a?code?from?the?Wingdings?charset?as?the?property?of?PLOT_ARROW??PlotIndexSetInteger(5,PLOT_ARROW,225);??PlotIndexSetInteger(6,PLOT_ARROW,226);??PlotIndexSetDouble(5,PLOT_EMPTY_VALUE,0);??PlotIndexSetDouble(6,PLOT_EMPTY_VALUE,0);//指標(biāo)handle???macd_handle?=iMACD(Symbol(),Period(),12,26,9,PRICE_CLOSE);//---??return(INIT_SUCCEEDED);??}//+------------------------------------------------------------------+//|?Custom?indicator?iteration?function??????????????????????????????|//+------------------------------------------------------------------+intOnCalculate(constintrates_total,????????????????constintprev_calculated,????????????????constdatetime&time[],????????????????constdouble&open[],????????????????constdouble&high[],????????????????constdouble&low[],????????????????constdouble&close[],????????????????constlong&tick_volume[],????????????????constlong&volume[],????????????????constint&spread[])??{//---??CopyBuffer(macd_handle,0,0,rates_total,macdBuffer);??CopyBuffer(macd_handle,1,0,rates_total,signalBuffer);??intstart?=1;??if(prev_calculated?>1)?????{??????start?=?prev_calculated?-1;?????}??for(inti?=?start;?i?<?rates_total;?i++)?????{??????if(macdBuffer[i]?>?signalBuffer[i])????????{?????????upperBuffer[i]?=?macdBuffer[i]?-?signalBuffer[i];????????}??????else????????{?????????downBuffer[i]?=?macdBuffer[i]?-?signalBuffer[i];????????}??????if(upperBuffer[i]?>?upperBuffer[i?-1])????????{?????????upperColors[i]?=0;????????}??????else????????{?????????upperColors[i]?=1;????????}??????if(downBuffer[i]?<?downBuffer[i?-1])????????{?????????downColors[i]?=0;????????}??????else????????{?????????downColors[i]?=1;????????}??????fillBuffer1[i]?=?macdBuffer[i];??????fillBuffer2[i]?=?signalBuffer[i];??????if(macdBuffer[i]?>?signalBuffer[i]?&&?macdBuffer[i?-1]?<?signalBuffer[i?-1])????????{?????????arrowBuffer[i?-1]?=?macdBuffer[i]?-0.0005;?????????arrowColors[i?-1]?=0;????????}??????if(macdBuffer[i]?<?signalBuffer[i]?&&?macdBuffer[i?-1]?>?signalBuffer[i?-1])????????{?????????arrow2Buffer[i?-1]?=?macdBuffer[i]?+0.0003;?????????arrow2Colors[i?-1]?=1;????????}?????}//---?return?value?of?prev_calculated?for?next?call??return(rates_total);??}//+------------------------------------------------------------------+??

    ?

    ?來(lái)源:程序化99

  • 文華技術(shù)人員: 1樓指標(biāo)注釋部分與執(zhí)行部分混在一起了
    您重新上傳一下 正常格式的源碼,我們分析看下。
    另外1樓圖片沒有上傳成功,您可以在如圖位置上傳圖片
    MT4指標(biāo)和文華指標(biāo)言語(yǔ)相差過(guò)大,需要聯(lián)系相關(guān)同事來(lái)進(jìn)行修改。



    文件名:qq截圖20210803154610.jpg

    ? ?

 

有思路,想編寫各種指標(biāo)公式,交易模型,選股公式,還原公式的朋友

可聯(lián)系技術(shù)人員 QQ: 262069696  點(diǎn)擊在線交流或微信號(hào):cxh99cxh99  進(jìn)行 有償收費(fèi) 編寫!

怎么收費(fèi),代編流程等詳情請(qǐng)點(diǎn)擊閱讀!

(注:由于人數(shù)限制,QQ或微信請(qǐng)選擇方便的一個(gè)聯(lián)系我們就行,加好友時(shí)請(qǐng)簡(jiǎn)單備注下您的需求,否則無(wú)法通過(guò)。謝謝您!)


【字體: 】【打印文章】【查看評(píng)論

相關(guān)文章

    沒有相關(guān)內(nèi)容
主站蜘蛛池模板: 中文字幕日产无码| 国产美女在线看| 人妻少妇久久中文字幕| 黑人玩弄漂亮少妇高潮大叫| 日本一二三区高清| 免费精品一区二区三区在线观看 | 国产大学生系列| 91精品观看91久久久久久| 最近中文字幕mv高清在线视频| 国产69精品久久久久777| 2018天天爽天天玩天天拍| 成人国产激情福利久久精品| 亚洲永久精品ww47| 美女无遮挡拍拍拍免费视频| 国内精品九九久久久精品| 中文字幕在线观看一区| 最近完整中文字幕2019电影| 亚洲综合AV在线在线播放| 国产免费的野战视频| 成年免费大片黄在线观看下载| 亚洲精品国产成人| 香蕉免费看一区二区三区| 国产超碰人人模人人爽人人喊| 久久精品成人欧美大片| 老司机深夜网站| 国产男女爽爽爽爽爽免费视频| 99爱在线观看免费完整版| 日韩精品无码专区免费播放| 内射一区二区精品视频在线观看| 久久亚洲精品无码| 男生和女生一起差差差很痛视频 | 狼人久蕉在线播放| 啦啦啦中文在线观看日本| 91精品国产色综合久久| 岛国在线观看视频| 亚洲乱亚洲乱少妇无码| 精品无码AV一区二区三区不卡 | 色综合小说久久综合图片| 国产福利精品一区二区| 三级免费黄色片| 欧美午夜精品久久久久免费视 |