Watchlist
Summary
Represents the Watchlist interface.
Signature
| public abstract interface Watchlist
|
Namespace
cAlgo.API
Examples
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 | using cAlgo.API;
using System.Linq;
namespace cAlgo
{
// This sample shows how to use Automate API to monitor user platform Watchlists
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class WatchlistSample : Indicator
{
protected override void Initialize()
{
Watchlists.Added += Watchlists_Added;
Watchlists.Removed += Watchlists_Removed;
Watchlists.WatchlistRenamed += Watchlists_WatchlistRenamed;
Watchlists.WatchlistSymbolAdded += Watchlists_WatchlistSymbolAdded;
Watchlists.WatchlistSymbolRemoved += Watchlists_WatchlistSymbolRemoved;
Print("Number of Watchlists: ", Watchlists.Count());
foreach (var watchlist in Watchlists)
{
Print("Watchlist Name: {0} | Symbols #: {1}", watchlist.Name, watchlist.SymbolNames.Count);
}
}
private void Watchlists_WatchlistSymbolRemoved(WatchlistSymbolRemovedEventArgs obj)
{
Print("Symbol {0} Removed From Watchlist {1}", obj.SymbolName, obj.Watchlist.Name);
}
private void Watchlists_WatchlistSymbolAdded(WatchlistSymbolAddedEventArgs obj)
{
Print("Symbol {0} Added to Watchlist {1}", obj.SymbolName, obj.Watchlist.Name);
}
private void Watchlists_WatchlistRenamed(WatchlistRenamedEventArgs obj)
{
Print("Renamed Watchlist {0}", obj.Watchlist.Name);
}
private void Watchlists_Removed(WatchlistRemovedEventArgs obj)
{
Print("Removed Watchlist {0}", obj.Watchlist.Name);
}
private void Watchlists_Added(WatchlistAddedEventArgs obj)
{
Print("Added Watchlist {0}", obj.Watchlist.Name);
}
public override void Calculate(int index)
{
}
}
}
|
Properties
Name
Summary
Gets the watchlist name.
Signature
| public abstract string Name {get;}
|
Return Value
string
SymbolNames
Summary
Gets the names of the symbols in the watchlist.
Signature
| public abstract IReadonlyList<string> SymbolNames {get;}
|
Return Value
IReadonlyList