Topics
Replies
jmmslagter
18 Aug 2022, 08:42
RE: Hi, if I get a solution, I will let you know.
deolaolalere said:
I am having same issue
@jmmslagter
jmmslagter
17 Aug 2022, 21:51
RE:
PanagiotisCharalampous said:
Hi jmmslagter,
I tried this and had no problem. Can you share the complete cBot code that creates the problem to you?
Best Regards,
Panagiotis
Hi, I send it in a DM on Telegram.
@jmmslagter
jmmslagter
17 Aug 2022, 21:41
RE:
PanagiotisCharalampous said:
Hi jmmslagter,
I tried this and had no problem. Can you share the complete cBot code that creates the problem to you?
Best Regards,
Panagiotis
Yes, I can. It's over 800 lines. Maybe I can send this in a file to a (mail) address?
Kind regards,
Hans
@jmmslagter
jmmslagter
17 Aug 2022, 14:45
RE:
PanagiotisCharalampous said:
Hi jmmslagter,
What is the "Grid" function?
Best Regards,
Panagiotis
Hello, Maybe I wasn't clear enough, sorry. Here is part of the code.
var grid = new Grid(25, 7)
{
BackgroundColor = Color.DarkGreen,
Opacity = 0.9,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top
};
var style = new Style();
style.Set(ControlProperty.Padding, 1);
style.Set(ControlProperty.Margin, 0.1);
style.Set(ControlProperty.BackgroundColor, Color.LightGreen);
style.Set(ControlProperty.ForegroundColor, Color.Black);
style.Set(ControlProperty.FontSize, 10);
style.Set(ControlProperty.Width,70);
style.Set(ControlProperty.MinHeight,60);
//***************************************************
grid.AddChild(new TextBlock
{
BackgroundColor = Color.Black,
Text = "Timeframes",
Style = style
}, 0, 0);
-
-
-
-
Chart.AddControl(grid);
@jmmslagter
jmmslagter
19 May 2022, 10:03
RE:
amusleh said:
Hi,
To use an indicator on a different time frame you have to first pass that time frame bars series as source to indicator and then use that time frame index values to access the indicator output values, here is an example for MACD:
using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; namespace cAlgo { [Indicator(AccessRights = AccessRights.None)] public class MACDMTF : Indicator { private MacdCrossOver _macd; private Bars _bars; [Parameter("Selected Time Frame")] public TimeFrame SelectedTimeFrame { get; set; } [Parameter("Long Cycle", DefaultValue = 26)] public int LongCycle { get; set; } [Parameter("Short Cycle", DefaultValue = 12)] public int ShortCycle { get; set; } [Parameter("Signal Periods", DefaultValue = 9)] public int SignalPeriods { get; set; } [Output("Histogram", LineColor = "Yellow", IsHistogram = true, PlotType = PlotType.Histogram, Thickness = 2)] public IndicatorDataSeries Histogram { get; set; } [Output("MACD", LineColor = "Blue", PlotType = PlotType.Line, Thickness = 1)] public IndicatorDataSeries MACD { get; set; } [Output("Signal", LineColor = "Red", PlotType = PlotType.Line, Thickness = 1)] public IndicatorDataSeries Signal { get; set; } protected override void Initialize() { _bars = MarketData.GetBars(SelectedTimeFrame); _macd = Indicators.MacdCrossOver(_bars.ClosePrices, LongCycle, ShortCycle, SignalPeriods); } public override void Calculate(int index) { var timeFrameIndex = _bars.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]); Histogram[index] = _macd.Histogram[timeFrameIndex]; MACD[index] = _macd.MACD[timeFrameIndex]; Signal[index] = _macd.Signal[timeFrameIndex]; } } }
I knew it was something like this, but could not get a solution. Thanks very much.
@jmmslagter
jmmslagter
06 May 2022, 10:51
RE:
The problem is in the marketdepth. Because I wanted to minimize the code (3000 lines), I removed this part and then the problem was over. Now I have some things to do. Sorry for the wrong category choice and thanks for the comment. grts Hans
PanagiotisCharalampous said:
Hi jmmslagter
- Please use the correct topic to post your problem
- Please share more information like the cBot's code and steps to reporduce the problem
Best Regards,
Panagiotis
@jmmslagter
jmmslagter
14 Mar 2022, 11:30
RE:
PanagiotisCharalampous said:
Hi jmmslagter,
Here is an example on how you can feed an indicator with data from another timeframe.
var tsmfast = Indicators.TimeSeriesMovingAverage(MarketData.GetBars(TimeFrame.Hour).ClosePrices, 14);
Best Regards,
Panagiotis
Thank you very much, I was thinking to much MQL5.
@jmmslagter
jmmslagter
28 Aug 2022, 13:32
RE:
PanagiotisCharalampous said:
I have written a Bot, which trades with 3 pairs (hedge). There is no 'grid' in it, but it also does not work under .Net6. It seems to me to be deeper and it makes little sense to focus on individual cBots.
@jmmslagter