In the API reference but not in cTrader ?
In the API reference but not in cTrader ?
19 Jun 2019, 12:54
Hello,
I would need to use the watchlists for my project so I checked in the reference and I found this :
https://ctrader.com/api/reference/watchlist
https://ctrader.com/api/reference/watchlists
But when I try to use it, it does not appear...
I need to get all the symbols from the current watchlist how can I do it ?
Thanks,
Best regards
Replies
PanagiotisCharalampous
19 Jun 2019, 14:07
Hi a.fernandez.martinez,
Can you post a code sample showing how you are using Watchlists?
Best Regards,
Panagiotis
@PanagiotisCharalampous
a.fernandez.martinez
19 Jun 2019, 15:03
( Updated at: 21 Dec 2023, 09:21 )
RE:
Panagiotis Charalampous said:
Hi a.fernandez.martinez,
Can you post a code sample showing how you are using Watchlists?
Best Regards,
Panagiotis
I'm only using the watchlists in the trade mode as you can see below :
I'm looking for a way to get a list or an array of the symbols in a Watchlist, for example the USD MAJOR PAIRS like you can see in the picture.
For the USD MAJOR PAIRS watchlist, the string array could be something like :
USDMAJORPAIRS[0] = "GBPUSD";
USDMAJORPAIRS[1] = "USDJPY";
USDMAJORPAIRS[2] = "USDCAD";
USDMAJORPAIRS[3] = "USDCHF";
USDMAJORPAIRS[4] = "AUDUSD";
USDMAJORPAIRS[5] = "NZDUSD";
USDMAJORPAIRS[6] = "EURUSD";
But when I type watchlist in the Automate API reference nothing appears (top right corner) :
If I type watchlist in the code cTrader doesn't suggest anything, I tried to type Collections.Watchlist, Chart.Watchlist, Internals.Watchlist, and a lot more but there is no way to find them.
Is there a way to access watchlists from a cbot ?
I will also need to use Watchlists related events, like symbol added or watchlist renamed.
Thanks,
Best regards,
@a.fernandez.martinez
PanagiotisCharalampous
19 Jun 2019, 15:08
Hi a.fernandez.martinez,
Here is an example
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewcBot : Robot { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } protected override void OnStart() { foreach (var watchlist in Watchlists) { foreach (var symbol in Symbols) Print(watchlist.Name + " - " + symbol); } } protected override void OnTick() { // Put your core logic here } protected override void OnStop() { // Put your deinitialization logic here } } }
Best Regards,
Panagiotis
@PanagiotisCharalampous
a.fernandez.martinez
19 Jun 2019, 15:12
( Updated at: 21 Dec 2023, 09:21 )
RE:
Panagiotis Charalampous said:
Hi a.fernandez.martinez,
Here is an example
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewcBot : Robot { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } protected override void OnStart() { foreach (var watchlist in Watchlists) { foreach (var symbol in Symbols) Print(watchlist.Name + " - " + symbol); } } protected override void OnTick() { // Put your core logic here } protected override void OnStop() { // Put your deinitialization logic here } } }Best Regards,
Panagiotis
It doesn't work for me :( :
It's like Watchlists doesn't exist...
@a.fernandez.martinez
PanagiotisCharalampous
19 Jun 2019, 15:16
Hi a.fernandez.martinez,
Probably you are using v3.3 Note that this is available only in v3.5.
Best Regards,
Panagiotis
@PanagiotisCharalampous
a.fernandez.martinez
19 Jun 2019, 15:17
Hahah I thought of that too, is there a way to know which version we have ? how to update without uninstalling and reintalling everything ?
@a.fernandez.martinez
a.fernandez.martinez
19 Jun 2019, 15:21
Is it dependent on me or on my broker ?
@a.fernandez.martinez
PanagiotisCharalampous
19 Jun 2019, 15:30
You can see the version on the header of cTrader. It depends on your broker, there is nothing you can do.
@PanagiotisCharalampous
... Deleted by UFO ...