Topics
Replies
firemyst
28 Dec 2022, 10:59
( Updated at: 21 Dec 2023, 09:23 )
RE:
Spotware said:
Dear firemyst,
The issue you reported does not seem to be related with the problem reported in the initial post. Let us know if you still get the exception in 4.5.3.
Best regards,
cTrader Team
@SPOTWARE!
It's still happening version 4.5.3.11223, and this time while only running a single cBot instance:
Left a bot alone for 5 hours running on Renko charts and bam! I logged back in to my VPS and the error occurs again.
@firemyst
firemyst
27 Dec 2022, 12:02
( Updated at: 27 Dec 2022, 12:35 )
RE:
Spotware said:
Dear firemyst,
You should use v4.5.3. Let us know if you still have issues with the latest version.
Best regards,
cTrader Team
Thank you for the suggestion.
I'll let you know if I have the same issues afterwards.
@firemyst
firemyst
27 Dec 2022, 11:31
( Updated at: 21 Dec 2023, 09:23 )
RE:
Spotware said:
Dear firemyst,
We are aware of the issue and our team is investigating this.
Best regards,
cTrader Team
Any updates on this @Spotware?
Dec 27, using cTrader version 4.4.23 and it's still happening. It's also affecting cBots! When the chart disappears, the cBots don't seem to execute their code. Of course, I can't check why because the "Log" tab won't show.
@firemyst
firemyst
23 Dec 2022, 09:59
RE:
Spotware said:
Dear firemyst,
The issue you reported does not seem to be related with the problem reported in the initial post. Let us know if you still get the exception in 4.5.3.
Best regards,
cTrader Team
Hello @Spotware:
The problem reported in the initial post is:
"I've noticed multiple times that, after some hours running cBots, cTrader crashes unexpectedly."
And that's exactly what I've reported in the 9th post in this thread, -- that cTrader is crashing after some hours of running cBots. I even posted a screen capture of it.
So how is it not related? The only difference is I'm running cBots on a VPS with Renko charts versus the OP's running on a personal computer with Windows 11.
@firemyst
firemyst
23 Dec 2022, 01:56
( Updated at: 21 Dec 2023, 09:23 )
RE:
Spotware said:
Dear trader,
Unfortunately the log and the exception are not enough to determine the root cause of the issue.
Best regards,
cTrader Team
Team @Spotware, this is happening quite a bit! I can't even leave cTrader running cBots overnight with confidence anymore with it crashing after extended periods.
See below. I'm running 2 bot instances on Renko charts:
:
This is probably related to the issue that I reported here:
At least when that was happening, the bots were still able to run! Now everything just crashes.
We can't send any debug information because when cTrader crashes and I click on the "OK" button above, everything disappears. No chance to send any information.
So, if as you say, "Unfortunately the log and the exception are not enough to determine the root cause of the issue." aren't enough info, then @Spotware also needs to update cTrader to capture such information.
This current issue with cTrader crashing on people while running bots seriously needs to be looked into and fixed.
For me to reproduce, I just start a bot on a VPS (2 core, 4GB memory) running at least 2 instances of the same bot. Then I disconnect from the VPS for at least 8 hours and come back to find the error messages.
@firemyst
firemyst
22 Dec 2022, 14:06
> Does this mean that the data will be sent to the developer of the cBot?
Not necessarily. It depends on what the programmer of the bot programmed. If the programmer wrote code to do so, then yes; if the programmer didn't, then no.
> Are there any data going to the third parties or the maker of the cBot?
Again, there could be. It all depends on what the programmer did.
@firemyst
firemyst
09 Dec 2022, 04:04
I found the best way to play sounds is to use the built in system sounds, and then assign your wave file to the system sound through the Control Panel.
Sample code:
if (AlertSoundToPlay == AlertSoundsOptions.Exclamation)
System.Media.SystemSounds.Exclamation.Play();
else if (AlertSoundToPlay == AlertSoundsOptions.Asterisk)
System.Media.SystemSounds.Asterisk.Play();
else if (AlertSoundToPlay == AlertSoundsOptions.Beep)
System.Media.SystemSounds.Beep.Play();
else if (AlertSoundToPlay == AlertSoundsOptions.Hand)
System.Media.SystemSounds.Hand.Play();
else if (AlertSoundToPlay == AlertSoundsOptions.Question)
System.Media.SystemSounds.Question.Play();
else
System.Media.SystemSounds.Exclamation.Play();
@firemyst
firemyst
24 Nov 2022, 06:07
RE:
alexnikon said:
Dear cTrader, how can I switch to use the Visual Studio 2022?
Have you installed VS 2022? If so, you might need to change your Windows settings for default programs. Eg, right click on your Visual Studio Project or solution file and set VS 2022 as the default application instead of VS 2019, 2017, or whatever you have
@firemyst
firemyst
24 Nov 2022, 06:03
RE:
rgasch said:
Hi,
could someone who knows please clarify what the Supertrend UpTrend() and DownTrend() methods actually return and why the sample code compares them to Bars.LowPrices/HighPrices?
Thank you
This is the sample code I'm referencing:
namespace cAlgo.Robots
{
// This sample cBot shows how to use the Supertrend indicator
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class SupertrendSample : Robot
{
private double _volumeInUnits;private Supertrend _supertrend;
[Parameter("Volume (Lots)", DefaultValue = 0.01)]
public double VolumeInLots { get; set; }[Parameter("Stop Loss (Pips)", DefaultValue = 10)]
public double StopLossInPips { get; set; }[Parameter("Take Profit (Pips)", DefaultValue = 10)]
public double TakeProfitInPips { get; set; }[Parameter("Label", DefaultValue = "Sample")]
public string Label { get; set; }public Position[] BotPositions
{
get
{
return Positions.FindAll(Label);
}
}protected override void OnStart()
{
_volumeInUnits = Symbol.QuantityToVolumeInUnits(VolumeInLots);_supertrend = Indicators.Supertrend(10, 3);
}protected override void OnBar()
{
if (_supertrend.UpTrend.Last(1) < Bars.LowPrices.Last(1) && _supertrend.DownTrend.Last(2) > Bars.HighPrices.Last(2))
{
ClosePositions(TradeType.Sell);ExecuteMarketOrder(TradeType.Buy, SymbolName, _volumeInUnits, Label, StopLossInPips, TakeProfitInPips);
}
else if (_supertrend.DownTrend.Last(1) > Bars.HighPrices.Last(1) && _supertrend.UpTrend.Last(2) < Bars.LowPrices.Last(2))
{
ClosePositions(TradeType.Buy);ExecuteMarketOrder(TradeType.Sell, SymbolName, _volumeInUnits, Label, StopLossInPips, TakeProfitInPips);
}
}private void ClosePositions(TradeType tradeType)
{
foreach (var position in BotPositions)
{
if (position.TradeType != tradeType) continue;ClosePosition(position);
}
}
}
}
The UpTrend() and DownTrend() methods return the values when the Supertrend is in an uptrend or downtrend.
There will be a value for one or the other, but not both, because the SuperTrend can't be in both an uptrend and downtrend at the same time.
@firemyst
firemyst
24 Nov 2022, 05:59
RE:
vvictord said:
Still looking for someone with these skills hehe
All you have to do is similar to the following:
//Create your parameter
[Parameter("Max Num of Open Positions", DefaultValue = 3)]
public int MaxNumberOfAllowedOpenTrades { get; set; }
//And in your code, do the check:
if (Positions.Count <= MaxNumberOfAllowedOpenTrades)
{
//do your stuff
}
else
{
Print ("Too many positions already opened.");
}
@firemyst
firemyst
04 Nov 2022, 11:02
RE: RE:
MongolTrader said:
firemyst said:
Why do you need to check it in a while loop? What's your logic or what are you trying to accomplish?
I need to know continuously every tick or bar what was last overbought or oversold point.
What I would consider doing then is:
1) in your OnStart do the while loop and find the last overbought/sold
2) create a class variable and store the index of the last overbought bar index in it
3) for every onbar event, check the stoch. If it's overbough/sold, update the global variation with the new bar number.
When you want bots running fast to respond to the market, so no need to execute a loop every single time a new bar or tick occurs.
@firemyst
firemyst
03 Nov 2022, 01:45
Hi there,
Looks like you've made good progress!
This is correct - well done!
_marketSeries2 = MarketData.GetBars(TimeFrame.Hour, Symbol.Name);
_marketSeries1 = MarketData.GetBars(TimeFrame.Minute15, Symbol.Name);
macd_1 = Indicators.MacdCrossOver(_marketSeries1.ClosePrices, LongPeriod1, ShortPeriod1, SignalPeriod1);
macd_2 = Indicators.MacdCrossOver(_marketSeries2.ClosePrices, LongPeriod2, ShortPeriod2, SignalPeriod2);
If you're unsure that you're getting the values you are expecting, then put Print statements in your code to print out the values and you can compare against having MACD indicators on your charts.
Example Print statement:
Print("MACD1 Value {0}, MACD1 Prev {1}", MACDLine1, PrevMACDLine1);
@firemyst
firemyst
02 Nov 2022, 16:22
RE:
valerijabramov24 said:
I have created my own cBot code and applied multiple instruments but it does not all work all the instruments parallelly. Only it is placing the order in active chart.
It does not work non interactive charts. is that expected ?
I am running multiple bots with multiple bot instances and they all place trades when they should -- not just on an active chart if I have an active chart (because when you run bots you don't necessarily have to have a chart open)
@firemyst
firemyst
01 Nov 2022, 00:59
Your code isn't going to work, because you're not creating the marketseries variables correctly:
_marketSeries2 = MarketData.GetBars(macd2, Symbol.Name);
_marketSeries1 = MarketData.GetBars(macd1, Symbol.Name);
The method is "GetBars", so why are you passing in the macd indicators? The first parameter of the GetBars method is the TIMEFRAME, not an indicator.
You are also not creating/initializing the MACD indicator as I showed you in my example -- the first parameter should be the data series, not the long period.
Please go back and reread my example making sure you understand it.
Spotware also has an example on their website which should help:
https://help.ctrader.com/ctrader-automate/indicator-code-samples/#multiple-timeframes
@firemyst
firemyst
29 Dec 2022, 15:29
RE:
Spotware said:
And yet again...
@firemyst