bool OrderModify(int ticket, double price, double stoploss, double takeprofit, datetime datetime expiration, color arrow_color=CLR_NONE)
Modification of characteristics for the previously opened position or pending
orders. If the function succeeds, the returned value will be TRUE. If the
function fails, the returned value will be FALSE. To get the detailed error
information, call GetLastError() function.
既に保有しているポジション、もしくは待機中オーダーの内容を修正します。この関数が正常終了した場合、戻り値は TRUE です。この関数が失敗した場合、戻り値は
FALSE です。詳細なエラー情報を取得するには、GetLastError() を呼び出します。
Notes: Open price and expiration time can be changed only for pending orders.
注意: 注文価格と有効期限は、待機中オーダーのみ変更することができます。
If unchanged values are passed as the function parameters, the error 1 (ERR_NO_RESULT) will be generated.
もし、変更されていない値が、関数パラメータとして渡された場合、エラー 1 (ERR_NO_RESULT) が生成されます。
Pending order expiration time can be disabled in some trade servers. In
this case, when a non-zero value is specified in the expiration parameter,
the error 147 (ERR_TRADE_EXPIRATION_DENIED) will be generated.
待機中オーダーの有効期限は、一部のトレード サーバーで無効になることがあります。この場合、ゼロ以外の値が、有効期限パラメータで指定されると、エラー 147 (ERR_TRADE_EXPIRATION_DENIED) が生成されます。
Parameters:
パラメータ:
| ticket |
- |
Unique number of the order ticket. オーダーチケットの一意の番号。 |
| price |
- |
New open price of the pending order. 待機中オーダーの新しい注文価格。 |
| stoploss |
- |
New StopLoss level. 新しい損切りレベル。 |
| takeprofit |
- |
New TakeProfit level. 新しい利食いレベル。 |
| expiration |
- |
Pending order expiration time. 待機中オーダーの有効期限。 |
| arrow_color |
- |
Arrow color for StopLoss/TakeProfit modifications in the chart.
If the parameter is missing or has CLR_NONE value, the arrows will not be shown in the chart.
チャート上の変更した損切りと利食いの矢印の色。もし、パラメータが欠けているか、CLR_NONE 値をもっている場合は、決済した矢印はチャート上に表示されません。 |
|
Sample:
サンプル:
if(TrailingStop>0)
{
OrderSelect(12345,SELECT_BY_TICKET);
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Blue);
return(0);
}
}
}
|