Topics
Replies
PanagiotisCharalampous
22 Nov 2017, 16:19
Hi Andrew,
There will be the "INSTANT" message only if Dealing Desk is ON. Otherwise, like all cTrader brokers currently, no message will appear.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Nov 2017, 16:13
Dear lindollfonetto,
Thanks for posting in our forum and reporting the issue you face. It seems that you are trying to link your cTID with an account using cMirror? Maybe you can contact your broker to help you do that.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Nov 2017, 16:08
Hi andi21,
Thanks for your suggestion. However in one chart you can have more than one positions, in the case of a hedging account. How do you imagine it to work in this case?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Nov 2017, 15:56
Hi der.timosch,
Thanks for informing us about this issue. Can you please send some troubleshooting information when this happens so that our quality assurance team get the information required to be able to locate the problem? You can do this by pressing Ctrl + Alt + Shift + T when in cAlgo and submitting the form that pops up. In the text area, please put the link to this thread.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Nov 2017, 11:35
Hi khan_tu,
Can you please give us some more information why you say that your algorithm is "currently not doing so"? Is it because it stops executing for any reason? A code sample of a complete cBot would be more helpful to understand what could go wrong.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Nov 2017, 11:25
Hi hungtonydang,
The Server Time will always return the time based on the timezone set for the cBot. In the case you described above, it will be Tasmania Standard Time.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
22 Nov 2017, 11:17
Hi armstr.tradie,
You have placed the check in the wrong place. See the full source code for the cBot below
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot()] public class RENKO : Robot { //################################################## - Bot Label - ################################################## [Parameter(DefaultValue = "Abot")] public string Label { get; set; } //################################################## - RENKO details - ############################################# [Parameter(DefaultValue = 250)] public double RenkoPips { get; set; } //public double RenkoPips = 50; public int BricksToShow = 10000; private Renko renko; //################################################## - Other parameters - ############################################# [Parameter(DefaultValue = 1000)] public int Volume { get; set; } [Parameter("Take Profit (pips)", DefaultValue = 2000)] public double TakeProfit { get; set; } [Parameter("Stop Loss (pips)", DefaultValue = 1000)] public double StopLoss { get; set; } //################################################## - Dynamic stops - ############################################# [Parameter("Break Even Trigger", DefaultValue = 200)] public double SL1Trigger { get; set; } [Parameter("Break Even", DefaultValue = 25)] public double SL1 { get; set; } [Parameter("Trailing Stop Trigger", DefaultValue = 1000)] public double SL2Trigger { get; set; } [Parameter("Trailing Stop Level", DefaultValue = 500)] public double SL2 { get; set; } //################################################## - Buy/Sell range - ############################################# // Sets the level at which pending trades are separated from one another. [Parameter("Order Price Level", DefaultValue = 100)] public double TP1 { get; set; } // How many orders to be made when the bot runs. [Parameter("Number of Orders", DefaultValue = 31)] public int HowMuchPositions { get; set; } // Option to possible have multiple orders at the same level. [Parameter("Multiply Orders x ...", DefaultValue = 1)] public double MaxPendingOrders { get; set; } // Option designed to stop double-up of trades near a similar price level. [Parameter("Minimum Trade Separation", DefaultValue = 90)] public double MinPipDistance { get; set; } //################################################## - OnStart - ################################################## protected override void OnStart() { renko = Indicators.GetIndicator<Renko>(RenkoPips, BricksToShow, 3, "SeaGreen", "Tomato"); } //################################################## - OnTick - ################################################## protected override void OnTick() { BuyAndSell(); BreakEven(); TrailingStop(); PositionExistsBuy(); PositionExistsSell(); } //################################################## - Buy & Sell Details - ################################################## protected void BuyAndSell() { double rClose = renko.Close.Last(0); double rOpen = renko.Open.Last(0); double Close = MarketSeries.Close.Last(0); double Open = MarketSeries.Open.Last(0); var MaxOrders = PendingOrders.Count < MaxPendingOrders; // Setup pending BUY if (Close > rOpen) { ClosePendingSell(); if (MaxOrders) { for (double i = 1; i < HowMuchPositions; i++) { PlaceStopOrder(TradeType.Buy, Symbol, Volume, rOpen + TP1 * i * Symbol.PipSize, Label, StopLoss, TakeProfit); } } } // Setup pending SELL else if (Close < rOpen) { ClosePendingBuy(); if (MaxOrders) { for (double j = 1; j < HowMuchPositions; j++) { PlaceStopOrder(TradeType.Sell, Symbol, Volume, rOpen - TP1 * j * Symbol.PipSize, Label, StopLoss, TakeProfit); } } } } //################################################## - Pending Order Close Logic - ################################################## protected void ClosePendingSell() { foreach (var order in PendingOrders) { if (order.TradeType == TradeType.Sell) CancelPendingOrderAsync(order); } } protected void ClosePendingBuy() { foreach (var order in PendingOrders) { if (order.TradeType == TradeType.Buy) CancelPendingOrderAsync(order); } } //################################################## - Removal of trade double up logic - ################################################## protected void PositionExistsBuy() { var longPosition = Positions.Find(Label, Symbol, TradeType.Buy); if (longPosition != null) { var MinBuyDistance = longPosition.EntryPrice + MinPipDistance * Symbol.PipSize; foreach (var order in PendingOrders) { if (order.TradeType == TradeType.Buy) { //var pipDistance = Math.Abs((order.TargetPrice + longPosition.EntryPrice) / Symbol.PipValue); if (order.TargetPrice < MinPipDistance) { CancelPendingOrder(order); } } } } } protected void PositionExistsSell() { var shortPosition = Positions.Find(Label, Symbol, TradeType.Sell); if (shortPosition != null) { var MinSellDistance = shortPosition.EntryPrice - MinPipDistance * Symbol.PipSize; foreach (var order in PendingOrders) { if (order.TradeType == TradeType.Sell) { //var pipDistance = Math.Abs((order.TargetPrice - shortPosition.EntryPrice) / Symbol.PipValue); if (order.TargetPrice > MinPipDistance) { CancelPendingOrder(order); } } } } } //################################################## - Stop Loss Details - ################################################## protected void BreakEven() { double rClose = renko.Close.Last(0); double rOpen = renko.Open.Last(0); double Close = MarketSeries.Close.LastValue; var positions = Positions.FindAll(Label); if (positions == null) return; foreach (var position in positions) { if (position.Pips >= SL1Trigger) { if (position.TradeType == TradeType.Buy) { var newStopLoss = position.EntryPrice + SL1 * Symbol.PipSize; if (position.StopLoss < newStopLoss) ModifyPosition(position, newStopLoss, position.TakeProfit); } else if (position.TradeType == TradeType.Sell) { var newStopLoss = position.EntryPrice - SL1 * Symbol.PipSize; if (position.StopLoss > newStopLoss) ModifyPosition(position, newStopLoss, position.TakeProfit); } } } } protected void TrailingStop() { double rClose = renko.Close.Last(0); double rOpen = renko.Open.Last(0); double Close = MarketSeries.Close.LastValue; var positions = Positions.FindAll(Label); if (positions == null) return; foreach (var position in positions) { if (position.Pips >= SL2Trigger) { if (position.TradeType == TradeType.Buy) { var newStopLoss2 = Symbol.Bid - SL2 * Symbol.PipSize; if (position.StopLoss < newStopLoss2) ModifyPosition(position, newStopLoss2, position.TakeProfit); } else if (position.TradeType == TradeType.Sell) { var newStopLoss2 = Symbol.Ask + SL2 * Symbol.PipSize; if (position.StopLoss > newStopLoss2) ModifyPosition(position, newStopLoss2, position.TakeProfit); } } } } } }
I hope this helps!
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Nov 2017, 18:08
( Updated at: 21 Dec 2023, 09:20 )
Hi to all,
Alongside with the new website, we will be releasing soon ctrader.com, our trader-centric community with spotware.com remaining as our corporate site. Indeed, as you noticed, Spotware is releasing a Dealing Desk (DD) add on for its cTrader platform. You all know that cTrader was introduced as a pure STP/ECN/NDD platform (and still is without the DD add on) at times when trading technology was subject to limited control and brokers could manipulate most parts of a trading system. Therefore there was a need for a platform that would guarantee proper order execution without any sort of manipulation.
Throughout these years cTrader and Spotware have educated hundreds of thousands of traders regarding fair trading practices and we believe that we have raised awareness amongst traders while pushing brokers to adapt more transparent practices.
However, as time passes and cTrader transforms from a niche solution to a mainstream trading platform, we need to cover more and more of the needs of the industry. Therefore we are expanding our solution by adding a DD add-on. Nevertheless, what still makes us different is that we do not allow misuse of our product in any way. The platform is hosted and managed by us, interventions are not allowed and all execution information is provided to traders in a transparent manner. This means that you can still be sure that cTrader cannot be mistreated in any way. We have built a brand name and a business around “Traders First” and we are not willing to give up on it. We apply a rigorous approval process on who and how is using cTrader, we are constantly monitoring cTrader platforms for possible misuses and we investigate immediately any suspicion for malicious activity. You should rest assured that will be the case with DD enabled platforms as well.
Regarding the Dealing Desk/Non Dealing Desk distinction, this will be available and traders will know if their broker is using a dealing desk or not. A screenshot is provided below (See INSTANT in the bottom left corner. When this appears it means the broker uses a dealing desk).
I would like to stress here that currently no broker uses this add on, and when this happens this will take place with full transparency.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Nov 2017, 17:07
Hi itmfar,
You can create a property inside the indicator as follows
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace cAlgo { [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewIndicator : Indicator { [Output("Main")] public IndicatorDataSeries Result { get; set; } public bool Test = false; protected override void Initialize() { } public override void Calculate(int index) { if (1 + 1 == 2) Test = true; } } }
and read it it in your cBot like the example 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 NewIndicator newIndicator; protected override void OnStart() { newIndicator = Indicators.GetIndicator<NewIndicator>(); } protected override void OnTick() { var test = newIndicator.Test; protected override void OnStop() { // Put your deinitialization logic here } } }
Let me know if this is what you need.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Nov 2017, 16:42
Dear armstr.tradie,
Your code throws an exception at the following sections
var longPosition = Positions.Find(Label, Symbol, TradeType.Buy); var MinBuyDistance = longPosition.EntryPrice + MinPipDistance * Symbol.PipSize;
var shortPosition = Positions.Find(Label, Symbol, TradeType.Sell); var MinSellDistance = shortPosition.EntryPrice - MinPipDistance * Symbol.PipSize;
In both cases you should check if longPosition/shortPosition are not null before proceeding. Let me know if this helps.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
21 Nov 2017, 11:44
Hi BeardPower,
How comes? Just use the most recent quote for any point in time. Regardless of the aggregation type (ticks or time periods), there is always a most recent quote,
This is not always the case. Let's suppose you are running a backtest on EURGBP using USD account. Profit from GBP needs to be converted to USD. The way that is implemented now is that we take quote for GBPUSD from last backtest date and use it along whole backtesting. We do not make the conversion using the GBPUSD at each given moment since we will need to also download the tick data for that pair as well. So now for convenience we just take an indicative conversion rate and use it all along. However it seems that the current behavior causes confusion, therefore we are planning to change this behaviour.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
20 Nov 2017, 15:34
Hi to all,
This might be related to this issue. Please read my last reply why this is happening. We are looking into how we can improve this behavior.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
20 Nov 2017, 14:55
Hi armstr.tradie,
Unfortunately the information you provide is not enough for us to help you. Could you please provide a complete cBot (it doesn't need to be the original, just one the reproduces the same behavior or error messages)?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
20 Nov 2017, 14:35
Hi myinvestmentsfx,
Please see my reply here.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
20 Nov 2017, 14:34
Dear Trader,
Thanks for your post. If you need professional assistance, you can post a job in our Jobs section or you can contact a professional Consultant.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
20 Nov 2017, 14:31
Hi itmfar,
No this is currently not possible in cTrader.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
20 Nov 2017, 13:55
Hi Hussien,
You can use the Market Snapshot tool. You can find more details here.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
20 Nov 2017, 13:51
Hi jjwes76@gmail.com,
Thanks for your post. If you need professional assistance, you can post a job in our Jobs section or you can contact a professional Consultant.
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
20 Nov 2017, 12:54
Hi patrick.sifneos@gmail.com,
Thanks for posting in our forum and reporting this issue. Can you please post a sample cBot that we could use to reproduce this issue?
Best Regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
23 Nov 2017, 11:12
Hi Louis,
Maybe there was a misunderstanding here in the communication with your broker. Indeed, Spotware cAlgo does not use your broker's feed as each broker has a different feed. However your broker's cAlgo gets the feed of the broker. In your case the discrepancy is not a result of a different feed but due to a cAlgo issue that results to a steady difference in the spread (in your case 0.4 pips). It is the same feed with 0.4 pips difference in the price. In general, this should not affect a lot your cBot's behavior. An idea could be to compensate for the steady difference with additional commission in backtesting settings i.e.+ $40.
In any case, cAlgo team has reviewed the issue and it will be fixed a future release.
Best Regards,
Panagiotis
@PanagiotisCharalampous