See your orders on the graph
Created at 20 Feb 2016, 11:03
See your orders on the graph
20 Feb 2016, 11:03
I developed this snippet of code to have always under my eyes the last orders, since midnight OR AFTER, buy you can easily adapt the code to your exigences
I hope it may be usefull...
private DateTime sincePips = new DateTime(2016, 2, 19, 13, 0, 0); private Colors colorBuy = Colors.Lime; private Colors colorSell = Colors.Red; private Colors colorNone = Colors.Yellow; protected override void OnStart() { double totPips = 0.0; string history = string.Empty; DateTime sinceTime = (DateTime.Now.Date > sincePips ? DateTime.Now : sincePips); Colors colorPips = Colors.Black; for (int i = History.Count - 1; i >= 0; i--) { if (History[i].ClosingTime < sinceTime) { break; } totPips += History[i].Pips; history += History[i].SymbolCode + " " + History[i].Pips + " " + History[i].ClosingTime + "\r\n"; if (totPips > 0) { colorPips = colorBuy; } else if (totPips < 0) { colorPips = colorSell; } else { colorPips = colorNone; } } history = (totPips > 0 ? "Tot pips GAIN " : "Take pips LOSS ") + totPips.ToString("N1") + "\r\n-----\r\n" + history; ChartObjects.DrawText("Pips", history, StaticPosition.TopRight, colorPips); }
gainer
20 Feb 2016, 11:11
...ops... excuse me, an error, because I extracted the snippet from one of my cBots
the setting of colors must be outside of the loop
suggestions:
@gainer