编码帮助 - 页 679 1...672673674675676677678679680681682683684685686...786 新评论 Mladen Rakic 2016.09.18 18:14 #6781 stevenpun: 你好,Mladen先生。我在想,当价格从趋势中反转时,添加一个评论,并有 "等待购买 "和 "等待出售"。在买入时添加新线是没有问题的,但在卖出时添加新线却无法使其发挥作用。我应该怎么改呢? 试着像这样。 string OPstr = "NO TRADE";; color OPclr = clrYellow; if (buffer1[i+SignalCandle]>buffer5[i+SignalCandle]) if (Bid < buffer1[i+SignalCandle] ) { OPstr = "BUY"; OPclr = clrGreen; } else { OPstr = "WAIT FOR BUY"; OPclr = clrLimeGreen; } if (buffer1[i+SignalCandle]<buffer6[i+SignalCandle] ) if (Bid > buffer1[i+SignalCandle] ) { OPstr = "SELL"; OPclr = clrRed; } else { OPstr = "WAIT FOR SELL"; OPclr = clrOrangeRed; } simon_json 2016.09.19 11:15 #6782 嗨,mladen。我尝试这样结合StepMA PDF和RSI。当StepMA PDF上升,且价格越过RSI 30时买入。 当RSI达到70时关闭买入(或买入SL,TS和TP),这个我不知道如何插入。 当StepMA PDF上升,价格越过RSI 70时卖出。 当RSI达到30(或买入SL、TS和TP)时关闭卖出,这一点我不知道如何插入。int doWhat = _doNothing; double hull_trend_current = iCustom(NULL,0,"StepMA pdf 4_6",PERIOD_CURRENT,"",PdfmaLength,SensivityFactor,ConstantStepSize,PdfmaVariance,PdfmaMean,PriceToUse,PdfmaFilter,9,BarToUse); double hull_trend_previous = iCustom(NULL,0,"StepMA pdf 4_6",PERIOD_CURRENT,"",PdfmaLength,SensivityFactor,ConstantStepSize,PdfmaVariance,PdfmaMean,PriceToUse,PdfmaFilter,9,BarToUse+1); double rsicurrent=iRSI(NULL,0,rsiu,PRICE_CLOSE,0); double rsiprevious=iRSI(NULL,0,rsiu,PRICE_CLOSE,1); if (hull_trend_current==1 && rsiprevious<lowerband&&rsicurrent>=lowerband) doWhat = _doBuy; if (hull_trend_current==-1 && rsiprevious>upperband&&rsicurrent<=upperband) doWhat = _doSell; if (doWhat==_doNothing && !DisplayInfo) return(0);但我不知道这是否正确? 我怎样才能使收盘条件同时适用于买和卖?extern int rsiu = 14; // RSI period extern int lowerband = 30; // RSI lowerband extern int upperband = 70; // RSI upperband Mladen Rakic 2016.09.19 11:27 #6783 simon_json:嗨,mladen。我试图像这样把StepMA PDF和RSI结合起来。当StepMA PDF上升,价格越过RSI 30时买入。,当RSI达到70时关闭买入(或买入SL,TS和TP),这个我不知道如何插入。 当StepMA PDF上升,价格越过RSI 70时卖出。 当RSI达到30时关闭卖出(或买入SL、TS和TP),这一点我不知道如何插入。但我不知道这是否正确? 我怎样才能使收盘条件同时适用于买入和卖出?在我看来,这是好的。关于平仓条件:为什么不在有新订单信号 时简单地关闭相反类型的订单? simon_json 2016.09.19 11:27 #6784 simon_json: 你好,mladen。我尝试这样结合StepMA PDF和RSI。当StepMA PDF上升,且价格越过RSI 30时买入。 当RSI达到70时关闭买入(或买入SL,TS和TP),这我不知道如何插入。 当StepMA PDF上升,价格越过RSI 70时卖出。 当RSI达到30(或买入SL、TS和TP)时关闭卖出,这一点我不知道如何插入。但我不知道这是否正确? 我怎样才能使收盘条件同时适用于买和卖? 如果StepMA PDF由升转降,也应该关闭买入(如果有买入指令)。 如果StepMA PDF由跌转涨,也应关闭卖出(如果有卖出订单。 simon_json 2016.09.19 11:48 #6785 mladen: 在我看来,这是好的。关于平仓条件:为什么不在有新订单信号时简单地平仓相反类型的订单? 谢谢你的回答! 恐怕我不明白 :)我认为当新订单的信号出现时,关闭订单是行不通的。 它现在是这样工作的。 这很好。 我还想通过两个条件来关闭一个订单,而不是像现在这样只关闭SL、TP。 这些条件应该是。 如果一个买入订单打开,StepMA PDF从向上变为向下,买入订单应该被关闭。 如果 买入订单打开,RSI达到70(上限),买入订单应该被关闭。而卖出则相反。 如果卖出订单打开,StepMA PDF从下降到上升,卖出订单应该被关闭。 如果卖出订单打开,RSI达到30(下限),卖出订单应该被关闭。 Mladen Rakic 2016.09.19 17:09 #6786 simon_json:谢谢你的回答! 我恐怕不明白 :)我认为当有新的订单信号出现时,关闭订单是行不通的。 它现在是这样工作的。,这很好。 我还想通过两个条件来关闭一个订单,而不是像现在这样只关闭SL、TP。 这些条件应该是: 如果一个买入的订单打开,StepMA PDF由上升变为下降,那么这个买入的订单应该被关闭。 如果 买入订单打开,RSI达到70(上限),买入订单应该被关闭。而卖出的情况则相反: 如果卖出订单打开,StepMA PDF从下降变为上升,则应关闭卖出订单。 如果卖出订单打开,RSI达到30(下限),卖出订单应该被关闭。西蒙那么你必须用检查 开仓条件的同样方法来检查 平仓条件 FxSteven 2016.09.19 17:38 #6787 mladen: 试着像这样: 谢谢你的建议,它现在工作得很好 :D只要改变买入和卖出的出价条件。 speedytina 2016.09.19 18:21 #6788 你好。是否有可能对所附的indi进行编码,使我能够改变字体大小、字体颜色和图表上的角落位置?谢谢你的帮助。谢谢 附加的文件: pipvaluecalculatorv1_02.mq4 5 kb Mladen Rakic 2016.09.19 19:48 #6789 speedytina: 你好。是否有可能对所附的indi进行编码,使我能够改变字体大小、字体颜色和图表上的角落位置?感谢任何帮助。谢谢 试试这样的方法(除了角以外的都可以)#property indicator_chart_window #property strict extern double LotSize=1; // Lot Size extern int CommentsXPos = 50; extern int CommentsStartYPos = 20; extern int CommentLinesIncrement = 13; extern string CommentFont = "Courier new"; extern int CommentFontSize = 10; extern string CommentsID = "comment"; extern color CommentsColorOddLines = clrDeepSkyBlue; extern color CommentsColorEvenLines = clrSandyBrown; int init() { return(0); } int deinit() { return(0); } #define NL "\n" int start() { string DepositCurrency=AccountInfoString(ACCOUNT_CURRENCY); double PipValue=(((MarketInfo(Symbol(),MODE_TICKVALUE)*MathPow(10,MathMod(_Digits,2)))/MarketInfo(Symbol(),MODE_TICKSIZE))*LotSize); double PointValue=PipValue/10; string CommentString=""; CommentString+="Your deposit currency: " + DepositCurrency +NL; CommentString+="Lot size requested: " + DoubleToStr(LotSize,2) +NL; CommentString+="-----------------------------------------------------------------"+NL; CommentString+="Value of one point (" + Symbol() + "): $" + DepositCurrency + " " + DoubleToStr(PointValue,3) +NL; CommentString+="Value of one pip (" + Symbol() + ") : $" + DepositCurrency + " " + DoubleToStr(PipValue,3) +NL; CommentString+="-----------------------------------------------------------------"+NL; displayComment(CommentString,CommentsXPos,CommentsStartYPos,CommentLinesIncrement,CommentsID,CommentsColorOddLines,CommentsColorEvenLines); return(0); } //------------------------------------------------------------------- // //------------------------------------------------------------------- // // // // // #include <ChartObjects\ChartObjectsTxtControls.mqh> CChartObjectLabel commentLabels[]; // // // // // void displayComment(string comment, int xpos, int ypos, int increment, string id, color commentColorOdd, color commentColorEven) { string lines[]; int linesNo = 0; int s = 0; int i = StringFind(comment,NL,s); while (i > 0) { string current = StringSubstr(comment,s,i-s); ArrayResize(lines,linesNo+1); lines[linesNo] = current; linesNo++; s = i + 1; i = StringFind(comment,NL,s); } for (i=ArraySize(commentLabels)-1; i>=0; i--) commentLabels[i].Delete(); ArrayResize(commentLabels,linesNo); for (i=0; i<linesNo; i++) if (MathMod(i,2)==0) LabelCreate(commentLabels[i],id+":"+(string)i,StringSubstr(lines[i],0,StringLen(lines[i])-1),commentColorOdd ,xpos,ypos+i*increment,CommentFontSize,CommentFont); else LabelCreate(commentLabels[i],id+":"+(string)i,StringSubstr(lines[i],0,StringLen(lines[i])-1),commentColorEven,xpos,ypos+i*increment,CommentFontSize,CommentFont); } bool LabelCreate(CChartObjectLabel &lbl,const string name,const string text, const color clr,const int x,const int y, int fontSize=10, string font="Courier new") { if (!lbl.Create(0,name,0,x,y)) return(false); if (!lbl.Description(text)) return(false); if (!lbl.FontSize(fontSize)) return(false); if (!lbl.Color(clr)) return(false); if (!lbl.Font(font)) return(false); return(true); } Fausto Nunziante Del Gaudio 2016.09.19 20:59 #6790 Mladen我不能成功地使它工作。它不能自我更新,也不显示警报。你能帮帮我吗?#property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Gold #property indicator_color2 DodgerBlue #property indicator_color3 LimeGreen #property indicator_color4 Crimson #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 2 extern string NOTE1 = "SELECT PARAMETERS OF THE INDICATOR"; //SPAN MA CROSS PARAMS extern int SpanPeriod = 1; // Period of Span extern int SpanShift = -26; // Shift of Span extern ENUM_MA_METHOD SpanMode = 1; // Mode of Span extern ENUM_APPLIED_PRICE SpanPrice = 0; // Applied price of Span extern int MaPeriod = 55; // Period of Moving average extern int MaShift = 0; // Shift of Moving average extern ENUM_MA_METHOD MaMode = 1; // Mode of Moving average extern ENUM_APPLIED_PRICE MaPrice = 0; // Applied price of Moving average extern string NOTE2 = "SELECT COLORS/STYLES OF THE INDICATOR"; //SPAN MA CROSS COLORS/STYLES extern color SpanClr = Gold; // Span color extern int SpanWdt = 2; // Span width extern ENUM_LINE_STYLE SpanStl = 0; // Span line style extern color MaClr = DodgerBlue; // Moving average color extern int MaWdt = 2; // Moving average width extern ENUM_LINE_STYLE MaStl = 0; // Moving average line style extern string NOTE3 = "SELECT PARAMETERS OF THE SIGNAL ARROWS"; //SPAN MA CROSS PARAMETERS OF THE SIGNAL ARROWS extern bool DrawArrows = true; // Draw signal arrows? extern bool DrawMaLines = true; // Draw lines? extern color UpArrowClr = LimeGreen; // Up arrow color extern int UpArrowWdt = 2; // Up arrow width extern color DnArrowClr = Crimson; // Down arrow color extern int DnArrowWdt = 2; // Down arrow width extern int ArrowsDistance = 2; // Arrows distance from candle extern int ArrowHshift = 0; // Shift for arrows from cross signal extern string NOTE4 = "SELECT PARAMETERS OF THE ALERT"; //SPAN MA CROSS PARAMETERS OF THE ALERT extern bool AlertsOn = true; // Active alert? extern bool AlertsOnCurrent = true; // Alert on current unclosed bar extern bool AlertsMessage = true; // Alert message extern bool AlertsSound = true; // Alert sound extern bool AlertsEmail = false; // Alert e-mail extern string SoundFile = "alert2.wav"; // Filename of sound alert string IndicatorFileName; int WhichBar; double Gap; double SpanBuffer[]; // Buffer of the Span double MaBuffer[]; // Buffer of the Moving average double CrossUpBuffer[]; // Up arrow buffer double CrossDnBuffer[]; // Down arrow buffer double TrendBuffer[]; // Span/Ma cross buffer int init() { IndicatorFileName = WindowExpertName(); IndicatorBuffers(5); SetIndexBuffer(0, SpanBuffer); SetIndexBuffer(1, MaBuffer); SetIndexBuffer(2, CrossUpBuffer); SetIndexBuffer(3, CrossDnBuffer); SetIndexBuffer(4, TrendBuffer); if (DrawMaLines) { SetIndexStyle (0, DRAW_LINE, SpanStl, SpanWdt, SpanClr); SetIndexStyle (1, DRAW_LINE, MaStl, MaWdt, MaClr);} else { SetIndexStyle(0, DRAW_NONE); SetIndexStyle(1, DRAW_NONE);} if (DrawArrows) { SetIndexStyle (2, DRAW_ARROW, 0, UpArrowWdt, UpArrowClr); SetIndexArrow(2, 233); SetIndexStyle (3, DRAW_ARROW, 0, DnArrowWdt, DnArrowClr); SetIndexArrow(3, 234);} else { SetIndexStyle(2, DRAW_NONE); SetIndexStyle(3, DRAW_NONE);} SetIndexShift(2,ArrowHshift); SetIndexShift(3,ArrowHshift); return(0);} int deinit() { return(0); } int start() { int counted_bars = IndicatorCounted(); int i, limit; if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit = MathMin(Bars-counted_bars, Bars-1); for(i=limit; i>=0; i--){ SpanBuffer[i] = iMA(NULL, 0, SpanPeriod, SpanShift, SpanMode, SpanPrice, i); MaBuffer[i] = iMA(NULL, 0, MaPeriod, MaShift, MaMode, MaPrice, i); Gap = iATR(NULL,0,20,i); if (i<Bars-1) TrendBuffer[i] = TrendBuffer[i+1]; if (SpanBuffer[i] > MaBuffer[i]) TrendBuffer[i] = 1; if (SpanBuffer[i] < MaBuffer[i]) TrendBuffer[i] =-1; CrossUpBuffer[i] = EMPTY_VALUE; CrossDnBuffer[i] = EMPTY_VALUE; if (i<Bars-1 && TrendBuffer[i]!= TrendBuffer[i+1]) if (TrendBuffer[i] == 1) CrossUpBuffer[i] = Low[i] - ArrowsDistance * Gap; else CrossDnBuffer[i] = High[i] + ArrowsDistance * Gap; } if (AlertsOn) { if (AlertsOnCurrent) WhichBar = 0; else WhichBar = 1; if (TrendBuffer[WhichBar] != TrendBuffer[WhichBar+1]) if (TrendBuffer[WhichBar] == 1) doAlert("uptrend"); else doAlert("downtrend"); } return(0); } // CUSTOM FUNCTIONS ------------------------- void doAlert(string doWhat) { static string previousAlert="nothing"; static datetime previousTime; string message; if (previousAlert != doWhat || previousTime != Time[0]) { previousAlert = doWhat; previousTime = Time[0]; message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," Span ma cross ", doWhat); if (AlertsMessage) Alert(message); if (AlertsEmail) SendMail(StringConcatenate(Symbol()," Span ma cross "), message); if (AlertsSound) PlaySound(SoundFile); } } 1...672673674675676677678679680681682683684685686...786 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
你好,Mladen先生。
我在想,当价格从趋势中反转时,添加一个评论,并有 "等待购买 "和 "等待出售"。
在买入时添加新线是没有问题的,但在卖出时添加新线却无法使其发挥作用。
我应该怎么改呢?
试着像这样。
嗨,mladen。
我尝试这样结合StepMA PDF和RSI。当StepMA PDF上升,且价格越过RSI 30时买入。
当RSI达到70时关闭买入(或买入SL,TS和TP),这个我不知道如何插入。
当StepMA PDF上升,价格越过RSI 70时卖出。
当RSI达到30(或买入SL、TS和TP)时关闭卖出,这一点我不知道如何插入。
但我不知道这是否正确?
我怎样才能使收盘条件同时适用于买和卖?
嗨,mladen。
我试图像这样把StepMA PDF和RSI结合起来。当StepMA PDF上升,价格越过RSI 30时买入。
,当RSI达到70时关闭买入(或买入SL,TS和TP),这个我不知道如何插入。
当StepMA PDF上升,价格越过RSI 70时卖出。
当RSI达到30时关闭卖出(或买入SL、TS和TP),这一点我不知道如何插入。
但我不知道这是否正确?
我怎样才能使收盘条件同时适用于买入和卖出?
在我看来,这是好的。
关于平仓条件:为什么不在有新订单信号 时简单地关闭相反类型的订单?
你好,mladen。
我尝试这样结合StepMA PDF和RSI。当StepMA PDF上升,且价格越过RSI 30时买入。
当RSI达到70时关闭买入(或买入SL,TS和TP),这我不知道如何插入。
当StepMA PDF上升,价格越过RSI 70时卖出。
当RSI达到30(或买入SL、TS和TP)时关闭卖出,这一点我不知道如何插入。
但我不知道这是否正确?
我怎样才能使收盘条件同时适用于买和卖?
如果StepMA PDF由升转降,也应该关闭买入(如果有买入指令)。
如果StepMA PDF由跌转涨,也应关闭卖出(如果有卖出订单。
在我看来,这是好的。
关于平仓条件:为什么不在有新订单信号时简单地平仓相反类型的订单?
谢谢你的回答!
恐怕我不明白 :)我认为当新订单的信号出现时,关闭订单是行不通的。
它现在是这样工作的。
这很好。
我还想通过两个条件来关闭一个订单,而不是像现在这样只关闭SL、TP。
这些条件应该是。
如果一个买入订单打开,StepMA PDF从向上变为向下,买入订单应该被关闭。
如果 买入订单打开,RSI达到70(上限),买入订单应该被关闭。
而卖出则相反。
如果卖出订单打开,StepMA PDF从下降到上升,卖出订单应该被关闭。
如果卖出订单打开,RSI达到30(下限),卖出订单应该被关闭。
谢谢你的回答!
我恐怕不明白 :)我认为当有新的订单信号出现时,关闭订单是行不通的。
它现在是这样工作的。
,这很好。
我还想通过两个条件来关闭一个订单,而不是像现在这样只关闭SL、TP。
这些条件应该是:
如果一个买入的订单打开,StepMA PDF由上升变为下降,那么这个买入的订单应该被关闭。
如果 买入订单打开,RSI达到70(上限),买入订单应该被关闭。
而卖出的情况则相反:
如果卖出订单打开,StepMA PDF从下降变为上升,则应关闭卖出订单。
如果卖出订单打开,RSI达到30(下限),卖出订单应该被关闭。
西蒙
那么你必须用检查 开仓条件的同样方法来检查 平仓条件
试着像这样:
谢谢你的建议,它现在工作得很好 :D
只要改变买入和卖出的出价条件。
你好。
是否有可能对所附的indi进行编码,使我能够改变字体大小、字体颜色和图表上的角落位置?
谢谢你的帮助。
谢谢
你好。
是否有可能对所附的indi进行编码,使我能够改变字体大小、字体颜色和图表上的角落位置?
感谢任何帮助。
谢谢
试试这样的方法(除了角以外的都可以)
Mladen我不能成功地使它工作。它不能自我更新,也不显示警报。你能帮帮我吗?