OpenShort

Führt Operationen für Eröffnung einer Short-Position.

virtual bool  OpenShort(
   double    price,    // Preis
   double    sl,       // Stop Loss
   double    tp        // Take Profit
   )

Parameter

price

[in] Markteintrittspreis.

sl

[in] Preis von Stop Loss.

tp

[in] Preis von Take Profit.

Rückgabewert

Gibt true zurück wenn eine Operation ausgeführt ist, ansonsten gibt false zurück.

Hinweis

Die Lotgröße ist durch den Aufruf von LotOpenShort()-Methode definiert. Wenn ein Lot nicht gleich 0.0 ist, eröffnet die Position (Aufruf der Sell(...)-Methode vom Handelsobjekt).

Implementierung

//+------------------------------------------------------------------+
//| Short position open or limit/stop order set                      |
//| INPUT:  price - price,                                           |
//|         sl    - stop loss,                                       |
//|         tp    - take profit.                                     |
//| OUTPUT: true-if trade operation successful, false otherwise.     |
//| REMARK: no.                                                      |
//+------------------------------------------------------------------+
bool CExpert::OpenShort(double price,double sl,double tp)
  {
   if(price==EMPTY_VALUEreturn(false);
//--- get lot for open
   double lot=LotOpenShort(price,sl);
//--- check lot for open
   if(lot==0.0) return(false);
//---
   return(m_trade.Sell(lot,price,sl,tp));
  }