Esempio n. 1
0
        // Notes:
        // - Represents a single buy or sell order with the broker.
        // - A trade can have more than one of these.
        // - Orders are low level application objects, they don't know about charts, accounts, etc.
        // - Base currency is the currency of the first part of the instrument, e.g GBPNZD - base currency = GBP
        // - Account currency is the currency of the account = base currency * price_data.PipValue / price_data.PipSize

        public Order(int id, Instrument instr, ETradeType trade_type, Trade.EState state)
        {
            Id            = id;
            Instrument    = instr;
            TradeType     = trade_type;
            EntryPrice    = 0;
            ExitPrice     = 0;
            EntryTimeUTC  = DefaultEntryTime;
            ExitTimeUTC   = DefaultExitTime;
            StopLossAbs   = 0;
            TakeProfitAbs = 0;
            Volume        = 0;
            GrossProfit   = 0;
            NetProfit     = 0;
            Commissions   = 0;
            Swap          = 0;
            Comment       = string.Empty;
            State         = state;
        }
Esempio n. 2
0
 /// <summary>True if the stop loss level can be changed for an order in this state</summary>
 public static bool CanMoveExpiry(this Trade.EState state)
 {
     return(state == Trade.EState.Visualising || state == Trade.EState.PendingOrder);
 }
Esempio n. 3
0
 public StateChangedEventArgs(Trade.EState old_state, Trade.EState new_state)
 {
     OldState = old_state;
     NewState = new_state;
 }
Esempio n. 4
0
 /// <summary>True if the stop loss level can be changed for an order in this state</summary>
 public static bool CanMoveTakeProfit(this Trade.EState state)
 {
     return(state == Trade.EState.Visualising || state == Trade.EState.PendingOrder || state == Trade.EState.ActivePosition);
 }