MA-of-RSX.mq4

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

//+------------------------------------------------------------------+//|MAofRSXmq4|//|Copyright©2009,Obaidah/GodfreyH|//+------------------------------------------------------------------+//----indicatorsettings#propertyindicator_separate_window#propertyindicator_buffers3#propertyindicator_color1Magenta#propertyindicator_color2Aqua#propertyindicator_width12#propertyindicator_level180#propertyindicator_level250#propertyindicator_level320#propertyindicator_levelcolorRoyalBlue#propertyindicator_levelwidth2//----indicatorparametersexternintLen=10;externintSignalMA=2;externstringMAMethod=0:SMA1:EMA2:SMMA3:LWMA;externintMA_Method=0;externstringaa=StringColors;externcolorBullish=C'0,106,0';externcolorBearish=C'157,0,0';//----indicatorbuffersdoubleExtMapBuffer[];doubleSignalBuffer[];intShadow[];intshift[];//+------------------------------------------------------------------+//|Customindicatorinitializationfunction|//+------------------------------------------------------------------+intinit(){//----drawingsettings//IndicatorBuffers(2);SetIndexStyle(0,DRAW_LINE);SetIndexStyle(1,DRAW_LINE);SetIndexDrawBegin(0,SignalMA);SetIndexDrawBegin(1,SignalMA);IndicatorDigits(Digits+1);//----indicatorbuffersmappingSetIndexBuffer(0,ExtMapBuffer);SetIndexBuffer(1,SignalBuffer);//----nameforDataWindowandindicatorsubwindowlabelIndicatorShortName(RSX(+SignalMA+));SetIndexLabel(0,RSX);SetIndexLabel(1,Signal);//----initializationdonereturn(0);}intdeinit(){for(inti=ObjectsTotal()-1;i=0;i--){stringLabel=ObjectName(i);if(StringSubstr(Label,0,8)!=RSXTrend)continue;ObjectDelete(Label);}return(0);}//+------------------------------------------------------------------+//|Customindicatoriterationfunction|//+------------------------------------------------------------------+intstart(){intWindow=WindowFind(RSX(+SignalMA+));intlimit;intcounted_bars=IndicatorCounted();//----lastcountedbarwillberecountedif(counted_bars0)counted_bars--;limit=Bars-counted_bars;//----RSXcountedinthe1-stbufferfor(inti=0;ilimit;i++)ExtMapBuffer[i]=iCustom(NULL,0,RSX,Len,0,i);//----signallinecountedinthe2NDbufferfor(i=0;ilimit;i++)SignalBuffer[i]=iMAOnArray(ExtMapBuffer,Bars,SignalMA,0,MA_Method,i);stringLabel;intcnt=0;for(i=limit-1;i0;i--){if(SignalBuffer[i]ExtMapBuffer[i]&&SignalBuffer[i+1]ExtMapBuffer[i+1]){//Ifitsacrosspointcnt++;//calculatethenumberofcrosses.Label=RSXTrend+cnt;if(ObjectFind(Label)==-1)ObjectCreate(Label,OBJ_RECTANGLE,Window,0,0);ObjectSet(Label,OBJPROP_COLOR,Bearish);ObjectSet(Label,OBJPROP_PRICE1,100);ObjectSet(Label,OBJPROP_PRICE2,0);ObjectSet(Label,OBJPROP_TIME1,Time[i]);ObjectSet(Label,OBJPROP_TIME2,Time[i-1]);}else{if(SignalBuffer[i]ExtMapBuffer[i]&&SignalBuffer[i+1]ExtMapBuffer[i+1]){//Ifitsacrosspointcnt++;//calculatethenumberofcrosses.Label=RSXTrend+cnt;if(ObjectFind(Label)==-1)ObjectCreate(Label,OBJ_RECTANGLE,Window,0,0);ObjectSet(Label,OBJPROP_COLOR,Bullish);ObjectSet(Label,OBJPROP_PRICE1,100);ObjectSet(Label,OBJPROP_PRICE2,0);ObjectSet(Label,OBJPROP_TIME1,Time[i]);ObjectSet(Label,OBJPROP_TIME2,Time[i-1]);}elseObjectSet(Label,OBJPROP_TIME2,Time[i-1]);//dragthecurrentshadow}}return(0);}//+------------------------------------------------------------------+

1 / 3
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功