人人爽天天爽夜夜爽qc-人人爽天天爽夜夜爽曰-人人天天爱天天做天天摸-人人天天夜夜-色网站在线-色网站在线看

您現在的位置:程序化交易>> 期貨公式>> 文華財經>> 文華財經知識>>正文內容

[求助]老師能幫忙吧MT5的這個MACD改成WH7的嗎 [文華財經]

  • 咨詢內容: ??
    取指標數據
    通過獲取系統自帶的MACD指標數據,進行變色重建,實現起來非常方便,可以直接取到需要的數據。需要先建立指標句柄,再用CopyBuffer()函數取數據。
    intmacd_handle?=0;macd_handle?=iMACD(Symbol(),Period(),12,26,9,PRICE_CLOSE);//取指標數據CopyBuffer(macd_handle,0,0,rates_total,macdBuffer);CopyBuffer(macd_handle,1,0,rates_total,signalBuffer);
    填充緩沖區

    生成自定義指標,其實就是填充緩沖區的過程,將指標線、柱圖、填充區、箭頭緩沖區數據進行賦值,就可以實現我們需要的效果。
    在填充箭頭緩沖區時,需要更改箭頭的樣式,并且只是在雙線出現金叉、死叉時才賦值,所以還需要將0值位置設為空繪制區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);

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


    實現源碼
    #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);//指標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);??}//+------------------------------------------------------------------+??

    ?

    ?來源:程序化99

  • 文華技術人員: 1樓指標注釋部分與執行部分混在一起了
    您重新上傳一下 正常格式的源碼,我們分析看下。
    另外1樓圖片沒有上傳成功,您可以在如圖位置上傳圖片
    MT4指標和文華指標言語相差過大,需要聯系相關同事來進行修改。



    文件名:qq截圖20210803154610.jpg

    ? ?

 

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

可聯系技術人員 QQ: 262069696  點擊在線交流或微信號:cxh99cxh99  進行 有償收費 編寫!

怎么收費,代編流程等詳情請點擊閱讀!

(注:由于人數限制,QQ或微信請選擇方便的一個聯系我們就行,加好友時請簡單備注下您的需求,否則無法通過。謝謝您!)


【字體: 】【打印文章】【查看評論

相關文章

    沒有相關內容
主站蜘蛛池模板: 免费成人高清视频 | 国产黄色免费观看 | 国产三级a三级三级三级 | 国产麻豆久久 | 999国内精品视频免费 | 免费看黄的网站在线看 | 性激烈的欧美三级高清视频 | 日本羞羞无遮挡免费漫画 | 噜噜噜狠狠夜夜躁精品 | 国产日韩欧美一区二区三区视频 | 二区久久国产乱子伦免费精品 | 成人观看免费大片在线观看 | 丁香综合网 | 国产成人ae在线观看网站站 | 色偷偷人人澡人人爽人人模 | 中文字幕亚洲精品日韩精品 | 最近最好的中文字幕2019免费 | 狠狠色狠色综合曰曰 | 欧美激情在线精品一区二区 | 干妞网免费视频 | 欧美日韩视频在线第一区二区三区 | 最近免费中文字幕大全高清大全1 | 2020久久精品国产免费 | 成人在线激情网 | 国产一区二区在线观看动漫 | 亚洲另类欧美日韩 | 色综合天天娱乐综合网 | 在线 色| 国产a视频精品免费观看 | 国产精品欧美亚洲 | 国产日产久久高清欧美一区 | 97干婷婷| 日韩欧美一区黑人vs日本人 | 波多 在线 | 波多野结衣与公中出中文字幕 | 亚洲欧美另类在线视频 | 第一国内永久免费福利视频 | 欧美黑人三级 | 免费精品视频在线 | 一本到视频 | 中文字幕第九页 |