Topics
Forum Topics not found
Replies
amusleh
27 May 2022, 10:20
Hi,
I tested implicit usings and XML comments, they work if you select the SDK compiler,
So if you change the compiler from embedded to SDK both of those issues will be resolved, and regarding building with source code, you can build with source code with SDK compiler from cTrader itself if you change the compiler to SDK.
And I'm not aware of any parameter that allows building with source code via dotnet CLI.
In my previous message I guided you on how to change the compiler because by changing the compiler both of your issues will be resolved.
@amusleh
amusleh
27 May 2022, 10:14
Hi,
The custom tick chart indicator is not an alternative for custom charts, it's a solution based on current platform available features.
We will consider adding custom period charts in future releases based on users interest and votes.
Can you try the indicator new version we just released? I tested it and it's working fine.
@amusleh
amusleh
27 May 2022, 09:36
Hi,
I just tested and it works fine, indicator and cBot output results are matching.
Test below cBot on visual back test mode.
Test this please:
using cAlgo.API;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class springg : Robot
{
private Spring i_fractal;
protected override void OnStart()
{
i_fractal = Indicators.GetIndicator<Spring>();
}
protected override void OnBar()
{
var index = Bars.Count - 2;
if (i_fractal.UpFractal[index] > 0)
{
Chart.DrawVerticalLine(index.ToString(), index, Color.Red);
}
if (i_fractal.DownFractal[index] > 0)
{
Chart.DrawVerticalLine(index.ToString(), index, Color.Blue);
}
}
}
}
Indicator:
using cAlgo.API;
namespace cAlgo
{
[Indicator(IsOverlay = true, AccessRights = AccessRights.None, TimeZone = TimeZones.EAfricaStandardTime)]
public class Spring : Indicator
{
[Output("Up Fractal", Color = Colors.Red, PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries UpFractal { get; set; }
[Output("Down Fractal", Color = Colors.Blue, PlotType = PlotType.Points, Thickness = 5)]
public IndicatorDataSeries DownFractal { get; set; }
private Bars HSeries;
protected override void Initialize()
{
HSeries = MarketData.GetBars(TimeFrame.Hour4);
}
public override void Calculate(int index)
{
if (index == 1)
return;
DrawUpFractal(index);
DrawDownFractal(index);
}
private void DrawUpFractal(int index)
{
var hSeriesIndex = HSeries.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]) - 1;
int middleIndex = hSeriesIndex - 2;
double middleValue = HSeries.ClosePrices[middleIndex];
bool up = false;
for (int i = 1; i < HSeries.ClosePrices.Count - 1; i++)
{
if (HSeries.ClosePrices[middleIndex] > HSeries.ClosePrices[middleIndex - 1] && HSeries.ClosePrices[middleIndex] > HSeries.ClosePrices[middleIndex + 1])
{
up = true;
break;
}
}
if (up)
{
UpFractal[index] = middleValue;
}
else
{
UpFractal[index] = double.NaN;
}
}
private void DrawDownFractal(int index)
{
var hSeriesIndex = HSeries.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]) - 1;
int middleIndex = hSeriesIndex - 2;
double middleValue = HSeries.ClosePrices[middleIndex];
bool down = false;
for (int i = 1; i < HSeries.ClosePrices.Count - 1; i++)
{
if (HSeries.ClosePrices[middleIndex] < HSeries.ClosePrices[middleIndex - 1] && HSeries.ClosePrices[middleIndex] < HSeries.ClosePrices[middleIndex + 1])
{
down = true;
break;
}
}
if (down)
{
DownFractal[index] = middleValue;
}
else
{
DownFractal[index] = double.NaN;
}
}
}
}
@amusleh
amusleh
27 May 2022, 09:07
RE: RE:
Jiri said:
amusleh said:
Hi,
We discussed this and we are considering to change this behavior, but we can't make any promise.
Any estimation on when will you know the final verdict? Is it considered in the upcoming version, if so what is the ETA?
hi,
We are considering to change this behavior back, I can't give you any ETA for now.
@amusleh
amusleh
26 May 2022, 12:52
Hi,
For now the only way it to move your mouse cursor over that point of the line and it will show the values on a popup dialog box.
If you want to see the values on the top corner then it's not possible now, you can open a thread under suggestions section for it.
@amusleh
amusleh
26 May 2022, 12:50
Hi,
We fixed the issue, please update your Custom Tick chart indicators:
Custom Tick Chart (Non-overlay) Indicator | Algorithmic Forex Trading | cTrader Community
Custom Tick Chart (Overlay) Indicator | Algorithmic Forex Trading | cTrader Community
@amusleh
amusleh
26 May 2022, 11:03
RE:
swapd0 said:
OS-X, I've coded my own (small) FIX library.
I've seen what it's happening. Sometimes the messages that I send look like they don't reach the server, I send the login or the security list message and I don't get a message back, with that messages I can resend it without any problem until I get a response.
I've done a test, if I subscribe to a symbol but I don't get the quotes in about 5 seconds, I send the subscribe message again. After some seconds I get quotes from all symbols, but also I can get a lot of "SYMBOL ALREADY SUBSCRIBED" messages.
The problem is that for any message that I send, I don't get any confirmation message, and looks like some messages are lost or the server discards them without any error message.
Hi,
Most probably something is wrong with your own app, either message checksums are not valid or something else is not correct with the messages you sent.
If you send a message with invalid checksum server will not return back anything.
Can you please try on our sample QuickFIXN .NET sample: spotware/quickfixnsamples.net: .NET Samples for QuickFIXn library and Spotware FIX API (github.com)
Use the console sample and send multiple subscription requests, to do that change the SendMarketDataRequest method on console sample program.cs to:
private static void SendMarketDataRequest(string[] fields, bool subscribe)
{
foreach (var symbolId in Enumerable.Range(0, 10))
{
MDReqID mdReqID = new("MARKETDATAID");
SubscriptionRequestType subType = new(subscribe ? '1' : '2');
MarketDepth marketDepth = new(fields[1].ToLowerInvariant().Equals("y", StringComparison.OrdinalIgnoreCase) ? 0 : 1);
QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup bidMarketDataEntryGroup = new() { MDEntryType = new MDEntryType('0') };
QuickFix.FIX44.MarketDataRequest.NoMDEntryTypesGroup offerMarketDataEntryGroup = new() { MDEntryType = new MDEntryType('1') };
//QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symbolGroup = new() { Symbol = new Symbol(fields[0]), };
QuickFix.FIX44.MarketDataRequest.NoRelatedSymGroup symbolGroup = new() { Symbol = new Symbol(symbolId.ToString()), };
QuickFix.FIX44.MarketDataRequest message = new(mdReqID, subType, marketDepth);
message.AddGroup(bidMarketDataEntryGroup);
message.AddGroup(offerMarketDataEntryGroup);
message.AddGroup(symbolGroup);
_application.SendMessage(message);
}
}
If it worked then you will know something is wrong on your own app.
@amusleh
amusleh
26 May 2022, 10:01
Hi,
Yes, you can do it, you have to use the history for getting historical trades to calculate drawdown.
You also need an initial value which can be your account initial balance/equity when cBot started, you can store it on a field variable.
Here is drawdown calculation formula: Maximum Drawdown (MDD) Definition (investopedia.com)
If you want to calculate equity drawdown then you have to use Positions net profit.
@amusleh
amusleh
26 May 2022, 09:31
RE: RE:
icollocollo said:
amusleh said:
Hi,
Fractal can lag x number of bars based on your provided period number, so try to use earlier bar index when accessing data.
I can only guide you and help you regarding specific API related questions, I can't help you to fully develop your cBot or indicator.
If a value on a data series in NAN it means you haven't set the value for that index, and you have to check your code and find what's causing it.
Thank you for all your input. I have gone through data series API and have tried this before. It just that when it comes to this particular situation i don't get the value.
Also note i used a method that does not put period to use. I wanted to be sure when backtesting. A while ago i noticed when you test a cbot using periods it will give different results when you adjust the time of backtesting.
Just need this small input for last 1 and last 0. Stuck here for months. This index issue.
Hi,
I can't see your cBot code, can you post it again, I will try once more.
@amusleh
amusleh
26 May 2022, 09:29
( Updated at: 21 Dec 2023, 09:22 )
RE: RE:
couscousmckoy said:
Hi amusleh
Thanks for the prompt response. The entire data set was 434 records long for my test so I removed all the valid BarOpened event logs (even those where there was subsequently a later refire of the same bar). I've still removed the records that were correct with no subsequent erroneous refire, but here are those records with the original correct event logged plus the subsequent erroneous entry. Look at the log entry times for each pair.
Thanks
Hi,
Can you tell me on which version of cTrader you tested this? and was it back test data or live data?
@amusleh
amusleh
27 May 2022, 10:49
RE:
Jiri said:
Hi,
I was able to reproduce the issue, it happens only if you put the comment tag inside another child tag like PropertyGroup or ItemGroup, but if you put it outside a child tag it works fine.
We will investigate this issue, thanks for reporting.
@amusleh