Topics
Replies
Sparkymark123
18 Sep 2022, 09:35
1 tick problem
I have now discovered this problem lies only when the backtest is done on one tick timescale.
Anything above 2 ticks works fine.
@Sparkymark123
Sparkymark123
14 Sep 2022, 13:25
here is a simple cbot that shows no equity or balance in the backtest
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.None)]
public class Marks : Robot
{
[Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 0.01, MinValue = 0.01, Step = 0.01)]
public double Quantity { get; set; }
[Parameter("Source")]
public DataSeries Source { get; set; }
[Parameter("MA slow", DefaultValue = 200)]
public int MAslow { get; set; }
[Parameter("MA medium", DefaultValue = 30)]
public int MAmedium { get; set; }
[Parameter("MA fast", DefaultValue = 10)]
public int MAfast { get; set; }
[Parameter("Take Profit", DefaultValue = 50, MinValue = 1)]
public int TP { get; set; }
[Parameter("Stop Loss", DefaultValue = 500, MinValue = 1)]
public int SL { get; set; }
private MovingAverage i_MA_slow;
private MovingAverage i_MA_fast;
private MovingAverage i_MA_medium;
private double volumeInUnits;
protected override void OnStart()
{
volumeInUnits = Symbol.QuantityToVolumeInUnits(Quantity);
i_MA_slow = Indicators.MovingAverage(Bars.ClosePrices, MAslow, MovingAverageType.Exponential);
i_MA_fast = Indicators.MovingAverage(Bars.ClosePrices, MAfast, MovingAverageType.Exponential);
i_MA_medium = Indicators.MovingAverage(Bars.ClosePrices, MAmedium, MovingAverageType.Exponential);
}
protected override void OnBar()
{
if (i_MA_fast.Result.Last(200) > i_MA_medium.Result.Last(200))
{
ExecuteMarketOrder(TradeType.Sell, SymbolName, volumeInUnits, "SCALP", SL, TP);
}
}
}
}
@Sparkymark123
Sparkymark123
14 Sep 2022, 12:16
backtest issues
I have been updated to version 4.3.13
I have just been on a teams meeting and people on there have the same issue with 4.3.12
We have found the issue to be happening on the normal Ctrader platform on a demo account with no broker involved.
@Sparkymark123
Sparkymark123
11 Aug 2022, 12:48
Thanks but no that was not the question.
Does Ctrader take the margin of each position out of the equity from the account when it is backtesting or not?
If I do a backtest, do I then have to go through the whole of the events calendar and work out each position open and close point and calculate the margin of every position at every point in the backtest and then add this to the backtest result to get an actual idea of the account equity and balance throughout the backtest or does ctrader do this whilst it is backtesting?
I hope this is clearer
@Sparkymark123
Sparkymark123
27 Mar 2022, 12:08
Thank you
Many thanks for your help with this.
Do you contract for paid work in creating cbots? I may need something creating once I have the design for it figured properly?
I also have another problem with some code not working correctly - I added a trailing stop and it works with backtest but then doesn`t place any trades...
I`ll put a post in the help section for that though.
Kind Regards.
amusleh said:
Hi,
I'm not familiar with ProRealTime code, but I think the cTrader Automate equivalent of your posted code will look something like this:
using cAlgo.API; using cAlgo.API.Indicators; namespace cAlgo { [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None), Levels(0)] public class EMAGradient : Indicator { private ExponentialMovingAverage _ema; [Parameter("Period", DefaultValue = 14)] public int Period { get; set; } [Parameter("Bars #", DefaultValue = 1)] public int BarsNumber { get; set; } [Parameter("Source")] public DataSeries Source { get; set; } [Output("Main", IsHistogram = true, PlotType = PlotType.Histogram, Thickness = 3)] public IndicatorDataSeries Result { get; set; } protected override void Initialize() { _ema = Indicators.ExponentialMovingAverage(Source, Period); } public override void Calculate(int index) { Result[index] = _ema.Result[index] - _ema.Result[index - BarsNumber]; } } }
@Sparkymark123
Sparkymark123
23 Oct 2024, 05:11
RE: Private link Copytrader
PanagiotisCharalampous said:
I am trying to link shared accounts in this way.
When I open the link in the browser it just shows my trading strategy and does not give me any way to link any of my own or the shared access accounts.
@Sparkymark123