Topics
Replies
PanagiotisCharalampous
25 Sep 2017, 11:26
Hi MaVe,
The below should be working
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo { [Indicator("Text", IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class Text : Indicator { [Parameter("Test TimeFrame", DefaultValue = "Hour12")] public TimeFrame TestTimeFrame { get; set; } private MarketSeries T; // ----- Colors Tc = Colors.White; // ------------------------------------------------------ protected override void Initialize() { T = MarketData.GetSeries(Symbol, TestTimeFrame); } // ------------------------------------------------------ public override void Calculate(int index) { var Text = GetTimeFrameText(); ChartObjects.DrawText("Text", "Text " + Text, index + 1, T.Close.Last(1), VerticalAlignment.Top, HorizontalAlignment.Right, Tc); } private string GetTimeFrameText() { if (TestTimeFrame == TimeFrame.Hour12) { return "H12"; } return TestTimeFrame.ToString(); } } }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
25 Sep 2017, 10:16
Hi irmscher9,
The issue will be investigated by our product team. We will update you regarding this as soon as we have some conclusions.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
25 Sep 2017, 10:10
Hi Trader4ever,
I tried your indicator but I didn't experience any performance degradation. Can you please share a screenshot of your chart. It could be that something else causes the slow down.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
25 Sep 2017, 09:51
Hi MaVe,
There is no build in way to do that. You can try implementing your own function as below
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo { [Indicator("Text", IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class Text : Indicator { [Parameter("Test TimeFrame", DefaultValue = "Hour12")] public TimeFrame TestTimeFrame { get; set; } private MarketSeries T; // ----- Colors Tc = Colors.White; // ------------------------------------------------------ protected override void Initialize() { T = MarketData.GetSeries(Symbol, TestTimeFrame); } // ------------------------------------------------------ public override void Calculate(int index) { var Text = GetTimeFrameText(); ChartObjects.DrawText("Text", "Text " + Text, index + 1, T.Close.Last(1), VerticalAlignment.Top, HorizontalAlignment.Right, Tc); } private string GetTimeFrameText() { if (TestTimeFrame == TimeFrame.Hour12) { return "H12"; } return TestTimeFrame; } } }
You can add more conditions and put the text you need for each timeframe. Let me know if this helps.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
25 Sep 2017, 09:12
Hi Ryan,
Did you try clean installation? See here at the bottom of the page.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
25 Sep 2017, 09:06
Hi Alex,
It would be useful to have some additional information like the broker and your location, so that we can try this ourselves and see if it happens and if the delay is justifiable.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Sep 2017, 17:50
Hi hungtonydang,
I made the calculations as well and the results seem correct. Can you please check again your calculations?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Sep 2017, 17:44
Hi hungtonydang,
I suspect that the issue is related the section where you are modifying the position. Both sections where
foreach (var position in Positions) { . . . . }
In this case both cBots access the same collection of Positions therefore it is possible that both cBots are modifying the same position at the same time resulting to an exception. But this is just a guess.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Sep 2017, 15:52
Hi cfuorvito@gmail.com,
It is because anotherSeries and AnotherTimeFrame are "dummy" variable names. Since you posted them in your code, I was with the impression that you will replace them yourself with whatever suits you. See below an example that builds using a daily timeframe and the Close values
using System.Linq; using cAlgo.API; using System.IO; using System.Collections; using System.Collections.Generic; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FileSystem)] public class MACD : Robot { [Parameter("Volume", DefaultValue = 1000)] public int volume { get; set; } [Parameter(DefaultValue = 50, MinValue = 1)] public int StopLoss { get; set; } [Parameter(DefaultValue = 50, MinValue = 1)] public int TakeProfit { get; set; } [Parameter("MACD LongCycle", DefaultValue = 26, MinValue = 1)] public int LongCycle { get; set; } [Parameter("MACD ShortCycle", DefaultValue = 12, MinValue = 1)] public int ShortCycle { get; set; } [Parameter("MACD Period", DefaultValue = 9, MinValue = 1)] public int MACDPeriod { get; set; } private MacdCrossOver _MACD; protected override void OnBar() { var dailySeries = MarketData.GetSeries(TimeFrame.Daily); _MACD = Indicators.MacdCrossOver(anotherSeries.Close, LongCycle, ShortCycle, MACDPeriod); if (_MACD.MACD.Last(1) < _MACD.Signal.Last(1) && _MACD.MACD.Last(0) > _MACD.Signal.Last(0) && _MACD.Signal.Last(0) < 0) { ExecuteMarketOrder(TradeType.Buy, Symbol, volume, "korakodmy", StopLoss, TakeProfit, 5); } if (_MACD.MACD.Last(1) > _MACD.Signal.Last(1) && _MACD.MACD.Last(0) < _MACD.Signal.Last(0) && _MACD.Signal.Last(0) > 0) { ExecuteMarketOrder(TradeType.Sell, Symbol, volume, "korakodmy", StopLoss, TakeProfit, 5); } } } }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Sep 2017, 15:32
Hi,
Apologies the code had a small mistake. The anotherSeries was not passed into the MacdCrossOver() function. Can you try the below and let me know?
protected override void OnBar() { var anotherSeries = MarketData.GetSeries(AnotherTimeFrame); _MACD = Indicators.MacdCrossOver(anotherSeries, LongCycle, ShortCycle, MACDPeriod); if (_MACD.MACD.Last(1) < _MACD.Signal.Last(1) && _MACD.MACD.Last(0) > _MACD.Signal.Last(0) && _MACD.Signal.Last(0) < 0) { ExecuteMarketOrder(TradeType.Buy, Symbol, volume, "korakodmy", StopLoss, TakeProfit, 5); } if (_MACD.MACD.Last(1) > _MACD.Signal.Last(1) && _MACD.MACD.Last(0) < _MACD.Signal.Last(0) && _MACD.Signal.Last(0) > 0) { ExecuteMarketOrder(TradeType.Sell, Symbol, volume, "korakodmy", StopLoss, TakeProfit, 5); }
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Sep 2017, 15:00
Hi cfuorvito@gmail.com
You need to pass the series returned into anotherSeries variable into the MacdCrossOver() function. See example below
protected override void OnBar() { var anotherSeries = MarketData.GetSeries(AnotherTimeFrame); _MACD = Indicators.MacdCrossOver(LongCycle, ShortCycle, MACDPeriod); if (_MACD.MACD.Last(1) < _MACD.Signal.Last(1) && _MACD.MACD.Last(0) > _MACD.Signal.Last(0) && _MACD.Signal.Last(0) < 0) { ExecuteMarketOrder(TradeType.Buy, Symbol, volume, "korakodmy", StopLoss, TakeProfit, 5); } if (_MACD.MACD.Last(1) > _MACD.Signal.Last(1) && _MACD.MACD.Last(0) < _MACD.Signal.Last(0) && _MACD.Signal.Last(0) > 0) { ExecuteMarketOrder(TradeType.Sell, Symbol, volume, "korakodmy", StopLoss, TakeProfit, 5); } }
Let me know if the above helps,
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Sep 2017, 09:51
Hi trungnga999c,
Your broker is the most appropriate to give an answer to this question. However, I can highlight below some points you should have in mind when following signals and seeing such deviations in execution.
- Do you use the same broker as the signal provider? Different brokers might offer different liquidity and pricing at the same moment resulting into different execution price.
- Do you have the same account type? Different account types might have different spread and offer different commission, affecting again the execution price.
- Do you trade the same volume? Larger volumes might lead to larger slippage.
- Execution time. Unavoidably, signal followers will execute their trades after signal providers, therefore there is always the possibility to get worse prices.
I hope that the above helps you clarifying the situation.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Sep 2017, 09:34
Hi Trader4ever,
Thanks for posting this suggestion. Since the issue was raised, I would like to inform the community that some major changes are in the works. You might have noticed some change in the community the last couple of months and more things are to be expected. A new community platform is planned as well as more initiatives are considered towards making your life easier. Revamping our supportive material is one of the major pillars of this big project. And all of this is just a part of major changes coming in the platform soon, some of them already announced in the Coming Soon section.
Having said the above, we would be happy to hear your suggestion for specific changes and additions in our supportive material.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Sep 2017, 09:24
Hi tradenpoker,
Thanks for your suggestion. It would be better to post such suggestions in the Suggestions section so that development teams can keep track and find suggestions in one place. Also, since it might take some to see this as a built in indicator of cTrader, community members could consider developing it.
Regarding the Chaikin Oscillator, since it is a community developed indicator, you could contact the developer and discuss your suggestions with him.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Sep 2017, 17:12
Hi Paul,
Thanks for spotting this. We will change this to accept more pips.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Sep 2017, 16:34
Hi GammaQuant,
Named Pipes and Memory Mapped Files are indeed advanced C# subjects. Named Pipes are used for inteprocess communication i.e. one application sending messages to another while Memory Mapped Files are used to share memory between different processes. So it all depends on the application you are building. If for example you need one application to inform another about something then use Named Pipes. If you need an application to write something in memory and another application to read this information whenever needed then use Memory-Mapped files. I don't know if I can help you more than this at this stage. If you have more specific questions, feel free to ask.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Sep 2017, 12:53
( Updated at: 21 Dec 2023, 09:20 )
Hi jcr1818@gmail.com,
There is a number of pivot points indicators provided by our community. Have you tried them?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Sep 2017, 12:09
Hi GammaQuant,
Thanks for the links. There is a mention in one of them that you could use static collections to share variables between cBots but this is not possible. I assume that the person that suggested this never actually tried it. The reason that this cannot happen is that you cannot compile more than two cBots in the same dll. As a result, each cBot exists in a different dll and they cannot share variables between them. If you need to share information between cBots maybe you can consider reading and writing to a file accessible by both. Let me know if this suggestion helps.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Sep 2017, 10:00
Hi GammaQuant,
It is not possible to share static variables between cBots. Where have you seen this? Do you mind sharing a link? Maybe it was about something else.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Sep 2017, 09:10
Hi Ahmad,
Did you try uninstalling the application and installing it again?
Best Regards,
Panagiotis
@PanagiotisCharalampous