Topics
Replies
PanagiotisCharalampous
07 Dec 2018, 10:30
Hi Derek,
Can you share the full cBot code as well some steps to reproduce what you see? Maybe the problem is somewhere else.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
07 Dec 2018, 10:23
( Updated at: 21 Dec 2023, 09:21 )
Hi Luigi,
A cBot is nothing less than a C# project. So if you edit it using Visual Studio you can have all the options available for a C# project. This means that you can have separate classes for reusable code. See below an example of calling a function of another class inside the cBot.
This way you can organize your code in a proper object oriented approach. Let me know if you need any additional assistance.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
07 Dec 2018, 10:14
Hi tgjobscv,
I modified the cBot to accept stop loss and take profit as parameters. See below
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class SampleRSIcBot : Robot { [Parameter("Source")] public DataSeries Source { get; set; } [Parameter("Periods", DefaultValue = 14)] public int Periods { get; set; } [Parameter("Quantity (Lots)", DefaultValue = 1, MinValue = 0.01, Step = 0.01)] public double Quantity { get; set; } [Parameter("Stop Loss", DefaultValue = 10, MinValue = 0.1, Step = 0.1)] public double StopLoss { get; set; } [Parameter("Take Profit", DefaultValue = 10, MinValue = 0.1, Step = 0.1)] public double TakeProfit { get; set; } private RelativeStrengthIndex rsi; protected override void OnStart() { rsi = Indicators.RelativeStrengthIndex(Source, Periods); } protected override void OnTick() { if (rsi.Result.LastValue < 20) { Close(TradeType.Sell); Open(TradeType.Buy); } else if (rsi.Result.LastValue > 70) { Close(TradeType.Buy); Open(TradeType.Sell); } } private void Close(TradeType tradeType) { foreach (var position in Positions.FindAll("SampleRSI", Symbol, tradeType)) ClosePosition(position); } private void Open(TradeType tradeType) { var position = Positions.Find("SampleRSI", Symbol, tradeType); var volumeInUnits = Symbol.QuantityToVolume(Quantity); if (position == null) ExecuteMarketOrder(tradeType, Symbol, volumeInUnits, "SampleRSI", StopLoss, TakeProfit); } } }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
07 Dec 2018, 10:07
Hi DelTrader,
I would suggest the below approach
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 { [Parameter(DefaultValue = 0.0)] public string Label { get; set; } MarketSeries _daySeries; DateTime _lastDayOpen; protected override void OnStart() { _daySeries = MarketData.GetSeries(TimeFrame.Daily); _lastDayOpen = _daySeries.OpenTime.LastValue; } protected override void OnTick() { if (_lastDayOpen != _daySeries.OpenTime.LastValue) { _lastDayOpen = _daySeries.OpenTime.LastValue; foreach (var _PendingOrders in PendingOrders) { if (_PendingOrders.Label == Label) { Print("Cancel by time"); CancelPendingOrder(_PendingOrders); } } } } protected override void OnStop() { // Put your deinitialization logic here } } }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Dec 2018, 17:23
Hi oliveira.phc,
There is no such possibility at the moment.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Dec 2018, 14:59
Hi Dim13,
Thank you for posting in our forum. See below an example.
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 { [Parameter(DefaultValue = 20000)] public double EquityLevel { get; set; } protected override void OnStart() { // Put your initialization logic here } protected override void OnTick() { if (EquityLevel > Account.Equity) { foreach (var position in Positions) { position.Close(); } } } protected override void OnStop() { // Put your deinitialization logic here } } }
This cBot will close all positions as soon as the equity drops below the level set in the predefined parameter.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Dec 2018, 10:51
Hi jam584St1,
Depending on the Market Data Request you will send (tag 264) you will be receiving either spot prices or the full depth of market. If you have subscribed for the full depth of market, then the highest bid and the lowest ask are the spot prices.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Dec 2018, 10:00
Hi eirik_1993,
You can use Templates for this.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Dec 2018, 09:42
Hi D D,
Can you please explain what do you mean? I cannot see any problem in the example.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Dec 2018, 09:27
Hi eirik_1993,
There is no such option available at the moment. You can post your suggestion in the Suggestions section so that we can keep track of it.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Dec 2018, 09:23
Hi tgjobscv,
I could not reproduce any problem with the login. Can you please post a screenshot?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
06 Dec 2018, 09:18
Hi tgjobscv,
You can consider contacting a Consultant to convert the cBot for you.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
05 Dec 2018, 15:05
Hi protonmt4,
Thanks for your suggestion. Both afhacker and Paul Hayes are prominent and active members of our community and they have contributed lots of open source tools as well. I don't think it makes any harm if they also "advertise" some paid products since they make a living out of this. Also I find it more convenient that all available cBots and Indicators are accessible in one place, both paid and free. Third party products discussion is mostly for announcements and discussions for these products which are not limited to cBots and Indicators but could be applications as well e.g. myfxbook or SignalStart.
Regarding the fact that cBots without source code are not allowed, this is mostly related to security, as we want to avoid potentially harmful cBots to be distributed from our site.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
05 Dec 2018, 14:43
Hi bienve.pf,
Use the following line of code
var txt = IndicatorArea.DrawText("txt", "EURUSD1", index + 3, 1, Color.Orange);
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
05 Dec 2018, 12:47
Ηi sean.n.long,
Please post the code so that we can have a look.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
05 Dec 2018, 12:32
Hi Dagfx,
There is no option to go back to the previous version. I will forward your feedback to the product team.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
05 Dec 2018, 12:29
Hi eirik_1993,
Thanks for posting in our forum. In principle, it is possible to create a custom indicator for this. You could post a Job or contact a Consultant to help you with this.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
05 Dec 2018, 12:23
Hi Matt,
Thanks for your post but it is not clear how we can help you. Can you please explain what do you need?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
05 Dec 2018, 12:06
Hi bienve.pf,
"Hello, is it possible to draw text or lines in an indicator with IsOverlay = false?"
Yes this is possible
"AND, It is possible to paint text with different size in Charts?"
It is not possible to set the text size at the moment.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
07 Dec 2018, 11:20
Hi dmn,
First of all I would like to thank you for all the feedback you have provided to us during the last days. I want to assure you that all feedback provided by the community is taken seriously into consideration. However you need to understand that changes cannot happen overnight for such large scale projects for many reasons, some of them listed below
We have a huge user base, millions. Something that might make sense for one trader might not make for several others. We need to have that in mind and consider all the implications before making a change. The fact that several traders requested a feature or a change is not enough to proceed. Because there might be several more that might be affected negatively by the change. Therefore before deciding a change, we need to do our homework and this takes time.
We have a huge To Do list and if you check our UserVoice forum, announcements and what’s new section you will notice that we prioritize and deliver. UserVoice is updated frequently, so you can check there on which features proposed by the community we are currently working on. Things not been done yet will always exist. If you notice, during the last year we have delivered major features on all the range of our applications, many of them requested by traders, and this fact proves that we listen.
We are not a one-man-show company. We are a large organization with several departments, products and clients and there are decision making and development processes in place. One decision might affect more than one products and departments so coordination is required something that makes the process lengthtier.
I hope that you will give us enough time to meet your expectations.
Best Regards,
Panagiotis
@PanagiotisCharalampous