Topics
Forum Topics not found
Replies
amusleh
15 Oct 2021, 08:27
RE: Option to Change Grid Lines Color
RayAdam said:
Hi Support, Is there a possibility to change the GridLines color/format ? var grid = new Grid(3, 2) { BackgroundColor = Color.LightGray, ShowGridLines = true };
Thanks
There is no way for changing grid lines color, If you need it then you can open a thread for it on suggestions section.
@amusleh
amusleh
13 Oct 2021, 14:30
Hi,
The decimal places of your stop price must much with symbol digits.
You can get the symbol digits from ProtoOASymbol.
@amusleh
amusleh
13 Oct 2021, 08:12
( Updated at: 13 Oct 2021, 08:45 )
RE:
Hi,
Once cTrader 4.2 released you will be bale to use Windows Task manager to check each custom indicator or cBot resource usage while its running.
There is no way to get server host name via Automate API, you can create a suggestion for it.
You can use FIX host name and ping it to check the latency.
@amusleh
amusleh
12 Oct 2021, 07:21
Hi,
No, there is no way to get the resource usage statistics of your cBot/indicator.
You can check indicators/cBots resource usage in cTrader 4.2 from Task manager, which will run each indicator/cBot on its own sandbox process.
Please wait for cTrader 4.2 release.
@amusleh
amusleh
09 Oct 2021, 08:41
RE: ctrader crashed
Hi,
Something is wrong with alert XML configuration files, it located at cAlgo folder.
There is an Alerts folder inside cAlgo folder, delete it and retry.
Also please copy and post the full log of exception so I will be able to find the exact issue.
@amusleh
amusleh
08 Oct 2021, 07:14
Hi,
Try this sample cBot:
using System;
using System.Linq;
using cAlgo.API;
using System.Globalization;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class NewcBot : Robot
{
private TimeSpan _closeTime;
[Parameter("Close Time", DefaultValue = "17:00:00")]
public string CloseTime { get; set; }
[Parameter("Close Day", DefaultValue = DayOfWeek.Friday)]
public DayOfWeek CloseDay { get; set; }
protected override void OnStart()
{
if (TimeSpan.TryParse(CloseTime, CultureInfo.InvariantCulture, out _closeTime) == false)
{
Print("Incorrect close time value");
Stop();
}
Timer.Start(1);
}
protected override void OnTimer()
{
if (Server.Time.DayOfWeek == CloseDay && Server.Time.TimeOfDay >= _closeTime)
{
var positionsCopy = Positions.ToArray();
foreach (var position in Positions)
{
ClosePosition(position);
}
}
}
}
}
@amusleh
amusleh
07 Oct 2021, 19:56
Ho,
Try this:
using cAlgo.API;
using cAlgo.API.Alert;
using System;
using cAlgo.API.Alert.Utility;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class AlertTest : Indicator
{
public MacdHistogram _Macd;
private int _lastAlertBar;
[Parameter("source")]
public DataSeries Source { get; set; }
[Parameter("Long Cycle 1", DefaultValue = 26)]
public int LongCycle1 { get; set; }
[Parameter("Short Cycle 1", DefaultValue = 12)]
public int ShortCycle1 { get; set; }
[Parameter("Signal 1", DefaultValue = 9)]
public int inpSingal1 { get; set; }
public IndicatorDataSeries Macdup { get; set; }
[Output("Macd", LineColor = "Red", Thickness = 2, PlotType = PlotType.Histogram)]
public IndicatorDataSeries Macd { get; set; }
protected override void Initialize()
{
_Macd = Indicators.MacdHistogram(Source, LongCycle1, ShortCycle1, inpSingal1);
}
public override void Calculate(int index)
{
Macd[index] = _Macd.Histogram[index];
if (index == _lastAlertBar) return;
_lastAlertBar = index;
if (_Macd.Histogram[index - 1] > 0 && _Macd.Histogram[index - 2] <= 0)
{
Notifications.ShowPopup(MarketSeries.TimeFrame, Symbol, TradeType.Buy, "AcademyWave.com", Symbol.Bid, "Macd cross Above zero", Server.Time);
}
if (_Macd.Histogram[index - 1] < 0 && _Macd.Histogram[index - 2] >= 0)
{
Notifications.ShowPopup(MarketSeries.TimeFrame, Symbol, TradeType.Sell, "AcademyWave.com", Symbol.Bid, "Macd cross Below zero", Server.Time);
}
}
}
}
It uses the last closed bar MACD value not the current open bar.
@amusleh
amusleh
06 Oct 2021, 12:40
Hi,
If you call LoadMoreHistory method it will load more bars data for that time frame, you can call it if your indicator needs to.
Regarding values not matching issue, it can be caused by difference in data that your cBot process and fed to indicator for calculation.
You can also check the indicator calculation code, the indicator itself can be the reason too.
The code I posted was just a guide for you to make the indicator support multiple time frames, not something read for use on your code.
@amusleh
amusleh
15 Oct 2021, 13:07
RE: RE:
douglascvas said:
Hi,
You should round the multiplication result before converting it back to long, ex:
If you pass 10 pips for above method it will first multiply it by symbol pip size, for example EURUSD pip size is 0.0001, then it will multiply it to 100000 and then it rounds the multiplication result back to symbol digits.
@amusleh