Topics
Replies
Waxy
01 Nov 2022, 21:04
RE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo
{
[Indicator(AccessRights = AccessRights.None)]
public class NewIndicator : Indicator
{
private ChartVerticalLine _verticalLine;
/*
-- I was wondering if it were possible for me to get the Bars info (eg. OpenPrices, ClosePrices, etc.) from a ChartObject's (such as a vertical line) Time index?
-- Any help is appreciated, thanks.
*/
protected override void Initialize()
{
_verticalLine = Chart.DrawVerticalLine("VerticalLine", Bars.OpenTimes.LastValue, Color.Red);
var index = Bars.OpenTimes.GetIndexByTime(_verticalLine.Time);
var bar = Bars[index];
Print("Open: {0}, High: {1}, Low: {2}, Close: {3}", bar.Open, bar.High, bar.Low, bar.Close);
}
public override void Calculate(int index)
{
// Calculate value at specified index
// Result[index] =
}
}
}
@Waxy
Waxy
13 Oct 2022, 13:05
RE: RE:
I'm having some reference issues with WebView and Window
- Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'Window' could not be found (are you missing a using directive or an assembly reference?) WindowSample C:\Users\USUARIO\Documents\cAlgo\Sources\Indicators\WindowSample\WindowSample\WindowSample.cs 23 Active
- Severity Code Description Project File Line Suppression State
Error CS0103 The name 'WindowStartupLocation' does not exist in the current context WindowSample C:\Users\USUARIO\Documents\cAlgo\Sources\Indicators\WindowSample\WindowSample\WindowSample.cs 73 Active
- Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'WebView' could not be found (are you missing a using directive or an assembly reference?) WebViewOnWindow C:\Users\USUARIO\Documents\cAlgo\Sources\Indicators\WebViewOnWindow\WebViewOnWindow\WebViewOnWindow.cs 8 Active
- Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'WebViewLoadedEventArgs' could not be found (are you missing a using directive or an assembly reference?) WebViewOnWindow C:\Users\USUARIO\Documents\cAlgo\Sources\Indicators\WebViewOnWindow\WebViewOnWindow\WebViewOnWindow.cs 41 Active
I'm using latest version of Spotware cTrader, these references should not be missing.
Also, when I build with "Embedded" compiler, these errors are not shown, but it doesn't let me add any instance.
@Waxy
Waxy
12 Oct 2022, 08:14
Assign a label to the positions, it should be an unique label per instance, so there's no risk of conflict.
Example
private string _label;
protected override void OnStart()
{
_label = "BotName" + Server.Time.Ticks;
}
//Then everytime you trade use this label, i.e. and check for positions with that label
protected override void OnBar()
{
if (Positions.Count(x => x.Label == _label) < 5)
ExecuteMarketOrder(TradeType.Buy, SymbolName, 10000, _label, InputStopLoss, InputTakeProfit);
}
@Waxy
Waxy
10 Oct 2022, 22:57
RE: RE: RE:
Hello Spotware,
Here are my steps to reproduce this issue, I find little info about this on internet, and never happened to me before, would appreciate your help.
10.10.2022-14.51.58 (screencast.com)
Regards,
@Waxy
Waxy
01 Jun 2021, 06:23
( Updated at: 21 Dec 2023, 09:22 )
RE:
PanagiotisCharalampous said:
Hi Waxy,
Can you please provide us with the following?
- Application scale
- Windows scale
- Display resolution
Also please send us troubleshooting information. Paste the link to this discussion in the text box.
Best Regards,
Panagiotis
It seems it only happens when using "Change the size of text, apps and other items" to 150%
@Waxy
Waxy
11 Aug 2020, 02:55
RE: RE:
GridSurfer said:
Hi Waxy,
you just need to repeat the LoadMoreHistory() until you have enough history data.
API.Ticks symbolTicks; DateTime firstDt = new DateTime(2020, 8, 1); symbolTicks = MarketData.GetTicks(); while (symbolTicks[0].Time.CompareTo(firstDt) > 0) { symbolTicks.LoadMoreHistory(); }
Maybe Panagiotis will post the snipplet in the API-Reference. I was looking for it before as well.
Cheers
GridSurfer
Thank you,
This works!
@Waxy
Waxy
05 Dec 2019, 18:19
RE:
What I mean is that it takes me 10-15 seconds to load these symbols, not almost instantly, I'm using 30mbps.
Only after the first load, any refresh of the bot/indicator and the bars load instantly afterward (which again, it's great news).
Also, I think a good option would be to have an overload where we can specify how many bars to load, because many times a thousand daily bars is not really needed, is it possible?
And I'm since this is part of the update I thought it would be correct to ask about it in this thread, I'll leave it here and if needed I'll open a new thread, sorry about that.
Thanks for your support
@Waxy
Waxy
05 Dec 2019, 16:39
RE: RE: RE:
Hello Panagiotis,
I'm trying out the following code,
using System.Collections.Generic;
using cAlgo.API;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class NewIndicator : Indicator
{
private readonly List<Bars> _bars = new List<Bars>();
private readonly string[] _mySymbols = {"EURUSD","GBPUSD","EURJPY","USDJPY","AUDUSD","USDCHF","GBPJPY","USDCAD","EURGBP","EURCHF"};
protected override void Initialize()
{
Print("Initializing");
foreach (var symbol in _mySymbols)
{
Print(string.Format("Loading Symbol {0}", symbol));
MarketData.GetBarsAsync(TimeFrame.Hour, symbol, bar =>
{
_bars.Add(bar);
Print(string.Format("{0} Loaded, Bars: {1}", bar.SymbolName, bar.Count));
});
}
Print("End Initializing");
}
public override void Calculate(int index) { }
}
}
I get the responses in the log in this order, doesn't seem to work properly to me, is this correct, or I'm I doing something wrong, is this the best way to do it? It takes about 16 seconds to load them all (don't get me wrong it's a big improvement), could it load faster?
05/12/2019 14:20:04.782 | Initializing
05/12/2019 14:20:04.782 | Loading Symbol EURUSD
05/12/2019 14:20:04.797 | Loading Symbol GBPUSD
05/12/2019 14:20:04.797 | Loading Symbol EURJPY
05/12/2019 14:20:05.219 | Loading Symbol USDJPY
05/12/2019 14:20:05.235 | Loading Symbol AUDUSD
05/12/2019 14:20:05.657 | Loading Symbol USDCHF
05/12/2019 14:20:06.641 | Loading Symbol GBPJPY
05/12/2019 14:20:07.078 | Loading Symbol USDCAD
05/12/2019 14:20:07.110 | Loading Symbol EURGBP
05/12/2019 14:20:07.485 | Loading Symbol EURCHF
05/12/2019 14:20:07.953 | Loading Symbol AUDJPY
05/12/2019 14:20:08.344 | Loading Symbol NZDUSD
05/12/2019 14:20:08.391 | Loading Symbol CHFJPY
05/12/2019 14:20:08.813 | Loading Symbol EURAUD
05/12/2019 14:20:09.344 | Loading Symbol CADJPY
05/12/2019 14:20:09.782 | Loading Symbol GBPAUD
05/12/2019 14:20:10.250 | Loading Symbol EURCAD
05/12/2019 14:20:10.657 | Loading Symbol AUDCAD
05/12/2019 14:20:11.203 | Loading Symbol GBPCAD
05/12/2019 14:20:11.813 | Loading Symbol USDNOK
05/12/2019 14:20:13.063 | Loading Symbol AUDCHF
05/12/2019 14:20:13.672 | Loading Symbol USDMXN
05/12/2019 14:20:15.094 | Loading Symbol GBPNZD
05/12/2019 14:20:15.110 | Loading Symbol CADCHF
05/12/2019 14:20:15.719 | Loading Symbol USDSEK
05/12/2019 14:20:16.969 | Loading Symbol GBPCHF
05/12/2019 14:20:17.578 | Loading Symbol EURRUB
05/12/2019 14:20:19.453 | Loading Symbol NZDCHF
05/12/2019 14:20:20.078 | Loading Symbol NZDCAD
05/12/2019 14:20:20.703 | Loading Symbol AUDNZD
05/12/2019 14:20:20.735 | End Initializing
05/12/2019 14:20:20.735 | EURUSD Loaded, Bars: 2323
05/12/2019 14:20:20.735 | GBPUSD Loaded, Bars: 2013
05/12/2019 14:20:20.735 | EURJPY Loaded, Bars: 2013
05/12/2019 14:20:20.735 | USDJPY Loaded, Bars: 1650
05/12/2019 14:20:20.750 | AUDUSD Loaded, Bars: 2013
05/12/2019 14:20:20.750 | USDCHF Loaded, Bars: 2013
05/12/2019 14:20:20.750 | GBPJPY Loaded, Bars: 2013
05/12/2019 14:20:20.750 | USDCAD Loaded, Bars: 2013
05/12/2019 14:20:20.750 | EURGBP Loaded, Bars: 2013
05/12/2019 14:20:20.750 | EURCHF Loaded, Bars: 2013
05/12/2019 14:20:20.750 | AUDJPY Loaded, Bars: 2013
05/12/2019 14:20:20.750 | NZDUSD Loaded, Bars: 2013
05/12/2019 14:20:20.750 | CHFJPY Loaded, Bars: 2013
05/12/2019 14:20:20.750 | EURAUD Loaded, Bars: 2013
05/12/2019 14:20:20.750 | CADJPY Loaded, Bars: 2013
05/12/2019 14:20:20.750 | GBPAUD Loaded, Bars: 2013
05/12/2019 14:20:20.750 | EURCAD Loaded, Bars: 2013
05/12/2019 14:20:20.750 | AUDCAD Loaded, Bars: 2013
05/12/2019 14:20:20.750 | GBPCAD Loaded, Bars: 2013
05/12/2019 14:20:20.750 | USDNOK Loaded, Bars: 1170
05/12/2019 14:20:20.750 | AUDCHF Loaded, Bars: 2013
05/12/2019 14:20:20.750 | USDMXN Loaded, Bars: 1170
05/12/2019 14:20:20.750 | GBPNZD Loaded, Bars: 2013
05/12/2019 14:20:20.750 | CADCHF Loaded, Bars: 2013
05/12/2019 14:20:20.750 | USDSEK Loaded, Bars: 1170
05/12/2019 14:20:20.750 | GBPCHF Loaded, Bars: 2013
05/12/2019 14:20:20.750 | EURRUB Loaded, Bars: 1167
05/12/2019 14:20:20.750 | NZDCHF Loaded, Bars: 2013
05/12/2019 14:20:20.985 | NZDCAD Loaded, Bars: 2012
05/12/2019 14:20:21.203 | AUDNZD Loaded, Bars: 2013
PanagiotisCharalampous said:
Waxy said:
Hello Spotware,
These are indeed great additions,
I see now that when I load an indicator that uses multiple MarketSeries (or now Bars) it takes much less than before, and this is great news, but at the start, it takes the same as before, so, I'd like to know if it's possible to improve or what's the best way now to load multiple series loading for indicators/bots during initialization, let's say I want to load 10 symbol bars, can I load these in parallel now?
Hi Xavier,
You can use MarketData.GetBarsAsync() and MarketData.GetTicksAsync() to get data asynchronously.
Best Regards,
Panagiotis
@Waxy
Waxy
05 Dec 2019, 05:05
RE:
Hello Spotware,
These are indeed great additions,
I see now that when I load an indicator that uses multiple MarketSeries (or now Bars) it takes much less than before, and this is great news, but at the start, it takes the same as before, so, I'd like to know if it's possible to improve or what's the best way now to load multiple series loading for indicators/bots during initialization, let's say I want to load 10 symbol bars, can I load these in parallel now?
@Waxy
Waxy
04 Nov 2022, 08:42
RE: RE: RE:
That's different, not sure but something like:
@Waxy