Skip to content

Commit 8837619

Browse files
authored
Add files via upload
1 parent df35394 commit 8837619

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

MT4socketAPI/Terminal.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,40 @@ public List<Rates> PriceHistory(string Symbol, TimeFrame tf, DateTime From, Date
550550
}
551551
}
552552

553+
public bool TrackPrices(List<Asset> symbols)
554+
{
555+
try
556+
{
557+
JObject json_cmd = new JObject();
558+
559+
json_cmd["MSG"] = "TRACK_PRICES";
560+
561+
JArray ja = new JArray();
562+
563+
symbols = symbols.Where(x => x.TRADE_MODE > 0).ToList(); //Avoid disabled symbols
564+
565+
foreach (Asset symbol in symbols)
566+
ja.Add(symbol.NAME);
567+
568+
json_cmd["SYMBOLS"] = ja;
569+
570+
JObject res = SendCommand(json_cmd);
571+
572+
if (res["ERROR_ID"].ToString() == "0")
573+
{
574+
return true;
575+
}
576+
else
577+
{
578+
throw new Exception("Error with the command sent. ERROR_ID: " + res["ERROR_ID"] + " ERROR_DESCRIPTION: " + res["ERROR_DESCRIPTION"]);
579+
}
580+
}
581+
catch (Exception)
582+
{
583+
throw;
584+
}
585+
}
586+
553587
public bool TrackPrices(List<string> symbols)
554588
{
555589
try

0 commit comments

Comments
 (0)