最后由 zhoujun 于 2024-4-22 12:37 编辑
- void ModifyByPrice(string SymbolX,int OrderTypeX,double StopLossX,double TakeProfitX,int MagicX)
- {
- if(StopLossX>=0)
- for(int i=OrdersTotal()-1; i>=0; i--)
- {
- if(OrderSelect(i,SELECT_BY_POS))
- if((OrderSymbol()==SymbolX|| SymbolX=="-1")&&(OrderMagicNumber()==MagicX||MagicX==-1)&&(OrderType()==OrderTypeX||OrderTypeX==-1))
- if(NormalizeDouble(StopLossX,(int)MarketInfo(OrderSymbol(),MODE_DIGITS))!=OrderStopLoss())
- if(!OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(StopLossX,(int)MarketInfo(OrderSymbol(),MODE_DIGITS)),OrderTakeProfit(),0,Yellow))
- Print(GetLastError());
- }
- if(TakeProfitX>=0)
- for(int i=OrdersTotal()-1; i>=0; i--)
- if(OrderSelect(i,SELECT_BY_POS))
- if((OrderSymbol()==SymbolX|| SymbolX=="-1")&&(OrderMagicNumber()==MagicX||MagicX==-1)&&(OrderType()==OrderTypeX||OrderTypeX==-1))
- if(OrderTakeProfit()!=NormalizeDouble(TakeProfitX,(int)MarketInfo(OrderSymbol(),MODE_DIGITS)))
- if(!OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),NormalizeDouble(TakeProfitX,(int)MarketInfo(OrderSymbol(),MODE_DIGITS)),0,Yellow))
- Print(GetLastError());
- }
这个是高手的指定价格版,如何修改为该订单开仓价的指定点数,请老师不吝赐教,非常感谢 |