Topics
Replies
firemyst
03 May 2023, 06:15
> So sorry gus yes it worked with FullAccess using the launch debugger but it does not work with trying to attach, that is the normal way I try and do it with my bots.
> It says symbols have not been loaded. Looks like you have to specify the location of the symbols but I have never had to do that before.
Because everything now runs under its own process, you could have literally hundreds of calgo processes running, and wouldn't know which one to attach to.
The new way of debugging automatically handles that for you. When prompted, select the VS instance you're currently working in (as per the instructions on the web page) making sure you're running it in "debug" mode, and you'll be able to step through the code as per usual.
@firemyst
firemyst
03 May 2023, 05:08
RE: RE:
acrigney said:
Thanks mate, the debugger is not launched but the code says it was.
Also when I try and attach it says that no symbols have been loaded for the current document.
As I said I have been doing this for years but ever since the upgrade to support .net 6 it has never worked.
Here is some sample code.
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.Robots
{
[Robot(AccessRights = AccessRights.None)]
public class DummyBot6 : Robot
{
[Parameter(DefaultValue = "Hello world!")]
public string Message { get; set; }[Parameter(DefaultValue = "Hello world!")]
public string Message2 { get; set; }protected override void OnStart()
{
var result = System.Diagnostics.Debugger.Launch();if (result is false)
{
Print("Debugger launch failed");
}
else if (result is true)
{
Print("Debugger launched");
}// To learn more about cTrader Automate visit our Help Center:
// https://help.ctrader.com/ctrader-automatePrint(Message);
Print("onstart");
}protected override void OnTick()
{
// Handle price updates here
}
protected override void OnBar()
{
double x = 0, y = 0, z = 0,p =0;
Print("AddClose");
for (int j = 0; j < 3; j++)
{
x = (float)Bars.ClosePrices.Last(j + 1);
y = (float)Bars.OpenPrices.Last(j + 1);
z = (float)Bars.HighPrices.Last(j + 1);
p = (float)Bars.LowPrices.Last(j + 1);
}
Print(String.Format("lengths {0} {1} {2} {3}", x, y, z, p));
}
protected override void OnStop()
{
// Handle cBot stop here
}
}
}PanagiotisChar said:
Hi there,
There are clear instructions here
Which step does not work for you?
Need help? Join us on Telegram
Need premium support? Trade with us
You need to follow the instructions. Your code clearly shows you haven't:
@firemyst
firemyst
02 May 2023, 04:12
I like a lot of your suggestions. However, given the limited screen size of phones, I suppose to what end are the majority of traders using mobile vs a laptop/desktop for their primary trading operations?
For instance, I'm curious why you think it's "high priority" to manage cbots through the mobile app itself? Since cBots run on the specific computer they are installed on, your mobile device would have to connect back to that computer (through cTrader) and be able to take control of the cbot on that computer. And there would be a lag doing so. Basically, it would be just as efficient right now to install Microsoft's "remote desktop" application on your mobile device, "remote desktop" back to your computer with the cBot installed, and control it remotely that way. That's what I do anyway -- to connect to my VPS where I have cBots running.
@firemyst
firemyst
28 Apr 2023, 17:26
RE: RE:
acrigney said:
Yes mate my boss have FullAccess but still no luck with any of the recent versions including the latest my broker TopDx has which is 4.6.6
Can you post a video showing creating and debugging a bot please?
Ever try doing a Google or YouTube search?
@firemyst
firemyst
28 Apr 2023, 15:35
RE:
ctid6027093 said:
Implement Renko wicks or if possible the full Renko range. I know there is an indicator that draw the wicks, but its using a lot of recources.
Having a full Renko implementation would give the platform a leap forward.
Regards
Would have been nice if you looked through the suggestions first instead of creating another thread to divide up the votes:
Vote in the above thread as well.
@firemyst
firemyst
27 Apr 2023, 16:10
RE:
jane.ttabloomquist said:
Hi,
Many of the developers are waiting for encryption possibilities of code in cAlgo. This will open a broad marketplace for developers to monitize on their hard work. It will also bring new coders interesting in the platform. My question is, is this in progress? If so, when do you think it might be available.?
cAlgo files are supposedly already encrypted - I doubt we'd get different types of "encryption" options though.
If you mean you want the code obfuscated, you can do that outside of cTrader before compiling.
@firemyst
firemyst
27 Apr 2023, 04:56
One thing to try that's happened to me in the past, is:
- put some indicators on the chart (a moving average, bollinger bands, etc) Just use the default settings
- try putting a horizontal and/or vertical line drawing on your chart as well
- scroll your chart. Change timeframe and scroll the chart again.
if you scroll your chart and the indicators / lines do not move, then it's a bug with the Intel GPU drivers. This is known and has happened to me in the past. Update the Intel GPU drivers, restart cTrader, and hopefully it'll go away (as it did for me).
The other time something similar happened to me is when Windows automatically updated my computer in the background, and it was waiting for a pending restart. Once I restarted, it worked fine. So maybe check that as well.
If neither of these suit you, hopefully @Spotware can lend some insight. Great that you posted the video.
@firemyst
firemyst
27 Apr 2023, 04:49
Sample code snippets to get the size of the previous candle:
private Bars bars;
// In your OnStart or Initialize method depending on whether cBot or indicator
bars = MarketData.GetBars(Chart.TimeFrame);
//In the Calculate, OnTick, or OnBar method depending on whether indicator or cBot and when you want to know the difference
//If you want the body size
double differenceInPips = Math.Abs(bars.OpenPrices.Last(1) - bars.ClosePrices.Last(1)) / Symbol.PipSize;
//If you want the entire candle. No Math.Abs function needed
double differenceInPips = (bars.HighPrices.Last(1) - bars.LowPrices.Last(1)) / Symbol.PipSize;
Check out code samples to see how to place the order you want:
https://help.ctrader.com/ctrader-automate/cbot-code-samples/
@firemyst
firemyst
26 Apr 2023, 03:41
( Updated at: 21 Dec 2023, 09:23 )
I'm not sure why you think this is an issue?
If you look on topfx website, they don't have USDHKD listed as a currency pair they allow users to trade, so that error is expected:
If you want to trade USDHKD, it looks like you'll have to change brokers, or ask them if they can enable it for you.
Good luck.
@firemyst
firemyst
25 Apr 2023, 15:16
You may need to check if the SL or TP value is null along with changing the order of comparisons in the "if" statements.
if (distance >= BETrigger * Symbol.PipSize)
{
if (position.TradeType == TradeType.Buy)
{
//you need to check if StopLoss is null first because if it is null, the position.Stoploss <= ...
//will fail because it can't compare a null against an actual value
if (position.StopLoss == null || position.StopLoss <= position.EntryPrice + (Symbol.PipSize * BEExtraPips))
{
//I personally would also change this call to the following
//so you're covered with the TakeProfit as well
ModifyPosition(position, position.EntryPrice + (Symbol.PipSize * BEExtraPips), (position.TakeProfit == null ? null : position.TakeProfit.GetValueOrDefault()));
}
}
else
{
if (position.StopLoss == null || position.StopLoss >= position.EntryPrice - (Symbol.PipSize * BEExtraPips))
{
ModifyPosition(position, entryPrice - (Symbol.PipSize * BEExtraPips), (position.TakeProfit == null ? null : position.TakeProfit.GetValueOrDefault()));
}
}
}
}
}
}
}
@firemyst
firemyst
25 Apr 2023, 09:28
Why should they keep running?
cTrader is the 'host' running your bots.
If you shut down Microsoft Windows, does cTrader keep running?
If you shut down Microsoft Windows, do any of your open Windows applications (Microsoft Word, Google Chrome, etc) keep running?
No. Because Windows is the 'host' that's running them.
@firemyst
firemyst
03 May 2023, 09:12
RE: RE:
acrigney said:
I'm not sure what you mean by "ML" ones?
I write bots and a few custom indicators that do my trading for me. "Hybrid ones" where I have a basic strategy programmed up with position management, but watch the trades for divergences (and other signs) to manage them myself.
I used to focus on trading the daily time frame, but now stick more to Renko charts (with my own Renko Wicks indicator) to avoid all the noise distracting me or stimulating my emotions.
:-)
@firemyst