大家好,
我最初試圖編輯默認 RSI 指標代碼,以便它在我當前的圖表上顯示來自另一個貨幣對的 RSI 值。但是,我無法弄清楚,所以我正在嘗試一種解決方法。我正在嘗試創建一個自定義指標,它只是從不同的貨幣對中讀取 RSI 指標。
到目前為止,這是我的代碼,但是它不能正常工作。
它顯示的值大約相差 2-5,當我回測時,它沒有顯示正確的值。
非常感謝任何幫助和指示。
插入代碼// --------------------------------- --------------------- /|測試.mq4 |/|版權所有 2020,MetaQuotes Software Corp. |/| https://www.mql5.com |/ ------------------------------------------------ ------------------- #property 版權所有 Copyright 2020, MetaQuotes Software Corp. #property link https://www.mql5.com #property version 1.00 #property strict # property indior_level1 30.0 #property indior_level2 70.0 #property indior_separate_window #property indior_minimum 0 #property indior_maximum 100 #property indior_buffers 1 #property indior_plots 1/--- 繪製一個 #property indior_label1 Eur #property indior_type1 DRAW_LINE #property indior_color1 clrRed #property indior_style1 STY屬性 indior_width1 1 extern int num = 4;/--- 指標緩衝區雙倍 EurBuffer#91;#93;;/ ------------------------------------------------ ------------------- /|自定義指標初始化函數 |/ ------------------------------------------------ ------------------- int OnInit() {/--- 指標緩衝區映射 SetIndexBuffer(0,EurBuffer);/--- 返回(INIT_SUCCEEDED); }/ --------------------------------------------- -------------------- /|自定義指標迭代函數 |/ ------------------------------------------------ ------------------- int OnCalculate(const int rates_total, const int prev_calculated, const datetime time#91;#93;, const double open#91;#93; , const double high#91;#93;, const double low#91;#93;, const double close#91;#93;, const long tick_volume#91;#93;, const long volume#91;#93; , const int spread#91;#93;) {/--- int uncalculatedBar = rates_total - prev_calculated; for (int i=0; ilt;uncalculatedBar; i ) { EurBuffer#91;i#93; = 計算 (i,EURUSD); }/--- 下一次調用的 prev_calculated 返回值 return(rates_total); }/ --------------------------------------------- -------------------- double Calc(int pos,string pair) { double Str = iRSI(pair,60,5,PRICE_CLOSE,pos);返回(Str); }