Exemplo n.º 1
0
 public UpdateEventArgs(Update update)
 {
     this.update = update;
 }
Exemplo n.º 2
0
        private void OnNotifyUpdate(XTAPI.TTInstrNotify pNotify, XTAPI.TTInstrObj pInstr)
        {
            try
            {
                Array data = (Array)pInstr.get_Get("Bid#,Ask#,NetPos,PL.Z,OpenPL^");

                //get currency amount of tick
                double tickvalue = Convert.ToDouble(pInstr.get_TickPrice(0, 1, "^"));

                for (int i = 0; i < data.Length; ++i)
                    if (data.GetValue(i) == null)
                        return;

                Update update = new Update();

                update.Bid = Convert.ToDouble(data.GetValue(0));
                update.Ask = Convert.ToDouble(data.GetValue(1));
                update.NetPos = Convert.ToInt16(data.GetValue(2));
                //convert number of ticks from PL to currency
                update.PL = tickvalue * Convert.ToDouble(data.GetValue(3));
                update.OpenPL = Convert.ToDouble(data.GetValue(4));
                update.Symbol = pInstr.Product;

                if (OnUpdate != null)
                    OnUpdate(this, new UpdateEventArgs(update));
            }
            catch (Exception ex)
            {
                if (log.IsErrorEnabled) log.Error(ex.StackTrace);
            }
        }