第1句是本来的移动止损,但是第一次止损改成由开盘价来决定,这样才可以用一些限制条件来避免不断移动。第2句新加的才是买单的移动止损,按照你说的每移动TrailingStop才向上相应移动一样的点数。 1. if(OrderType() == OP_BUY && Bid-Point*TrailingStop >= OrderOpenPrice() &&
That's why we've created a dedicated space to address all your pressing questions. Whether you're puzzled about the intricacies of creating a trailing stop in MQL4, curious about the inner workings of MT4, or seeking advice on trading strategies, our Q&A section is here to help. ...
if(OrderStopLoss()<Bid-Point*TrailingStop) { boolres=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid-Point*TrailingStop,Digits),OrderTakeProfit(),0,Blue); if(!res) Print("Error in OrderModify. Error code=",GetLastError()); ...
if(OrderStopLoss()<Bid-Point*TrailingStop) { boolres=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid-Point*TrailingStop,Digits),OrderTakeProfit(),0,Blue); if(!res) Print("Error in OrderModify. Error code=",GetLastError()); ...
ObjectSet("SLs",OBJPROP_ARROWCODE,6); ObjectSet("SLs",OBJPROP_COLOR,255); } for ( dfz_in_30 = 0 ; TrailingStop!=0 && dfz_in_30<OrdersTotal() ; dfz_in_30 = dfz_in_30 + 1) { if (OrderSelect(dfz_in_30,SELECT_BY_POS,MODE_TRADES) && OrderSymbol()==Symbol() &&...
Consider the following code to set a trailing stoploss step by step until the order is in breakeven state:// Partial code for illustration purposes; not runnable if you don't have other codes // M_POINT is a constant (the Point value of current symbol) void TrailToBreakeven(const Order ...
};//The code before this line can be put in a separate mqh header//We use macros to declare inputs//Notice the trailing semicolon at the end of each INPUT, it is needed//support custom display name because of some unknown rules from MetaQuotesBEGIN_INPUT(MyEaParam) ...
TrailingStop double 35 Figure 2 – the second step wizard Now click the Finish button to close the wizard, and MetaEditor will bring to you the code created by the wizard and saves the file My_First_EA.mq4 in the MetaTrader 4 \experts path. ...
问将mql4 EA转换为mql5EN版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供...
Print("Error ",GetLastError()," TrailingStop Modify Sell SL ",dfz_do_25,"->",dfz_do_26," TP "); }}} } if (dfz_do_4>by_do_18 && dfz_do_3>by_do_18) { ObjectSetText("Char.op",CharToString(251),by_in_25 + 2,"Wingdings",Silver); if...