cAlgo Converter
cAlgo Converter
05 Feb 2020, 15:46
Since I changed from cTrader ver 3.6 to 3.7, some of the my code became obsolete although workable. It would be great if cTrader can make similiar link as Converter to convert MQ4 to cAlgo:
I do not know how to convert this:
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class NewcBot : Robot
{
private ExponentialMovingAverage f5;
private ExponentialMovingAverage s5;
protected override void OnStart()
{
var MSMin5 = MarketData.GetSeries(TimeFrame.Minute5);
f5 = Indicators.ExponentialMovingAverage(MSMin5.Close, 5);
s5 = Indicators.ExponentialMovingAverage(MSMin5.Close, 50);
// Put your initialization logic here
}
protected override void OnTick()
{
// Put your core logic here
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
Replies
mylowsmoke
09 Feb 2020, 01:43
cAlgo Converter
Noted with Thanks. Actually I am already quite aware of this build warning that's why posted only code that I unable to convert here. The build warning doesn't suggest enough good replacement for the obsolete. Spent few hours to look through the new code and finally my problem solved. Thanks anyway.
@mylowsmoke
genappsforex
12 Feb 2020, 14:57
try this
private MovingAverage f5;
private MovingAverage s5;
protected override void OnStart()
{
Bars MSMin5 = MarketData.GetBars(TimeFrame.Minute5);
f5 = Indicators.MovingAverage(MSMin5.ClosePrices, 5, MovingAverageType.Exponential);
S5 = Indicators.MovingAverage(MSMin5.ClosePrices, 50, MovingAverageType.Exponential);
.......
I hope there is more logic in your bot than this ;-)
@genappsforex
mylowsmoke
13 Feb 2020, 11:40
cAlgo Converter
It is not a full coding,It's just part of the workable coding that I have. Well, I figure it out already. Thanks. I just wish converting of workable previous code is much easier. That if cTrader decide to create converter for it. ;) I have to change all manually one by one. D)
@mylowsmoke
PanagiotisCharalampous
05 Feb 2020, 15:50 ( Updated at: 21 Dec 2023, 09:21 )
Hi mylowsmoke,
When building your cBot, you should get warnings that inform you what is obsolete and how it can be updated. See below
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous