private void AddNewQuote(MtQuote quote) { var key = quote.ExpertHandle.ToString(); listViewQuotes.Items.Add(new data() { symbol = quote.Instrument.ToString(), ask = quote.Ask.ToString(), bid = quote.Bid.ToString(), expert = key }); }
private void RemoveQuote(MtQuote quote) { var key = quote.ExpertHandle.ToString(); if (listViewQuotes.Items.ContainsKey(key)) { listViewQuotes.Items.RemoveByKey(key); } }
private void ChangeQuote(MtQuote quote) { _isUiQuoteUpdateReady = false; var key = quote.ExpertHandle.ToString(); if (listViewQuotes.Items.ContainsKey(key)) { var item = listViewQuotes.Items[key]; item.SubItems[1].Text = quote.Bid.ToString(CultureInfo.CurrentCulture); item.SubItems[2].Text = quote.Ask.ToString(CultureInfo.CurrentCulture); } _isUiQuoteUpdateReady = true; }
private void InitParams() { listOrders.Clear(); AccountBalance = 0; AccountEquity = 0; AccountFreeMargin = 0; AccountMargin = 0; AccountProfit = 0; AccountNumber = 0; listSymbols.Clear(); currentQuote = new MtQuote("", 0, 0); dSwapBuy = 0; dSwapSell = 0; bAvailable = false; }
private void AddNewQuote(MtQuote quote) { var key = quote.ExpertHandle.ToString(); if (listViewQuotes.Items.ContainsKey(key) == false) { var item = new ListViewItem(quote.Instrument) { Name = key }; item.SubItems.Add(quote.Bid.ToString(CultureInfo.CurrentCulture)); item.SubItems.Add(quote.Ask.ToString(CultureInfo.CurrentCulture)); item.SubItems.Add(key); listViewQuotes.Items.Add(item); } }
private void UpdateWatchList(MtQuote quote) { //check if Form is watchlist var forms = watchListForms.Where(m => m.symbol.Split(',').Contains(quote.Instrument)).ToList(); foreach (var item in forms) { frmMarketWatch = item.form; var watchList = frmMarketWatch.ObjTrading as BindingList <FinexTicker>; var watch = watchList.Where(m => m.pair == Broker.MT.ToString() + "." + quote.Instrument).FirstOrDefault(); if (watch != null) { bool bidBlue = true; bool askBlue = true; int index = watchList.IndexOf(watch); if (Convert.ToDecimal(quote.Bid) > Convert.ToDecimal(watch.bid)) { frmMarketWatch.dataGridMarketData.Rows[index].Cells[1].Style.ForeColor = Color.Blue; } else { frmMarketWatch.dataGridMarketData.Rows[index].Cells[1].Style.ForeColor = Color.Red; bidBlue = false; } if (Convert.ToDecimal(quote.Ask) > Convert.ToDecimal(watch.ask)) { frmMarketWatch.dataGridMarketData.Rows[index].Cells[2].Style.ForeColor = Color.Blue; } else { frmMarketWatch.dataGridMarketData.Rows[index].Cells[2].Style.ForeColor = Color.Red; askBlue = false; } if (!bidBlue || !askBlue) { ((TextAndImageCell)frmMarketWatch.dataGridMarketData.Rows[index].Cells[0]).Image = frmMarketWatch.imgList.Images[0]; } else { ((TextAndImageCell)frmMarketWatch.dataGridMarketData.Rows[index].Cells[0]).Image = frmMarketWatch.imgList.Images[1]; } watch.ask = quote.Ask.ToString(); watch.bid = quote.Bid.ToString(); } } }
private void ChangeQuote(MtQuote quote) { _isUiQuoteUpdateReady = false; var key = quote.ExpertHandle.ToString(); for (int i = 0; i < listViewQuotes.Items.Count; i++) { if (((data)listViewQuotes.Items[i]).expert == key) { //Update_console(((data)listViewQuotes.Items[i]).symbol.ToString()); ((data)listViewQuotes.Items[i]).ask = quote.Ask.ToString(); ((data)listViewQuotes.Items[i]).bid = quote.Bid.ToString(); listViewQuotes.Items.Refresh(); } } _isUiQuoteUpdateReady = true; }
public void On_Terminal1_QuoteUpdate(MtQuote quote) { if (_isUiQuoteUpdateReady) { _isUiQuoteUpdateReady = false; RunOnUiThread(() => { m_txtSymbol1.Text = MT4Ctrl1.currentQuote.Instrument; m_txtBid1.Text = MT4Ctrl1.currentQuote.Bid.ToString(CultureInfo.CurrentCulture); m_txtAsk1.Text = MT4Ctrl1.currentQuote.Ask.ToString(CultureInfo.CurrentCulture); m_txtExpertHandle1.Text = MT4Ctrl1.currentQuote.ExpertHandle.ToString(); MT4CurrentState CurrentQuoteState = new MT4CurrentState(); CurrentQuoteState.Symbol1 = m_txtSymbol1.Text; CurrentQuoteState.Bid1 = m_txtBid1.Text; CurrentQuoteState.Ask1 = m_txtAsk1.Text; CurrentQuoteState.ExpertHandle1 = m_txtExpertHandle1.Text; WSNode.SendDataToUser("TerminalUpdate1", CurrentQuoteState); }); _isUiQuoteUpdateReady = true; } nCurSpread1 = (int)MT4Ctrl1.GetSymbolSpread(quote.Instrument); if (bWorking) { if (CanRebalance()) { TryReBalance(); } //nCurSpread1 = (int)(quote.Ask * 100000) - (int)(quote.Bid * 100000); if (nCurSpread1 == nCurSpread2 && nCurSpread1 < nSpreadOpenThreshold) { DoOpenOrder(); } } if (bCloseOrderWorking) { if (nCurSpread1 == nCurSpread2 && nCurSpread1 < nSpreadCloseThreshold) { DoCloseOrder(); } } }
private void RemoveQuote(MtQuote quote) { if (quote != null && string.IsNullOrEmpty(quote.Instrument) == false && listViewQuotes.Items.ContainsKey(quote.Instrument) == true) { var item = listViewQuotes.Items[quote.Instrument]; int feedCount = 0; int.TryParse(item.SubItems[3].Text, out feedCount); feedCount--; if (feedCount <= 0) { listViewQuotes.Items.RemoveByKey(quote.Instrument); } else { item.SubItems[3].Text = feedCount.ToString(); } } }
private void AddNewQuote(MtQuote quote) { if (quote != null && string.IsNullOrEmpty(quote.Instrument) == false && listViewQuotes.Items.ContainsKey(quote.Instrument) == false) { var item = new ListViewItem(quote.Instrument); item.Name = quote.Instrument; item.SubItems.Add(quote.Bid.ToString()); item.SubItems.Add(quote.Ask.ToString()); item.SubItems.Add("1"); listViewQuotes.Items.Add(item); } else { var item = listViewQuotes.Items[quote.Instrument]; int feedCount = 0; int.TryParse(item.SubItems[3].Text, out feedCount); feedCount++; item.SubItems[3].Text = feedCount.ToString(); } }
public static Mt5Quote Parse(this MtQuote quote) { return((quote != null) ? new Mt5Quote(quote.Instrument, quote.Bid, quote.Ask) : null); }
public Mt4QuoteAdapter(MtQuote quote) { mQuote = quote; }
internal Mt5Quote(MtQuote quote) : this(quote.Instrument, quote.Bid, quote.Ask) { ExpertHandle = quote.ExpertHandle; }
public static Mt5Quote Convert(this MtQuote quote) { return(quote != null ? new Mt5Quote(quote.Instrument, quote.Bid, quote.Ask) : null); }