Topics
Replies
sirinath
26 Jul 2024, 05:46
( Updated at: 26 Jul 2024, 05:55 )
RE: [Request] Position and Order Modification Enhancements
firemyst said:
You do realize this is a technical support forum and not a suggestion forum?
If you want to make suggestions, post them in the suggestion forum:
https://ctrader.com/forum/suggestions/
Thanks.
I created this thread there: https://ctrader.com/forum/suggestions/44509/
@sirinath
sirinath
13 Feb 2024, 03:28
RE: Trailing Stop Loss not Shown and does not work in Tick Level Back Test
Asyc I think should be simulated even in back tests I believe. I mean all the API should be available in backtest otherwise what is the point of the backtest as you will get some incorrect result.
@sirinath
sirinath
01 Feb 2024, 07:30
RE: Embedded .Net Compiler Output Not Recognised by VS
VS does not see the build artifacts compiled the cTrader embedded compiler. So even if a reference to the project (indicator) is added it cannot be used in code. Until you also compile the Project (Indicator) using VS also. Then a VS project can reference, see or use the compiled artefacts and the indicator.
If you use other than the embedded compiler (e.g. .net 8) in cTrader this also gives issues.
@sirinath
sirinath
19 Oct 2023, 09:06
( Updated at: 21 Dec 2023, 09:23 )
RE: Cannot add to VS
PanagiotisChar said:
Hi,
What do you need to install and why? Usually there is nothing you need to do to work with VS
@sirinath
sirinath
19 Oct 2023, 09:04
( Updated at: 19 Oct 2023, 11:18 )
RE: Cannot add to VS
PanagiotisChar said:
Hi,
What do you need to install and why? Usually there is nothing you need to do to work with VS
Because I am getting a missing assembly reference.
Build started...
Retrying 'FindPackagesByIdAsyncCore' for source 'https://nuget.org/FindPackagesById()?id='cTrader.Automate'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'https://nuget.org/FindPackagesById()?id='cTrader.Automate'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Failed to restore C:\Users\XXXXXX\cAlgo\Sources\Robots\XXXX\XXXX\XXXX.csproj (in 5.98 sec).
1>------ Build started: Project: Grid Level Trading, Configuration: Debug Any CPU ------
NuGet package restore failed. Please see Error List window for detailed warnings and errors.
1>C:\Users\XXXXXX\cAlgo\Sources\Robots\XXXX\XXXX\XXXX.csproj : error NU1301: Failed to retrieve information about 'cTrader.Automate' from remote source 'https://nuget.org/FindPackagesById()?id='cTrader.Automate'&semVerLevel=2.0.0'.
1>Done building project "Grid Level Trading.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 02:28 PM and took 06.403 seconds ==========
@sirinath
sirinath
09 Feb 2022, 15:25
( Updated at: 09 Feb 2022, 15:29 )
RE:
The logic is the same. Only variable names, use of line colour, and DataSeries change between the files. Then the results change.
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class MATest2 : Indicator
{
// [Parameter("Source")]
// public DataSeries Source { get; set; }
[Parameter("Periods", DefaultValue = 14, MinValue = 1)]
public int Periods { get; set; }
// [Parameter("Periods", DefaultValue = 14, MinValue = 1)]
// public int Periods { get; set; }
[Output("Avg. Price")]
public IndicatorDataSeries AP { get; set; }
[Output("EMA")]
public IndicatorDataSeries EMA { get; set; }
// [Output("MA1", LineColor = "Magenta", LineStyle = LineStyle.DotsVeryRare)]
// public IndicatorDataSeries MA1 { get; set; }
[Output("EMAH")]
public IndicatorDataSeries EMAH { get; set; }
// [Output("MA4", LineColor = "Orange", LineStyle = LineStyle.DotsVeryRare)]
// public IndicatorDataSeries MA4 { get; set; }
[Output("EMAI")]
public IndicatorDataSeries EMAI { get; set; }
// [Output("MA5", LineColor = "Brown", LineStyle = LineStyle.DotsVeryRare)]
// public IndicatorDataSeries MA5 { get; set; }
[Output("EHMA", LineColor = "Red")]
public IndicatorDataSeries EHMA { get; set; }
// [Output("HMA", LineColor = "Red")]
// public IndicatorDataSeries HMA { get; set; }
private double exp;
// private double exp;
private double expH;
// private double expH;
private double expSR;
// private double expSR;
protected override void Initialize()
{
exp = 2.0 / (Periods + 1.0);
// exp = 2.0 / (Periods + 1.0);
expH = 2.0 / (Periods / 2.0 + 1.0);
// expH = 2.0 / (Periods / 2.0 + 1.0);
expSR = 2.0 / (Math.Sqrt(Periods) + 1.0);
// expSR = 2.0 / (Math.Sqrt(Periods) + 1.0);
}
public override void Calculate(int index)
{
double p = Bars.ClosePrices[index];
// double p = Source[index];
AP[index] = p;
// NA - not there in the other file
if (index <= 0)
{
EMA[0] = p;
// MA1[0] = p;
EMAH[0] = p;
// MA4[0] = p;
EMAI[0] = p;
// MA5[0] = p;
EHMA[0] = p;
// HMA[0] = p;
return;
}
int pi = index - 1;
// int pi = index - 1;
double pema = EMA[pi];
// double pma1 = MA1[pi];
double e = p - pema;
// double d1 = p - pma1;
double ema = pema + exp * e;
// double ma1 = pma1 + exp * d1;
EMA[index] = ema;
// MA1[index] = ma1;
double pemah = EMAH[pi];
// double pma4 = MA4[pi];
double eh = p - pemah;
// double d4 = p - pma4;
double emah = pemah + expH * eh;
// double ma4 = pma4 + expH * d4;
EMAH[index] = emah;
// MA4[index] = ma4;
double emai = 2 * emah - ema;
// double ma5 = 2 * ma4 - ma1;
EMAI[index] = emai;
// MA5[index] = ma5;
double pehma = EHMA[pi];
// double phma = HMA[pi];
double eeh = emai - pehma;
// double dh = ma5 - phma;
double ehma = pehma + expSR * eeh;
// double hma = ma5 + expSR * dh;
EHMA[index] = ehma;
// HMA[index] = hma;
}
}
}
@sirinath
sirinath
08 Feb 2022, 18:20
( Updated at: 21 Dec 2023, 09:22 )
RE: RE:
This is a modified version of Hull MA. The code is the same but the results are different.
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class MATest1 : Indicator
{
[Parameter("Source")]
public DataSeries Source { get; set; }
[Parameter("Periods", DefaultValue = 14, MinValue = 1)]
public int Periods { get; set; }
[Output("MA1", LineColor = "Magenta", LineStyle = LineStyle.DotsVeryRare)]
public IndicatorDataSeries MA1 { get; set; }
[Output("MA4", LineColor = "Orange", LineStyle = LineStyle.DotsVeryRare)]
public IndicatorDataSeries MA4 { get; set; }
[Output("MA5", LineColor = "Brown", LineStyle = LineStyle.DotsVeryRare)]
public IndicatorDataSeries MA5 { get; set; }
[Output("HMA", LineColor = "Red")]
public IndicatorDataSeries HMA { get; set; }
private double exp;
private double expH;
private double expSR;
protected override void Initialize()
{
exp = 2.0 / (Periods + 1.0);
expH = 2.0 / (Periods / 2.0 + 1.0);
expSR = 2.0 / (Math.Sqrt(Periods) + 1.0);
}
public override void Calculate(int index)
{
double p = Source[index];
if (index <= 0)
{
MA1[0] = p;
MA4[0] = p;
MA5[0] = p;
HMA[0] = p;
return;
}
int pi = index - 1;
double pma1 = MA1[pi];
double d1 = p - pma1;
double ma1 = pma1 + exp * d1;
MA1[index] = ma1;
double pma4 = MA4[pi];
double d4 = p - pma4;
double ma4 = pma4 + expH * d4;
MA4[index] = ma4;
double ma5 = 2 * ma4 - ma1;
MA5[index] = ma5;
double phma = HMA[pi];
double dh = ma5 - phma;
double hma = ma5 + expSR * dh;
HMA[index] = hma;
}
}
}
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class MATest2 : Indicator
{
[Parameter("Periods", DefaultValue = 14, MinValue = 1)]
public int Periods { get; set; }
[Output("Avg. Price")]
public IndicatorDataSeries AP { get; set; }
[Output("EMA")]
public IndicatorDataSeries EMA { get; set; }
[Output("EMAH")]
public IndicatorDataSeries EMAH { get; set; }
[Output("EMAI")]
public IndicatorDataSeries EMAI { get; set; }
[Output("EHMA", LineColor = "Red")]
public IndicatorDataSeries EHMA { get; set; }
private double exp;
private double expH;
private double expSR;
protected override void Initialize()
{
exp = 2.0 / (Periods + 1.0);
expH = 2.0 / (Periods / 2.0 + 1.0);
expSR = 2.0 / (Math.Sqrt(Periods) + 1.0);
}
public override void Calculate(int index)
{
double p = Bars.ClosePrices[index];
AP[index] = p;
if (index <= 0)
{
EMA[0] = p;
EMAH[0] = p;
EMAI[0] = p;
EHMA[0] = p;
return;
}
int pi = index - 1;
double pema = EMA[pi];
double e = p - pema;
double ema = pema + exp * e;
EMA[index] = ema;
double pemah = EMAH[pi];
double eh = p - pemah;
double emah = pemah + expH * eh;
EMAH[index] = emah;
double emai = 2 * emah - ema;
EMAI[index] = emai;
double pehma = EHMA[pi];
double eeh = emai - pehma;
double ehma = pehma + expSR * eeh;
EHMA[index] = ehma;
}
}
}
@sirinath
sirinath
17 Jan 2022, 10:26
( Updated at: 17 Jan 2022, 10:29 )
RE:
Many thanks for the reply. I currently have:
using System;
using cAlgo.API;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class IndicatorTest : Indicator
{
[Parameter("Bars")]
public Bars bars { get; set; }
protected override void Initialize()
{
try
{
Print("Starting");
Print("Bars - {0}", bars);
Print("Started");
} catch (Exception e)
{
Print(e, e.StackTrace);
}
}
public override void Calculate(int index)
{
}
}
}
I am wondering if you can share an example come on how
GetIndicator(Bars bars, Object[] parameterValues)
is used?
I am trying to create multiple indicators for multiple symbols within the bot. Each indicator will get one timeseries of bars.
@sirinath
sirinath
09 Dec 2021, 16:34
( Updated at: 09 Dec 2021, 16:56 )
RE:
PanagiotisCharalampous said:
Hi sirinath,
To be able to reproduce your problem, you need to share with us your cBot code as well as cBot parameters and dates.
Best Regards,
Panagiotis
Is is not possible to share the code.
But I am looking at "AUDCAD,AUDCHF,AUDJPY,AUDNZD,AUDUSD,CADCHF,CADJPY,CHFJPY,EURAUD,EURCAD,EURCHF,EURGBP,EURJPY,EURNZD,EURUSD,GBPAUD,GBPCAD,GBPCHF,GBPJPY,GBPNZD,GBPUSD,NZDCAD,NZDCHF,NZDJPY,NZDUSD,USDCAD,USDCHF,USDJPY". This happened initially while downloading the data for the symbol before the backtest starts running.
I have following code:
[Parameter(DefaultValue = "AUDCAD,AUDCHF,AUDJPY,AUDNZD,AUDUSD,CADCHF,CADJPY,CHFJPY,EURAUD,EURCAD,EURCHF,EURGBP,EURJPY,EURNZD,EURUSD,GBPAUD,GBPCAD,GBPCHF,GBPJPY,GBPNZD,GBPUSD,NZDCAD,NZDCHF,NZDJPY,NZDUSD,USDCAD,USDCHF,USDJPY")]
public string InstrumentList { get; set; }
protected override void OnStart() {
string[] symbols = InstrumentList.Split(',');
Symbol[] SelectedSymbols = Symbols.GetSymbols(symbols);
...
}
@sirinath
sirinath
26 Jul 2024, 05:49 ( Updated at: 26 Jul 2024, 05:55 )
RE: [Request] Latest .Net | Latest LT .Net | F#
firemyst said:
I added it here: https://ctrader.com/forum/suggestions/44510/
@sirinath