编码帮助 - 页 606 1...599600601602603604605606607608609610611612613...786 新评论 Mariusz 2016.03.13 07:32 #6051 你好。 我的指标有一个问题。这个代码工作得很好。 //+------------------------------------------------------------------+ //| RSMA.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "Tartut" #property link "" #property indicator_separate_window #property indicator_minimum -40 #property indicator_maximum 100 #property indicator_level1 19 #property indicator_level2 -19 #property indicator_level3 0 #property indicator_buffers 3 #property indicator_color1 Lime #property indicator_color2 Yellow #property indicator_color3 MediumOrchid extern int RSI_Period = 9; extern int RSI_Applied_Price = 0;//0=close, 1=open, 2=high, 3=low, 4=(high+low)/2, 5=(high+low+close)/3, 6=(high+low+close+close)/4 extern int MA_Period = 12; extern int MA_Method = 1;// 0=SMA, 1=EMA, 2=SMMA, 3=LWMA double MA_Array[],RSI[], Histo[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators setting SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); IndicatorShortName("RSMA"); SetIndexBuffer(0,Histo); SetIndexLabel(0,"RSMA"); SetIndexBuffer(1,MA_Array); SetIndexLabel(1,"MA("+MA_Period+")"); SetIndexBuffer(2,RSI); SetIndexLabel(2,"RSI("+RSI_Period+")"); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit = Bars - IndicatorCounted() - 1; //---- indicator calculation ArrayResize(RSI,limit+1); ArrayResize(MA_Array,limit+1); for(int i=limit; i>=0; i--) { RSI= iRSI(NULL,0,RSI_Period,RSI_Applied_Price,i); } for(i=limit; i>=0; i--) { MA_Array = iMAOnArray(RSI,0,MA_Period,0,MA_Method,i); } for(i=limit; i>=0; i--) { Histo = RSI-MA_Array; } //---- return(0); } //+------------------------------------------------------------------+ 我想删除RSI和EMA线,但是当我这样做的时候,柱状图的值就会改变。 我在附件中添加了两个指标。请帮助我! 对不起,我的英语不好。 附加的文件: rsma_histogram.mq4 3 kb Coding help [警告关闭!]任何新手问题,为了不给论坛添乱。专业人士,不要走过。没有你,哪里都不能去。 Ojala EA Mladen Rakic 2016.03.13 09:30 #6052 Tartut: 嗨。我的指标有一个问题。这段代码工作得很好。 //+------------------------------------------------------------------+ //| RSMA.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "Tartut" #property link "" #property indicator_separate_window #property indicator_minimum -40 #property indicator_maximum 100 #property indicator_level1 19 #property indicator_level2 -19 #property indicator_level3 0 #property indicator_buffers 3 #property indicator_color1 Lime #property indicator_color2 Yellow #property indicator_color3 MediumOrchid extern int RSI_Period = 9; extern int RSI_Applied_Price = 0;//0=close, 1=open, 2=high, 3=low, 4=(high+low)/2, 5=(high+low+close)/3, 6=(high+low+close+close)/4 extern int MA_Period = 12; extern int MA_Method = 1;// 0=SMA, 1=EMA, 2=SMMA, 3=LWMA double MA_Array[],RSI[], Histo[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators setting SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); IndicatorShortName("RSMA"); SetIndexBuffer(0,Histo); SetIndexLabel(0,"RSMA"); SetIndexBuffer(1,MA_Array); SetIndexLabel(1,"MA("+MA_Period+")"); SetIndexBuffer(2,RSI); SetIndexLabel(2,"RSI("+RSI_Period+")"); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit = Bars - IndicatorCounted() - 1; //---- indicator calculation ArrayResize(RSI,limit+1); ArrayResize(MA_Array,limit+1); for(int i=limit; i>=0; i--) { RSI= iRSI(NULL,0,RSI_Period,RSI_Applied_Price,i); } for(i=limit; i>=0; i--) { MA_Array = iMAOnArray(RSI,0,MA_Period,0,MA_Method,i); } for(i=limit; i>=0; i--) { Histo = RSI-MA_Array; } //---- return(0); } //+------------------------------------------------------------------+[/CODE] I would like delete RSI and EMA line, but when I do it, histogram change value. :/ I add attachment two indicators. Help me! Sorry for my English. 把开头改成这样。 [CODE]//+------------------------------------------------------------------+ //| RSMA.mq4 | //| | //+------------------------------------------------------------------+ #财产版权 "Tartut" #property link "" #属性 indicator_separate_window #property indicator_minimum -40 #属性 indicator_maximum 100 #属性 indicator_level1 19 #属性 indicator_level2 -19 #属性 indicator_level3 0 #属性 indicator_buffers 1 #属性 indicator_color1 Lime Extern int RSI_Period = 9; 外部int RSI_Applied_Price = 0;//0=close, 1=open, 2=high, 3=low, 4=(high+low)/2, 5=(high+low+close)/3, 6=(high+low+close+close)/4 extern int MA_Period = 12; Extern int MA_Method = 1;// 0=SMA, 1=EMA, 2=SMMA, 3=LWMA 双重MA_Array[], RSI[], Histo[]。 //+------------------------------------------------------------------+ //|自定义指标初始化函数 //+------------------------------------------------------------------+ int init() { IndicatorBuffers)3)。 //---- 指标设置 Mariusz 2016.03.13 14:47 #6053 mladen: 把开头改成这样。 //+------------------------------------------------------------------+ //| RSMA.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "Tartut" #property link "" #property indicator_separate_window #property indicator_minimum -40 #property indicator_maximum 100 #property indicator_level1 19 #property indicator_level2 -19 #property indicator_level3 0 #property indicator_buffers 1 #property indicator_color1 Lime extern int RSI_Period = 9; extern int RSI_Applied_Price = 0;//0=close, 1=open, 2=high, 3=low, 4=(high+low)/2, 5=(high+low+close)/3, 6=(high+low+close+close)/4 extern int MA_Period = 12; extern int MA_Method = 1;// 0=SMA, 1=EMA, 2=SMMA, 3=LWMA double MA_Array[],RSI[], Histo[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers)3); //---- indicators setting 耶!它的工作。 谢谢。 Mariusz 2016.03.14 10:14 #6054 我有下一个问题。我的指标不改变当前条的值。我必须刷新图表。 //+------------------------------------------------------------------+ //| RSMA Histogram.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "Tartut" #property link "" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Lime #property indicator_minimum -35 #property indicator_maximum 35 #property indicator_level1 19 #property indicator_level2 -19 #property indicator_level3 0 //#property indicator_color2 Yellow //#property indicator_color3 MediumOrchid extern double OverSold=-19.0; extern double OverBought=19.0; extern int RSI_Period=9; extern int RSI_Applied_Price=0; extern int MA_Period=12; extern int MA_Method=1;// 0=SMA, 1=EMA, 2=SMMA, 3=LWMA extern bool ShowArrows=true; extern color OverSoldColor=Gold; extern color OverBoughtColor = Gold; extern string arrowsIdentifier = "RSMA arrows"; extern int arrowsWidth = 1; extern int IDWindow=1; extern string _Divergence="<>"; extern string _CBars="<>"; extern int CBars=99; extern bool CheckDivergence=false; extern bool CheckSlowDownMomentum=false; extern string DivergenceIndentifier="RSMA Divergence"; double MA_Array[],RSI[],Histo[]; int trend[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(3); //---- indicators setting SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); IndicatorShortName("RSMA Histogram"); SetIndexBuffer(0,Histo); SetIndexLabel(0,"RSMA"); SetIndexBuffer(1,MA_Array); SetIndexLabel(1,"MA("+MA_Period+")"); SetIndexBuffer(2,RSI); SetIndexLabel(2,"RSI("+RSI_Period+")"); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int deinit() { deleteArrows(); fnDeleteAllDivergence(); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit=Bars-IndicatorCounted(); if(limit<0) return(-1); if(limit>0) limit--; //---- indicator calculation ArrayResize(trend,limit+1); ArrayResize(RSI,limit+1); ArrayResize(MA_Array,limit+1); for(int i=0; i<limit; i++) { RSI=iRSI(NULL,0,RSI_Period,RSI_Applied_Price,i); } for(i=0; i<limit; i++) { MA_Array=iMAOnArray(RSI,0,MA_Period,0,MA_Method,i); } for(i=0; i<limit; i++) { Histo=RSI-MA_Array; if(Histo>OverBought) trend=1; else if(Histo<OverSold) trend=-1; manageArrow(i); } if(CheckDivergence==true) { int x= CBars/3; for(i=0; i<x; i++) { double open0=iOpen(NULL,0,i); double close0= iClose(NULL,0,i); double open1 = iOpen(NULL,0,i+1); double close1= iClose(NULL,0,i+1); double open2 = iOpen(NULL,0,i+2); double close2 = iClose(NULL, 0, i+2); bool momentum = true; if(CheckSlowDownMomentum==true) { double bar0 = MathAbs(open0-close0); double bar1 = MathAbs(open1-close1); double bar2 = MathAbs(open2-close2); if(bar0<bar1 && bar1<bar2) momentum=true; else momentum=false; } //PUT if(Histo<Histo && Histo<Histo && open0<close0 && open1<close1 && open2<close2 && momentum==true) { double high0 = iHigh(NULL, 0, i); double high2 = iHigh(NULL, 0, i+2); TrendCreate(DivergenceIndentifier+"Sub"+i,Time,Histo,Time,Histo,Red,STYLE_SOLID,1,IDWindow); TrendCreate(DivergenceIndentifier+"Main"+i,Time,high2,Time,high0,Red,STYLE_SOLID,1,0); } else if(Histo>Histo && Histo>Histo && open0>close0 && open1>close1 && open2>close2 && momentum==true) { double low0 = iLow(NULL, 0, i); double low2 = iLow(NULL, 0, i+2); TrendCreate(DivergenceIndentifier+"Sub"+i,Time,Histo,Time,Histo,Red,STYLE_SOLID,1,IDWindow); TrendCreate(DivergenceIndentifier+"Main"+i,Time,low2,Time,low0,Red,STYLE_SOLID,1,0); } } } return(0); } //+------------------------------------------------------------------+ void manageArrow(int i) { if(ShowArrows) { deleteArrow(Time); if(trend ==-1) drawArrow(i,OverBoughtColor,159,false); if(trend == 1) drawArrow(i,OverSoldColor ,159,true ); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void fnDeleteAllDivergence() { string lookFor=DivergenceIndentifier; string objectName; int lookForLength=StringLen(lookFor); for(int i=ObjectsTotal()-1; i>=0; i--) { objectName=ObjectName(i); if(StringSubstr(objectName,0,lookForLength)==lookFor) ObjectDelete(objectName); } } // // // // // void drawArrow(int i,color theColor,int theCode,bool up) { string name=arrowsIdentifier+":"+Time; double gap=3.0*iATR(NULL,0,10,i)/4.0; //20 // // // // // ObjectCreate(name,OBJ_ARROW,0,Time,0); ObjectSet(name,OBJPROP_ARROWCODE,theCode); ObjectSet(name,OBJPROP_COLOR,theColor); ObjectSet(name,OBJPROP_WIDTH,arrowsWidth); if(up) ObjectSet(name,OBJPROP_PRICE1,High+gap); else ObjectSet(name,OBJPROP_PRICE1,Low-gap); } // // // // // void deleteArrows() { string lookFor = arrowsIdentifier+":"; int lookForLength = StringLen(lookFor); for(int i=ObjectsTotal()-1; i>=0; i--) { string objectName=ObjectName(i); if(StringSubstr(objectName,0,lookForLength)==lookFor) ObjectDelete(objectName); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void deleteArrow(datetime time) { string lookFor=arrowsIdentifier+":"+time; ObjectDelete(lookFor); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // bool TrendCreate(string name="Line1", datetime time1=0, // first point time double price1=0, // first point price datetime time2=0, // second point time double price2=0, // second point price const color clr=clrRed, // line color const ENUM_LINE_STYLE style=STYLE_SOLID, // line style const int width=1, const int window=0 // line width // highlight to move ) { //--- reset the error value ResetLastError(); //--- create a trend line by the given coordinates if(!ObjectCreate(name,OBJ_TREND,window,time1,price1,time2,price2)) { Print(__FUNCTION__,": failed to create a trend line! Error code = ",GetLastError()); return(false); } //--- set line color ObjectSetInteger(0,name,OBJPROP_COLOR,clr); //--- set line display style ObjectSetInteger(0,name,OBJPROP_STYLE,style); //--- set line width ObjectSetInteger(0,name,OBJPROP_WIDTH,width); ObjectSetInteger(0,name,OBJPROP_SELECTED,false); //--- enable (true) or disable (false) the mode of continuation of the line's display to the right ObjectSetInteger(0,name,OBJPROP_RAY_RIGHT,false); //--- successful execution return(true); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CleanPoint(int i,double &first[],double &second[]) { if((second!=EMPTY_VALUE) &&(second !=EMPTY_VALUE)) second=EMPTY_VALUE; else if((first!=EMPTY_VALUE) && (first!=EMPTY_VALUE) && (first==EMPTY_VALUE)) first=EMPTY_VALUE; } // // // // // void PlotPoint(int i,double &first[],double &second[],double &from[]) { if(first==EMPTY_VALUE) { if(first==EMPTY_VALUE) { first = from; first = from; second = EMPTY_VALUE; } else { second = from; second = from; first = EMPTY_VALUE; } } else { first = from; second = EMPTY_VALUE; } } //+------------------------------------------------------------------+ //--- Coding help Alert needed on profitable 专家顾问 - 杂项问题 Mladen Rakic 2016.03.14 11:02 #6055 Tartut: 我有下一个问题。我的指标不改变当前条的值。我必须刷新图表。 试着这样做。 //+------------------------------------------------------------------+ //| RSMA Histogram.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "Tartut" #property link "" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Lime #property indicator_minimum -35 #property indicator_maximum 35 #property indicator_level1 19 #property indicator_level2 -19 #property indicator_level3 0 //#property indicator_color2 Yellow //#property indicator_color3 MediumOrchid extern double OverSold=-19.0; extern double OverBought=19.0; extern int RSI_Period=9; extern int RSI_Applied_Price=0; extern int MA_Period=12; extern int MA_Method=1;// 0=SMA, 1=EMA, 2=SMMA, 3=LWMA extern bool ShowArrows=true; extern color OverSoldColor=Gold; extern color OverBoughtColor = Gold; extern string arrowsIdentifier = "RSMA arrows"; extern int arrowsWidth = 1; extern int IDWindow=1; extern string _Divergence="<>"; extern string _CBars="<>"; extern int CBars=99; extern bool CheckDivergence=false; extern bool CheckSlowDownMomentum=false; extern string DivergenceIndentifier="RSMA Divergence"; double MA_Array[],RSI[],Histo[]; double trend[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(4); //---- indicators setting SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); IndicatorShortName("RSMA Histogram"); SetIndexBuffer(0,Histo); SetIndexLabel(0,"RSMA"); SetIndexBuffer(1,MA_Array); SetIndexLabel(1,"MA("+MA_Period+")"); SetIndexBuffer(2,RSI); SetIndexLabel(2,"RSI("+RSI_Period+")"); SetIndexBuffer(3,trend); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int deinit() { deleteArrows(); fnDeleteAllDivergence(); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit = MathMin(Bars-counted_bars,Bars-1); //---- indicator calculation Comment(limit); for(int i=0; i<limit; i++) { RSI=iRSI(NULL,0,RSI_Period,RSI_Applied_Price,i); } for(i=0; i<limit; i++) { MA_Array=iMAOnArray(RSI,0,MA_Period,0,MA_Method,i); } for(i=0; i<limit; i++) { Histo=RSI-MA_Array; if(Histo>OverBought) trend=1; else if(Histo<OverSold) trend=-1; manageArrow(i); } if(CheckDivergence==true) { int x= CBars/3; for(i=0; i<x; i++) { double open0=iOpen(NULL,0,i); double close0= iClose(NULL,0,i); double open1 = iOpen(NULL,0,i+1); double close1= iClose(NULL,0,i+1); double open2 = iOpen(NULL,0,i+2); double close2 = iClose(NULL, 0, i+2); bool momentum = true; if(CheckSlowDownMomentum==true) { double bar0 = MathAbs(open0-close0); double bar1 = MathAbs(open1-close1); double bar2 = MathAbs(open2-close2); if(bar0<bar1 && bar1<bar2) momentum=true; else momentum=false; } //PUT if(Histo<Histo && Histo<Histo && open0<close0 && open1<close1 && open2<close2 && momentum==true) { double high0 = iHigh(NULL, 0, i); double high2 = iHigh(NULL, 0, i+2); TrendCreate(DivergenceIndentifier+"Sub"+i,Time,Histo,Time,Histo,Red,STYLE_SOLID,1,IDWindow); TrendCreate(DivergenceIndentifier+"Main"+i,Time,high2,Time,high0,Red,STYLE_SOLID,1,0); } else if(Histo>Histo && Histo>Histo && open0>close0 && open1>close1 && open2>close2 && momentum==true) { double low0 = iLow(NULL, 0, i); double low2 = iLow(NULL, 0, i+2); TrendCreate(DivergenceIndentifier+"Sub"+i,Time,Histo,Time,Histo,Red,STYLE_SOLID,1,IDWindow); TrendCreate(DivergenceIndentifier+"Main"+i,Time,low2,Time,low0,Red,STYLE_SOLID,1,0); } } } return(0); } //+------------------------------------------------------------------+ void manageArrow(int i) { if(ShowArrows) { deleteArrow(Time); if(trend ==-1) drawArrow(i,OverBoughtColor,159,false); if(trend == 1) drawArrow(i,OverSoldColor ,159,true ); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void fnDeleteAllDivergence() { string lookFor=DivergenceIndentifier; string objectName; int lookForLength=StringLen(lookFor); for(int i=ObjectsTotal()-1; i>=0; i--) { objectName=ObjectName(i); if(StringSubstr(objectName,0,lookForLength)==lookFor) ObjectDelete(objectName); } } // // // // // void drawArrow(int i,color theColor,int theCode,bool up) { string name=arrowsIdentifier+":"+Time; double gap=3.0*iATR(NULL,0,10,i)/4.0; //20 // // // // // ObjectCreate(name,OBJ_ARROW,0,Time,0); ObjectSet(name,OBJPROP_ARROWCODE,theCode); ObjectSet(name,OBJPROP_COLOR,theColor); ObjectSet(name,OBJPROP_WIDTH,arrowsWidth); if(up) ObjectSet(name,OBJPROP_PRICE1,High+gap); else ObjectSet(name,OBJPROP_PRICE1,Low-gap); } // // // // // void deleteArrows() { string lookFor = arrowsIdentifier+":"; int lookForLength = StringLen(lookFor); for(int i=ObjectsTotal()-1; i>=0; i--) { string objectName=ObjectName(i); if(StringSubstr(objectName,0,lookForLength)==lookFor) ObjectDelete(objectName); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void deleteArrow(datetime time) { string lookFor=arrowsIdentifier+":"+time; ObjectDelete(lookFor); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // bool TrendCreate(string name="Line1", datetime time1=0, // first point time double price1=0, // first point price datetime time2=0, // second point time double price2=0, // second point price const color clr=clrRed, // line color const ENUM_LINE_STYLE style=STYLE_SOLID, // line style const int width=1, const int window=0 // line width // highlight to move ) { //--- reset the error value ResetLastError(); //--- create a trend line by the given coordinates if(!ObjectCreate(name,OBJ_TREND,window,time1,price1,time2,price2)) { Print(__FUNCTION__,": failed to create a trend line! Error code = ",GetLastError()); return(false); } //--- set line color ObjectSetInteger(0,name,OBJPROP_COLOR,clr); //--- set line display style ObjectSetInteger(0,name,OBJPROP_STYLE,style); //--- set line width ObjectSetInteger(0,name,OBJPROP_WIDTH,width); ObjectSetInteger(0,name,OBJPROP_SELECTED,false); //--- enable (true) or disable (false) the mode of continuation of the line's display to the right ObjectSetInteger(0,name,OBJPROP_RAY_RIGHT,false); //--- successful execution return(true); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CleanPoint(int i,double &first[],double &second[]) { if((second!=EMPTY_VALUE) &&(second !=EMPTY_VALUE)) second=EMPTY_VALUE; else if((first!=EMPTY_VALUE) && (first!=EMPTY_VALUE) && (first==EMPTY_VALUE)) first=EMPTY_VALUE; } // // // // // void PlotPoint(int i,double &first[],double &second[],double &from[]) { if(first==EMPTY_VALUE) { if(first==EMPTY_VALUE) { first = from; first = from; second = EMPTY_VALUE; } else { second = from; second = from; first = EMPTY_VALUE; } } else { first = from; second = EMPTY_VALUE; } } //+------------------------------------------------------------------+ //--- Coding help Ojala EA Alert needed on profitable Mariusz 2016.03.14 11:11 #6056 mladen: 试着像这样。 你是最棒的 谢谢 Rad Lam 2016.03.15 06:13 #6057 大家好,谁能把这个指标修改一下,让它也显示红色的柱子,因为我只能看到绿色的上升。谢谢。(Deltaforce Volume) 另外,您能不能修复这个指标,以便我可以调整条形图的厚度。(Deltaforce) 再次感谢 附加的文件: deltaforce_volume.mq4 3 kb deltaforce.mq4 3 kb Rogelio Hernandez 2016.03.15 17:41 #6058 嗨,Mladen和工具先生 我有一个问题,我不知道如何做到这一点,也许用一个指标或EA,但我真的需要它,也许你能帮助我。 我需要一个半自动的订单系统,我的意思是,我手动获得第一笔交易,"市场订单 "与SL和TP,如果SL被击中,系统创建一个新的订单在相反的方向与SL(对于新的订单是入口),现在第一笔交易的入口是SL和TP,始终是相同的点值,但我想手动设置,多少手或迷你手应该在渐进交易中打开,有点像马丁格尔,但不是真的。......,直到击中TP,系统应该创建新的订单,当TP被击中时,系统停止或关闭,直到我再次手动输入第一个订单。我希望,我没有在解释中造成混乱!;-) 是否有这样的东西我可以使用? 非常感谢 Mladen Rakic 2016.03.15 18:44 #6059 laborax: 嗨,Mladen和Mr.我有一个问题,我不知道如何做到这一点,也许用一个指标或EA,但我真的需要它,也许你能帮助我。 我需要一个半自动的订单系统,我的意思是,我手动获得第一笔交易,"市场订单 "与SL和TP,如果SL被击中,系统创建一个新的订单在相反的方向与SL(对于新的订单是入口),现在第一笔交易的入口是SL和TP,总是相同的点值,但我想手动设置,多少手或迷你手应该在渐进交易中打开,有点像马汀格尔,但不是真的。......,直到击中TP,系统应该创建新的订单,当TP被击中时,系统停止或关闭,直到我再次手动输入第一个订单。我希望,我没有在解释中造成混乱!;-) 是否有类似的东西我可以使用? 非常感谢 劳动法 这些规则太松散了,无法在此基础上制作EA,据我所知,没有这样的EA。 Rogelio Hernandez 2016.03.15 18:50 #6060 我发现了这个EA,这正是我在寻找的......你觉得它怎么样? https://www.mql5.com/en/forum/184476 1...599600601602603604605606607608609610611612613...786 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
你好。
我的指标有一个问题。这个代码工作得很好。
//| RSMA.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright "Tartut"
#property link ""
#property indicator_separate_window
#property indicator_minimum -40
#property indicator_maximum 100
#property indicator_level1 19
#property indicator_level2 -19
#property indicator_level3 0
#property indicator_buffers 3
#property indicator_color1 Lime
#property indicator_color2 Yellow
#property indicator_color3 MediumOrchid
extern int RSI_Period = 9;
extern int RSI_Applied_Price = 0;//0=close, 1=open, 2=high, 3=low, 4=(high+low)/2, 5=(high+low+close)/3, 6=(high+low+close+close)/4
extern int MA_Period = 12;
extern int MA_Method = 1;// 0=SMA, 1=EMA, 2=SMMA, 3=LWMA
double MA_Array[],RSI[], Histo[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators setting
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
IndicatorShortName("RSMA");
SetIndexBuffer(0,Histo);
SetIndexLabel(0,"RSMA");
SetIndexBuffer(1,MA_Array);
SetIndexLabel(1,"MA("+MA_Period+")");
SetIndexBuffer(2,RSI);
SetIndexLabel(2,"RSI("+RSI_Period+")");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit = Bars - IndicatorCounted() - 1;
//---- indicator calculation
ArrayResize(RSI,limit+1);
ArrayResize(MA_Array,limit+1);
for(int i=limit; i>=0; i--)
{
RSI= iRSI(NULL,0,RSI_Period,RSI_Applied_Price,i);
}
for(i=limit; i>=0; i--)
{
MA_Array = iMAOnArray(RSI,0,MA_Period,0,MA_Method,i);
}
for(i=limit; i>=0; i--)
{
Histo = RSI-MA_Array;
}
//----
return(0);
}
//+------------------------------------------------------------------+我想删除RSI和EMA线,但是当我这样做的时候,柱状图的值就会改变。
我在附件中添加了两个指标。请帮助我!![](https://c.mql5.com/forextsd/smiles/smile.png)
对不起,我的英语不好。
嗨。
我的指标有一个问题。这段代码工作得很好。
//| RSMA.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright "Tartut"
#property link ""
#property indicator_separate_window
#property indicator_minimum -40
#property indicator_maximum 100
#property indicator_level1 19
#property indicator_level2 -19
#property indicator_level3 0
#property indicator_buffers 3
#property indicator_color1 Lime
#property indicator_color2 Yellow
#property indicator_color3 MediumOrchid
extern int RSI_Period = 9;
extern int RSI_Applied_Price = 0;//0=close, 1=open, 2=high, 3=low, 4=(high+low)/2, 5=(high+low+close)/3, 6=(high+low+close+close)/4
extern int MA_Period = 12;
extern int MA_Method = 1;// 0=SMA, 1=EMA, 2=SMMA, 3=LWMA
double MA_Array[],RSI[], Histo[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators setting
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
IndicatorShortName("RSMA");
SetIndexBuffer(0,Histo);
SetIndexLabel(0,"RSMA");
SetIndexBuffer(1,MA_Array);
SetIndexLabel(1,"MA("+MA_Period+")");
SetIndexBuffer(2,RSI);
SetIndexLabel(2,"RSI("+RSI_Period+")");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit = Bars - IndicatorCounted() - 1;
//---- indicator calculation
ArrayResize(RSI,limit+1);
ArrayResize(MA_Array,limit+1);
for(int i=limit; i>=0; i--)
{
RSI= iRSI(NULL,0,RSI_Period,RSI_Applied_Price,i);
}
for(i=limit; i>=0; i--)
{
MA_Array = iMAOnArray(RSI,0,MA_Period,0,MA_Method,i);
}
for(i=limit; i>=0; i--)
{
Histo = RSI-MA_Array;
}
//----
return(0);
}
//+------------------------------------------------------------------+[/CODE]
I would like delete RSI and EMA line, but when I do it, histogram change value. :/
I add attachment two indicators. Help me!![](https://c.mql5.com/forextsd/smiles/smile.png)
Sorry for my English.把开头改成这样。
[CODE]//+------------------------------------------------------------------+
//| RSMA.mq4 |
//| |
//+------------------------------------------------------------------+
#财产版权 "Tartut"
#property link ""
#属性 indicator_separate_window
#property indicator_minimum -40
#属性 indicator_maximum 100
#属性 indicator_level1 19
#属性 indicator_level2 -19
#属性 indicator_level3 0
#属性 indicator_buffers 1
#属性 indicator_color1 Lime
Extern int RSI_Period = 9;
外部int RSI_Applied_Price = 0;//0=close, 1=open, 2=high, 3=low, 4=(high+low)/2, 5=(high+low+close)/3, 6=(high+low+close+close)/4
extern int MA_Period = 12;
Extern int MA_Method = 1;// 0=SMA, 1=EMA, 2=SMMA, 3=LWMA
双重MA_Array[], RSI[], Histo[]。
//+------------------------------------------------------------------+
//|自定义指标初始化函数
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers)3)。
//---- 指标设置把开头改成这样。
//| RSMA.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright "Tartut"
#property link ""
#property indicator_separate_window
#property indicator_minimum -40
#property indicator_maximum 100
#property indicator_level1 19
#property indicator_level2 -19
#property indicator_level3 0
#property indicator_buffers 1
#property indicator_color1 Lime
extern int RSI_Period = 9;
extern int RSI_Applied_Price = 0;//0=close, 1=open, 2=high, 3=low, 4=(high+low)/2, 5=(high+low+close)/3, 6=(high+low+close+close)/4
extern int MA_Period = 12;
extern int MA_Method = 1;// 0=SMA, 1=EMA, 2=SMMA, 3=LWMA
double MA_Array[],RSI[], Histo[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers)3);
//---- indicators setting耶!它的工作。
谢谢。![](https://c.mql5.com/forextsd/smiles/smile.png)
我有下一个问题。我的指标不改变当前条的值。我必须刷新图表。
//| RSMA Histogram.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright "Tartut"
#property link ""
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Lime
#property indicator_minimum -35
#property indicator_maximum 35
#property indicator_level1 19
#property indicator_level2 -19
#property indicator_level3 0
//#property indicator_color2 Yellow
//#property indicator_color3 MediumOrchid
extern double OverSold=-19.0;
extern double OverBought=19.0;
extern int RSI_Period=9;
extern int RSI_Applied_Price=0;
extern int MA_Period=12;
extern int MA_Method=1;// 0=SMA, 1=EMA, 2=SMMA, 3=LWMA
extern bool ShowArrows=true;
extern color OverSoldColor=Gold;
extern color OverBoughtColor = Gold;
extern string arrowsIdentifier = "RSMA arrows";
extern int arrowsWidth = 1;
extern int IDWindow=1;
extern string _Divergence="<>";
extern string _CBars="<>";
extern int CBars=99;
extern bool CheckDivergence=false;
extern bool CheckSlowDownMomentum=false;
extern string DivergenceIndentifier="RSMA Divergence";
double MA_Array[],RSI[],Histo[];
int trend[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(3);
//---- indicators setting
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
IndicatorShortName("RSMA Histogram");
SetIndexBuffer(0,Histo);
SetIndexLabel(0,"RSMA");
SetIndexBuffer(1,MA_Array);
SetIndexLabel(1,"MA("+MA_Period+")");
SetIndexBuffer(2,RSI);
SetIndexLabel(2,"RSI("+RSI_Period+")");
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
deleteArrows();
fnDeleteAllDivergence();
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit=Bars-IndicatorCounted();
if(limit<0) return(-1);
if(limit>0) limit--;
//---- indicator calculation
ArrayResize(trend,limit+1);
ArrayResize(RSI,limit+1);
ArrayResize(MA_Array,limit+1);
for(int i=0; i<limit; i++)
{
RSI=iRSI(NULL,0,RSI_Period,RSI_Applied_Price,i);
}
for(i=0; i<limit; i++)
{
MA_Array=iMAOnArray(RSI,0,MA_Period,0,MA_Method,i);
}
for(i=0; i<limit; i++)
{
Histo=RSI-MA_Array;
if(Histo>OverBought)
trend=1;
else if(Histo<OverSold)
trend=-1;
manageArrow(i);
}
if(CheckDivergence==true)
{
int x= CBars/3;
for(i=0; i<x; i++)
{
double open0=iOpen(NULL,0,i);
double close0= iClose(NULL,0,i);
double open1 = iOpen(NULL,0,i+1);
double close1= iClose(NULL,0,i+1);
double open2 = iOpen(NULL,0,i+2);
double close2 = iClose(NULL, 0, i+2);
bool momentum = true;
if(CheckSlowDownMomentum==true)
{
double bar0 = MathAbs(open0-close0);
double bar1 = MathAbs(open1-close1);
double bar2 = MathAbs(open2-close2);
if(bar0<bar1 && bar1<bar2)
momentum=true;
else
momentum=false;
}
//PUT
if(Histo<Histo && Histo<Histo && open0<close0 && open1<close1 && open2<close2 && momentum==true)
{
double high0 = iHigh(NULL, 0, i);
double high2 = iHigh(NULL, 0, i+2);
TrendCreate(DivergenceIndentifier+"Sub"+i,Time,Histo,Time,Histo,Red,STYLE_SOLID,1,IDWindow);
TrendCreate(DivergenceIndentifier+"Main"+i,Time,high2,Time,high0,Red,STYLE_SOLID,1,0);
}
else if(Histo>Histo && Histo>Histo && open0>close0 && open1>close1 && open2>close2 && momentum==true)
{
double low0 = iLow(NULL, 0, i);
double low2 = iLow(NULL, 0, i+2);
TrendCreate(DivergenceIndentifier+"Sub"+i,Time,Histo,Time,Histo,Red,STYLE_SOLID,1,IDWindow);
TrendCreate(DivergenceIndentifier+"Main"+i,Time,low2,Time,low0,Red,STYLE_SOLID,1,0);
}
}
}
return(0);
}
//+------------------------------------------------------------------+
void manageArrow(int i)
{
if(ShowArrows)
{
deleteArrow(Time);
if(trend ==-1) drawArrow(i,OverBoughtColor,159,false);
if(trend == 1) drawArrow(i,OverSoldColor ,159,true );
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void fnDeleteAllDivergence()
{
string lookFor=DivergenceIndentifier;
string objectName;
int lookForLength=StringLen(lookFor);
for(int i=ObjectsTotal()-1; i>=0; i--)
{
objectName=ObjectName(i);
if(StringSubstr(objectName,0,lookForLength)==lookFor) ObjectDelete(objectName);
}
}
//
//
//
//
//
void drawArrow(int i,color theColor,int theCode,bool up)
{
string name=arrowsIdentifier+":"+Time;
double gap=3.0*iATR(NULL,0,10,i)/4.0; //20
//
//
//
//
//
ObjectCreate(name,OBJ_ARROW,0,Time,0);
ObjectSet(name,OBJPROP_ARROWCODE,theCode);
ObjectSet(name,OBJPROP_COLOR,theColor);
ObjectSet(name,OBJPROP_WIDTH,arrowsWidth);
if(up)
ObjectSet(name,OBJPROP_PRICE1,High+gap);
else ObjectSet(name,OBJPROP_PRICE1,Low-gap);
}
//
//
//
//
//
void deleteArrows()
{
string lookFor = arrowsIdentifier+":";
int lookForLength = StringLen(lookFor);
for(int i=ObjectsTotal()-1; i>=0; i--)
{
string objectName=ObjectName(i);
if(StringSubstr(objectName,0,lookForLength)==lookFor) ObjectDelete(objectName);
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void deleteArrow(datetime time)
{
string lookFor=arrowsIdentifier+":"+time; ObjectDelete(lookFor);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
bool TrendCreate(string name="Line1",
datetime time1=0, // first point time
double price1=0, // first point price
datetime time2=0, // second point time
double price2=0, // second point price
const color clr=clrRed, // line color
const ENUM_LINE_STYLE style=STYLE_SOLID, // line style
const int width=1,
const int window=0 // line width // highlight to move
)
{
//--- reset the error value
ResetLastError();
//--- create a trend line by the given coordinates
if(!ObjectCreate(name,OBJ_TREND,window,time1,price1,time2,price2))
{
Print(__FUNCTION__,": failed to create a trend line! Error code = ",GetLastError());
return(false);
}
//--- set line color
ObjectSetInteger(0,name,OBJPROP_COLOR,clr);
//--- set line display style
ObjectSetInteger(0,name,OBJPROP_STYLE,style);
//--- set line width
ObjectSetInteger(0,name,OBJPROP_WIDTH,width);
ObjectSetInteger(0,name,OBJPROP_SELECTED,false);
//--- enable (true) or disable (false) the mode of continuation of the line's display to the right
ObjectSetInteger(0,name,OBJPROP_RAY_RIGHT,false);
//--- successful execution
return(true);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void CleanPoint(int i,double &first[],double &second[])
{
if((second!=EMPTY_VALUE) &&(second !=EMPTY_VALUE))
second=EMPTY_VALUE;
else
if((first!=EMPTY_VALUE) && (first!=EMPTY_VALUE) && (first==EMPTY_VALUE))
first=EMPTY_VALUE;
}
//
//
//
//
//
void PlotPoint(int i,double &first[],double &second[],double &from[])
{
if(first==EMPTY_VALUE)
{
if(first==EMPTY_VALUE)
{
first = from;
first = from;
second = EMPTY_VALUE;
}
else
{
second = from;
second = from;
first = EMPTY_VALUE;
}
}
else
{
first = from;
second = EMPTY_VALUE;
}
}
//+------------------------------------------------------------------+
//---
我有下一个问题。我的指标不改变当前条的值。我必须刷新图表。
试着这样做。
//| RSMA Histogram.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright "Tartut"
#property link ""
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Lime
#property indicator_minimum -35
#property indicator_maximum 35
#property indicator_level1 19
#property indicator_level2 -19
#property indicator_level3 0
//#property indicator_color2 Yellow
//#property indicator_color3 MediumOrchid
extern double OverSold=-19.0;
extern double OverBought=19.0;
extern int RSI_Period=9;
extern int RSI_Applied_Price=0;
extern int MA_Period=12;
extern int MA_Method=1;// 0=SMA, 1=EMA, 2=SMMA, 3=LWMA
extern bool ShowArrows=true;
extern color OverSoldColor=Gold;
extern color OverBoughtColor = Gold;
extern string arrowsIdentifier = "RSMA arrows";
extern int arrowsWidth = 1;
extern int IDWindow=1;
extern string _Divergence="<>";
extern string _CBars="<>";
extern int CBars=99;
extern bool CheckDivergence=false;
extern bool CheckSlowDownMomentum=false;
extern string DivergenceIndentifier="RSMA Divergence";
double MA_Array[],RSI[],Histo[];
double trend[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(4);
//---- indicators setting
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
IndicatorShortName("RSMA Histogram");
SetIndexBuffer(0,Histo);
SetIndexLabel(0,"RSMA");
SetIndexBuffer(1,MA_Array);
SetIndexLabel(1,"MA("+MA_Period+")");
SetIndexBuffer(2,RSI);
SetIndexLabel(2,"RSI("+RSI_Period+")");
SetIndexBuffer(3,trend);
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
deleteArrows();
fnDeleteAllDivergence();
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
//---- indicator calculation
Comment(limit);
for(int i=0; i<limit; i++)
{
RSI=iRSI(NULL,0,RSI_Period,RSI_Applied_Price,i);
}
for(i=0; i<limit; i++)
{
MA_Array=iMAOnArray(RSI,0,MA_Period,0,MA_Method,i);
}
for(i=0; i<limit; i++)
{
Histo=RSI-MA_Array;
if(Histo>OverBought)
trend=1;
else if(Histo<OverSold)
trend=-1;
manageArrow(i);
}
if(CheckDivergence==true)
{
int x= CBars/3;
for(i=0; i<x; i++)
{
double open0=iOpen(NULL,0,i);
double close0= iClose(NULL,0,i);
double open1 = iOpen(NULL,0,i+1);
double close1= iClose(NULL,0,i+1);
double open2 = iOpen(NULL,0,i+2);
double close2 = iClose(NULL, 0, i+2);
bool momentum = true;
if(CheckSlowDownMomentum==true)
{
double bar0 = MathAbs(open0-close0);
double bar1 = MathAbs(open1-close1);
double bar2 = MathAbs(open2-close2);
if(bar0<bar1 && bar1<bar2)
momentum=true;
else
momentum=false;
}
//PUT
if(Histo<Histo && Histo<Histo && open0<close0 && open1<close1 && open2<close2 && momentum==true)
{
double high0 = iHigh(NULL, 0, i);
double high2 = iHigh(NULL, 0, i+2);
TrendCreate(DivergenceIndentifier+"Sub"+i,Time,Histo,Time,Histo,Red,STYLE_SOLID,1,IDWindow);
TrendCreate(DivergenceIndentifier+"Main"+i,Time,high2,Time,high0,Red,STYLE_SOLID,1,0);
}
else if(Histo>Histo && Histo>Histo && open0>close0 && open1>close1 && open2>close2 && momentum==true)
{
double low0 = iLow(NULL, 0, i);
double low2 = iLow(NULL, 0, i+2);
TrendCreate(DivergenceIndentifier+"Sub"+i,Time,Histo,Time,Histo,Red,STYLE_SOLID,1,IDWindow);
TrendCreate(DivergenceIndentifier+"Main"+i,Time,low2,Time,low0,Red,STYLE_SOLID,1,0);
}
}
}
return(0);
}
//+------------------------------------------------------------------+
void manageArrow(int i)
{
if(ShowArrows)
{
deleteArrow(Time);
if(trend ==-1) drawArrow(i,OverBoughtColor,159,false);
if(trend == 1) drawArrow(i,OverSoldColor ,159,true );
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void fnDeleteAllDivergence()
{
string lookFor=DivergenceIndentifier;
string objectName;
int lookForLength=StringLen(lookFor);
for(int i=ObjectsTotal()-1; i>=0; i--)
{
objectName=ObjectName(i);
if(StringSubstr(objectName,0,lookForLength)==lookFor) ObjectDelete(objectName);
}
}
//
//
//
//
//
void drawArrow(int i,color theColor,int theCode,bool up)
{
string name=arrowsIdentifier+":"+Time;
double gap=3.0*iATR(NULL,0,10,i)/4.0; //20
//
//
//
//
//
ObjectCreate(name,OBJ_ARROW,0,Time,0);
ObjectSet(name,OBJPROP_ARROWCODE,theCode);
ObjectSet(name,OBJPROP_COLOR,theColor);
ObjectSet(name,OBJPROP_WIDTH,arrowsWidth);
if(up)
ObjectSet(name,OBJPROP_PRICE1,High+gap);
else ObjectSet(name,OBJPROP_PRICE1,Low-gap);
}
//
//
//
//
//
void deleteArrows()
{
string lookFor = arrowsIdentifier+":";
int lookForLength = StringLen(lookFor);
for(int i=ObjectsTotal()-1; i>=0; i--)
{
string objectName=ObjectName(i);
if(StringSubstr(objectName,0,lookForLength)==lookFor) ObjectDelete(objectName);
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void deleteArrow(datetime time)
{
string lookFor=arrowsIdentifier+":"+time; ObjectDelete(lookFor);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
bool TrendCreate(string name="Line1",
datetime time1=0, // first point time
double price1=0, // first point price
datetime time2=0, // second point time
double price2=0, // second point price
const color clr=clrRed, // line color
const ENUM_LINE_STYLE style=STYLE_SOLID, // line style
const int width=1,
const int window=0 // line width // highlight to move
)
{
//--- reset the error value
ResetLastError();
//--- create a trend line by the given coordinates
if(!ObjectCreate(name,OBJ_TREND,window,time1,price1,time2,price2))
{
Print(__FUNCTION__,": failed to create a trend line! Error code = ",GetLastError());
return(false);
}
//--- set line color
ObjectSetInteger(0,name,OBJPROP_COLOR,clr);
//--- set line display style
ObjectSetInteger(0,name,OBJPROP_STYLE,style);
//--- set line width
ObjectSetInteger(0,name,OBJPROP_WIDTH,width);
ObjectSetInteger(0,name,OBJPROP_SELECTED,false);
//--- enable (true) or disable (false) the mode of continuation of the line's display to the right
ObjectSetInteger(0,name,OBJPROP_RAY_RIGHT,false);
//--- successful execution
return(true);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void CleanPoint(int i,double &first[],double &second[])
{
if((second!=EMPTY_VALUE) &&(second !=EMPTY_VALUE))
second=EMPTY_VALUE;
else
if((first!=EMPTY_VALUE) && (first!=EMPTY_VALUE) && (first==EMPTY_VALUE))
first=EMPTY_VALUE;
}
//
//
//
//
//
void PlotPoint(int i,double &first[],double &second[],double &from[])
{
if(first==EMPTY_VALUE)
{
if(first==EMPTY_VALUE)
{
first = from;
first = from;
second = EMPTY_VALUE;
}
else
{
second = from;
second = from;
first = EMPTY_VALUE;
}
}
else
{
first = from;
second = EMPTY_VALUE;
}
}
//+------------------------------------------------------------------+
//---试着像这样。
你是最棒的
谢谢![](https://c.mql5.com/forextsd/smiles/smile.png)
大家好,谁能把这个指标修改一下,让它也显示红色的柱子,因为我只能看到绿色的上升。谢谢。(Deltaforce Volume)
另外,您能不能修复这个指标,以便我可以调整条形图的厚度。(Deltaforce) 再次感谢
![](https://c.mql5.com/forextsd/smiles/regular_smile.png)
嗨,Mladen和工具先生
我有一个问题,我不知道如何做到这一点,也许用一个指标或EA,但我真的需要它,也许你能帮助我。
我需要一个半自动的订单系统,我的意思是,我手动获得第一笔交易,"市场订单 "与SL和TP,如果SL被击中,系统创建一个新的订单在相反的方向与SL(对于新的订单是入口),现在第一笔交易的入口是SL和TP,始终是相同的点值,但我想手动设置,多少手或迷你手应该在渐进交易中打开,有点像马丁格尔,但不是真的。......,直到击中TP,系统应该创建新的订单,当TP被击中时,系统停止或关闭,直到我再次手动输入第一个订单。我希望,我没有在解释中造成混乱!;-)
是否有这样的东西我可以使用?
非常感谢
嗨,Mladen和Mr.
我有一个问题,我不知道如何做到这一点,也许用一个指标或EA,但我真的需要它,也许你能帮助我。
我需要一个半自动的订单系统,我的意思是,我手动获得第一笔交易,"市场订单 "与SL和TP,如果SL被击中,系统创建一个新的订单在相反的方向与SL(对于新的订单是入口),现在第一笔交易的入口是SL和TP,总是相同的点值,但我想手动设置,多少手或迷你手应该在渐进交易中打开,有点像马汀格尔,但不是真的。......,直到击中TP,系统应该创建新的订单,当TP被击中时,系统停止或关闭,直到我再次手动输入第一个订单。我希望,我没有在解释中造成混乱!;-)
是否有类似的东西我可以使用?
非常感谢劳动法
这些规则太松散了,无法在此基础上制作EA,据我所知,没有这样的EA。
我发现了这个EA,这正是我在寻找的......你觉得它怎么样?
https://www.mql5.com/en/forum/184476