[求助]能不能将下面的转成文华6的主图指标? [文华财经]
-
咨询内容:
//+------------------------------------------------------------------+//| WATR.mq4 |//| Written WizardSerg under article konkop in |//| "Modern trading" #4/2001 |//| http://www.wizardserg.inweb.ru |//| wizardserg@mail.ru |//+------------------------------------------------------------------+#property copyright "Written WizardSerg under article konkop in <Modern trading> #4/2001"#property link "http://www.wizardserg.inweb.ru"//----#property indicator_chart_window#property indicator_buffers 2#property indicator_color1 Coral#property indicator_color2 DodgerBlue//---- input parametersextern int WATR_K = 10;extern double WATR_M = 4.0;extern int ATR = 21;//---- buffersdouble ExtMapBufferUp[];double ExtMapBufferDown[];//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int init() { IndicatorBuffers(2); SetIndexBuffer(0, ExtMapBufferUp); ArraySetAsSeries(ExtMapBufferUp, true); SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2); SetIndexBuffer(1, ExtMapBufferDown); ArraySetAsSeries(ExtMapBufferDown, true); SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2); IndicatorShortName("WATR(" + WATR_K + ", " + WATR_M + ")"); SetIndexLabel(0, "WATR_Up"); SetIndexLabel(1, "WATR_Dn"); return(0); }//+------------------------------------------------------------------+//| Custom indicator deinitialization function |//+------------------------------------------------------------------+int deinit() {//---- return(0); }//+------------------------------------------------------------------+//| Custom indicator function |//+------------------------------------------------------------------+bool AntiTrendBar(int i) { bool res = (TrendUp(i) && (Close[i] < Open[i])) || (!TrendUp(i) && (Close[i] > Open[i])); return(res); }//+------------------------------------------------------------------+//| Custom indicator function |//+------------------------------------------------------------------+double CalcIndicValue(int i, bool trend) { double res = Close[i]; if(trend) res -= (WATR_K*Point + WATR_M*iATR(NULL, 0, ATR, i)); else res += (WATR_K*Point + WATR_M*iATR(NULL, 0, ATR, i)); return(res); }//+------------------------------------------------------------------+//| Custom indicator function |//+------------------------------------------------------------------+bool TrendUp(int i) { return((Close[i+1] > ExtMapBufferUp[i+1]) && (ExtMapBufferUp[i+1] != EMPTY_VALUE)); }//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+int start() { int limit; int counted_bars = IndicatorCounted();//---- 镱耠邃龛?镱聍栩囗睇?徉?狍溴?镥疱聍栩囗//---- 镥疴铄 珥圜屙桢 桧滂赅蝾疣 == 鲥礤-1 point, // 蝾 羼螯 聍栩噱?蝠屙?忸聃钿? ExtMapBufferUp[Bars-1] = Close[Bars-1] - WATR_K*Point; // limit = (counted_bars > 0) ? (Bars - counted_bars) : (Bars - 1); limit = Bars - counted_bars; if(counted_bars==0) limit-=2;//---- 铖眍忭铋 鲨觌 for(int i = limit; i >= 0; i--) { if(AntiTrendBar(i)) { ExtMapBufferUp[i] = ExtMapBufferUp[i+1]; ExtMapBufferDown[i] = ExtMapBufferDown[i+1]; } else { if(TrendUp(i)) { ExtMapBufferUp[i] = CalcIndicValue(i, true); if(ExtMapBufferUp[i] < ExtMapBufferUp[i+1]) ExtMapBufferUp[i] = ExtMapBufferUp[i+1]; ExtMapBufferDown[i] = EMPTY_VALUE; } else { ExtMapBufferDown[i] = CalcIndicValue(i, false); if(ExtMapBufferDown[i] > ExtMapBufferDown[i+1]) ExtMapBufferDown[i] = ExtMapBufferDown[i+1]; ExtMapBufferUp[i] = EMPTY_VALUE; } } // 镥疱皴麇龛 ?鲥眍? if(TrendUp(i) && (Close[i] < ExtMapBufferUp[i])) { ExtMapBufferDown[i] = CalcIndicValue(i, false); ExtMapBufferUp[i] = EMPTY_VALUE; } if((!TrendUp(i)) && (Close[i] > ExtMapBufferDown[i])) { ExtMapBufferUp[i] = CalcIndicValue(i, true); ExtMapBufferDown[i] = EMPTY_VALUE; } } return(0); }//+------------------------------------------------------------------+
来源:程序化99
-
文华技术人员:
wh6是基础看盘软件,不支持循环这样复杂的思路的
您可以具体说明下思路,我们看下是否可以直接编写
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 或微信:cxhjy888 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容