Topics
Replies
PanagiotisCharalampous
21 Mar 2018, 17:31
Hi Gwave,
Thanks for posting in our forum. An idea would be to keep in the counter trade position a reference to the original position e.g. keep the id in the label, and then, on OnPositionsClosed, track if there is a referenced position and close it as well. However this needs some coding to be achieved...
Let me know if I was helpful.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Mar 2018, 15:10
Hi ciawynne,
You get these warnings because you still use local variables when getting the indicators
var EMA_9 = Indicators.ExponentialMovingAverage(SourceSeries, EMA_9_period); var EMA_3 = Indicators.ExponentialMovingAverage(SourceSeries, EMA_3_period);
it should be
EMA_9 = Indicators.ExponentialMovingAverage(SourceSeries, EMA_9_period); EMA_3 = Indicators.ExponentialMovingAverage(SourceSeries, EMA_3_period);
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Mar 2018, 12:06
Please also note that DateTime is not supported as an input parameter
[Parameter()] public DateTime TimeSeries { get; set; }
@PanagiotisCharalampous
PanagiotisCharalampous
21 Mar 2018, 11:37
Hi cianwynne,
Thanks for the cBot. The provided code does not build but the error I receive is about EMA_3 and EMA_9 not being declared in the OnBar method. When I uncomment the relevant properties, it builds fine. Am i missing something?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Mar 2018, 10:59
Hi cianwynne,
It would be much easier for us to help you if you could share with us the cBot code so that we can reproduce your issue.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Mar 2018, 09:44
Hi Alexander,
It doesn't need to be Excel or SQL. A simple csv would be enough. There are plenty of examples on how to do this like this one.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Mar 2018, 09:25
Hi Alexander,
Yes you could store this information in a file if you would like it not to be lost on a restart. I agree with you that using the TP is not a good idea.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
20 Mar 2018, 17:34
Hi Alexander,
From what I understand you need to track which positions have been modified and not modify them again in case they have. You could hold all the modified positions in a separate list and before modifying a position check if the position is in the list or not.
Let me know what you think of this.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
20 Mar 2018, 11:13
( Updated at: 21 Dec 2023, 09:20 )
Hi ceakuk,
I have tried this but does not seem to be true. See my examples below
Indicator
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo { [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class LastValueIndicator : Indicator { [Output("Main")] public IndicatorDataSeries Result { get; set; } protected override void Initialize() { // Initialize and create nested indicators } public override void Calculate(int index) { // Calculate value at specified index Result[index] = MarketSeries.Close.LastValue; } } }
cBot
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 NewcBot : Robot { private LastValueIndicator _ind; protected override void OnStart() { _ind = Indicators.GetIndicator<LastValueIndicator>(); } protected override void OnTick() { Print("cBot Last Value: " + MarketSeries.Close.LastValue); Print("Indicator Last Value:" + _ind.Result.LastValue); } protected override void OnStop() { // Put your deinitialization logic here } } }
Results
Let me know if I am missing something.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
20 Mar 2018, 10:36
Hi leonardo,
Currently there is no such functionality in cAlgo.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
20 Mar 2018, 09:29
Hi cianwyinne,
Thamks for posting in our forum. Here is a guide on how to use custom indicators in your cBots. Let me know if it is helpful.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
19 Mar 2018, 17:54
Hi ceakuk,
MarketSeries.Close.LastValue should always be equal to Symbol.Bid. However this is not the case with renko.Close.Last(0). 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 NewcBot : Robot { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } private Renko renko; [Parameter("Renko Pips", DefaultValue = 10, MinValue = 0.5, Step = 2)] public double RenkoPips { get; set; } [Parameter("Number Of Bricks", DefaultValue = 100, MinValue = 10, Step = 100)] public int BricksToShow { get; set; } [Parameter("Zoom Level", DefaultValue = 3, MinValue = 0, MaxValue = 5, Step = 1)] public double ZoomLevel { get; set; } [Parameter("Bullish bar color", DefaultValue = "SeaGreen")] public string BullishBarColor { get; set; } [Parameter("Bearish bar color", DefaultValue = "Tomato")] public string BearishBarColor { get; set; } protected override void OnStart() { object[] parameterValues = { RenkoPips, // Bar size BricksToShow, // Show number of bricks ZoomLevel, //ZoomLevel BullishBarColor, // Bullish bar color BearishBarColor // Bearish bar color }; renko = Indicators.GetIndicator<Renko>(parameterValues); } protected override void OnTick() { Print("Last Close Price:" + MarketSeries.Close.LastValue); Print("Last Bid Price:" + Symbol.Bid); Print("Last Close Renko Price:" + renko.Close.Last(0)); } protected override void OnStop() { // Put your deinitialization logic here } } }
Therefore I don't see any issue with MarketSeries.Close.LastValue.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
19 Mar 2018, 17:37
Hi ceakuk,
In the original post you said
MarketSeries.Close.LastValue is totally different from using Symbol.Bid and Symbol.As
however you are not using anywhere MarketSeries.Close.LastValue. You are using renko.Close.Last(0). This is a third party indicator. If you think that this indicator returns wrong values, you should contact the creator of the indicator.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
19 Mar 2018, 17:20
Hi ceacuk,
Thank you. Where in the cBot are you using MarketSeries.Close.LastValue? I see only renko.Close.Last(0).
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
19 Mar 2018, 16:36
Hi ceakuk,
MarketSeries.Close.LastValue has the Close value of the last bar. Symbol.Ask and Symbol.Bid contain the latest tick prices. Values included in MarketSeries are constructed from past tick data therefore they are accurate. Would you like to give us some more information on what you are doing, maybe by sharing a cBot, so that we can advise further?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
19 Mar 2018, 16:28
( Updated at: 21 Dec 2023, 09:20 )
Hi ceacuk,
In each forum section there is an Add Thread button. See below
Let me know if this helps,
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
19 Mar 2018, 15:51
Hi Steve,
Unfortunately I cannot give you an ETA. Our developers are already working on it, so I would expect it in the next couple of releases, without this being final.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
19 Mar 2018, 14:23
Hi Singleton,
Indeed you need to have some width to draw horizontal lines. Another suggestion would be to output these prices as indicator outputs. You could have output series with a Points plot type like below
[Output("Open", Color = Colors.Blue, PlotType = PlotType.Points)] public IndicatorDataSeries Open{ get; set; } [Output("Close", Color = Colors.Red, PlotType = PlotType.Points)] public IndicatorDataSeries Close{ get; set; }
and fill them with the relevant data.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
19 Mar 2018, 11:45
Hi Steve,
Thanks for posting in our forum and for your suggestions as well! I would like to inform you that we are currently working on a new chart API that will allow you to easily implement this functionality in the future.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Mar 2018, 17:45
Hi ceakuk,
We would be able to help you if you share with us the cBot code and steps to reproduce the results. Only by seeing an image, we cannot come to any conclusions.
Best Regards,
Panagiotis
@PanagiotisCharalampous