Topics
Replies
PanagiotisCharalampous
27 Mar 2024, 11:18
Hi there,
This is an expected behavior.
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
27 Mar 2024, 08:30
Your code has several amateur issues e.g.
var atr = Indicators.AverageTrueRange(14, MovingAverageType.Exponential);
You are initializing a global variable as a local one. Then when you try to access the global one inside OnbarsBarOpened, you get an exception. Fix your exceptions first and provide a workable cBot so that we can see the logic as well.
@PanagiotisCharalampous
PanagiotisCharalampous
27 Mar 2024, 07:42
Hi there,
You can merge all your accounts under one cTrader ID by asking one of the broker to reassign the account to the cTrader ID you wish.
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
27 Mar 2024, 07:30
Hi there,
Is this a broker account or a Spotware account? Can you share screenshots?
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Mar 2024, 07:08
Hi there,
The dispatch of such statements is configured by the broker. You should get in touch with them again.
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Mar 2024, 07:05
Hi there,
Candles are drawn by bid prices, not by ask prices. You should talk to your broker for more information regarding execution issues.
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Mar 2024, 06:55
Hi there,
Your question is not very clear. Can you elaborate please?
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Mar 2024, 06:53
Hi there,
Your money is held by your broker so only your broker can return them back.
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Mar 2024, 06:53
RE: Ctrader app for FTMO and TopFX not working
VulcanTrader said:
My app is not working after installing the Android OS update on my Pixel 8. Please advice. i don't see any update have these brokers been advised to add an update to the Play Store?
The update is only released for cTrader cross broker application at the moment. Use that one instead
@PanagiotisCharalampous
PanagiotisCharalampous
26 Mar 2024, 06:52
Hi Joel,
No it is not possible. But you could develop a cBot that would do this for you.
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Mar 2024, 06:48
RE: RE: Add a "Label" and a "Comment" in the Trading Panel code
Obiriec said:
PanagiotisCharalampous said:
Hi there,
This happens because you do not acquire the text box value anywhere. See below
var stopLossPips = GetValueFromInput(StopLossInputKey, 0); var takeProfitPips = GetValueFromInput(TakeProfitInputKey, 0); string label = LabelImputKey; string comment = CommentImputKey;
You acquire the sl and tp from the text boxes but you use the default label and comment.
Best regards,
Panagiotis
Good morning, I certainly misunderstood.
How should I correct the code so that the text that is written in the on-screen panel box is then used to be written in the label or comment when a position is opened?
Now it only works well if the text is written in the parameters window.
I need the insertion to become interactive even when the panel is on the screen, that is, when the cBot is in the start state.
Thank you and I hope I have been able to explain myself better.
Best regard,
Armando
Hi Armando,
I cannot write the code for you but the way stop loss and take profit are obtained can be used as guidance on developing this feature further
var stopLossPips = GetValueFromInput(StopLossInputKey, 0);
var takeProfitPips = GetValueFromInput(TakeProfitInputKey, 0);
@PanagiotisCharalampous
PanagiotisCharalampous
26 Mar 2024, 06:44
Hi there,
What exactly is not working? What do you expect to happen and what happens instead?
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Mar 2024, 06:42
RE: RE: RE: RE: Sell Stop order position closed with stop loss higher than intended
nubfight said:
PanagiotisCharalampous said:
nubfight said:
PanagiotisCharalampous said:
Hi there,
You seem to set the stop loss and take profit in relative prices, while they should be set in pips e.g.
PlaceStopOrder(TradeType.Sell, SymbolName, ncontracts, entryPrice, "", SellStopLossAfterPips, SellTakeProfitAfterPips, expiry);
Best regards,
Panagiotis
Hi I forgot to reply to this but I tried using this but it's giving the same results. I also have been setting it in pips rather than relative prices before already
Well what you have provided above is evidently wrong. If you fix the code, try it again and you still have issues, feel free to repost it and we can have a look
Hi there! I double checked my code and parameters and I don't think I am placing it in their relative prices but pips instead, I'll leave the code below along with the parameters I placed
using System;using System.Linq;using cAlgo.API;using cAlgo.API.Indicators;using cAlgo.API.Internals;using cAlgo.Indicators;using System.Collections.Generic;namespace cAlgo.indicators{ [Robot(TimeZone = TimeZones.CentralPacificStandardTime, AccessRights = AccessRights.None)] public class Chasm : Robot { string version_number = "1.0"; // Declarations private int currenthour; private int currentminute; private string stringdate; private bool is_position_open; private string scenario; private double today_open; private double today_high; private double today_low; private double bid_price; private double ask_price; private double yesterday_close; private double yesterday_high; private double yesterday_low; private int kindex; [Parameter("N. Contracts", DefaultValue = 1, MinValue = 0)] public int ncontracts { get; set; } // Additional parameters [Parameter("Order Time (HH:mm)", DefaultValue = "01:28")] public string orderTime { get; set; } [Parameter("Order Expiry (Minutes)", DefaultValue = 2, MinValue = 1)] public double orderTimer { get; set; } [Parameter("Stop Loss Distance (Pips)", DefaultValue = 15, MinValue = 0, Group = "Buy Order Settings")] public double BuyStopLossAfterPips { get; set; } [Parameter("Take Profit (Pips)", DefaultValue = 40, MinValue = 0, Group = "Buy Order Settings")] public double BuyTakeProfitAfterPips { get; set; } [Parameter("Stop Loss Distance (Pips)", DefaultValue = 15, MinValue = 0, Group = "Sell Order Settings")] public double SellStopLossAfterPips { get; set; } [Parameter("Take Profit (Pips)", DefaultValue = 40, MinValue = 0, Group = "Sell Order Settings")] public double SellTakeProfitAfterPips { get; set; } protected override void OnStart() { is_position_open = false; kindex = 0; Positions.Closed += PositionsOnClosed; Print("Chasm {0} Started", version_number); Print("Server time is {0}", Server.Time.AddHours(0)); Timer.Start(60); } protected override void OnBar() { kindex = Bars.ClosePrices.Count - 1; today_open = Bars.OpenPrices[kindex]; yesterday_close = Bars.ClosePrices[kindex - 1]; yesterday_high = Bars.HighPrices[kindex - 1]; yesterday_low = Bars.LowPrices[kindex - 1]; if (today_open > yesterday_close) scenario = "GAPUP"; else if (today_open < yesterday_close) scenario = "GAPDOWN"; else scenario = null; } protected override void OnTimer() { today_high = Bars.HighPrices[kindex]; today_low = Bars.LowPrices[kindex]; // Time Vars stringdate = Server.Time.ToString("HH:mm"); currenthour = int.Parse(stringdate.Substring(0, 2)); currenthour = Convert.ToInt32(stringdate.Substring(0, 2)); currentminute = int.Parse(stringdate.Substring(3, 2)); currentminute = Convert.ToInt32(stringdate.Substring(3, 2)); bid_price = Symbol.Bid; ask_price = Symbol.Ask; if (scenario != null) { if (stringdate.Equals(orderTime)) ExecuteOrder(); } } protected override void OnStop() { Print("Chasm Stopped"); } private void PositionsOnClosed(PositionClosedEventArgs args) { var pos = args.Position; Print("Position closed with €{0} profit", pos.GrossProfit); is_position_open = false; } private void ExecuteOrder() { if (is_position_open) return; double lastLowPrice = Bars.LowPrices.Last(1); double lastHighPrice = Bars.HighPrices.Last(1); DateTime expiry = Server.Time.AddMinutes(orderTimer); var entryPrice = lastLowPrice; TradeResult sellResult = PlaceStopOrder(TradeType.Sell, SymbolName, ncontracts, entryPrice, "", SellStopLossAfterPips, SellTakeProfitAfterPips, expiry); if (sellResult.IsSuccessful) Print("Sell Stop Order placed at: " + entryPrice); else Print("Failed to place Sell Stop Order: " + sellResult.Error); entryPrice = lastHighPrice; TradeResult buyResult = PlaceStopOrder(TradeType.Buy, SymbolName, ncontracts, entryPrice, "", BuyStopLossAfterPips, BuyTakeProfitAfterPips, expiry); if (buyResult.IsSuccessful) Print("Buy Stop Order placed at: " + entryPrice); else Print("Failed to place Buy Stop Order: " + buyResult.Error); is_position_open = true; } }}
Can you tell us your broker as well?
@PanagiotisCharalampous
PanagiotisCharalampous
26 Mar 2024, 06:37
Hi there,
You can find some brokers here
https://www.spotware.com/featured-ctrader-brokers
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
26 Mar 2024, 06:36
Hi there,
If you need to run two different cBots on two different accounts, you need to have two instances open.
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
25 Mar 2024, 08:40
RE: RE: About prices used in real-time SMA
bolatfx said:
PanagiotisCharalampous said:
Hi there,
It uses the last x prices defined by the MA period including the current one.
Best regards,
Panagiotis
thank you. I use the closing price of the candlestick for SMA calculation, but in real time, the candlestick is not completed yet. What should I use instead of the closing price in such a case?
The current bid price
@PanagiotisCharalampous
PanagiotisCharalampous
25 Mar 2024, 07:38
RE: RE: Sell Stop order position closed with stop loss higher than intended
nubfight said:
PanagiotisCharalampous said:
Hi there,
You seem to set the stop loss and take profit in relative prices, while they should be set in pips e.g.
PlaceStopOrder(TradeType.Sell, SymbolName, ncontracts, entryPrice, "", SellStopLossAfterPips, SellTakeProfitAfterPips, expiry);
Best regards,
Panagiotis
Hi I forgot to reply to this but I tried using this but it's giving the same results. I also have been setting it in pips rather than relative prices before already
Well what you have provided above is evidently wrong. If you fix the code, try it again and you still have issues, feel free to repost it and we can have a look
@PanagiotisCharalampous
PanagiotisCharalampous
25 Mar 2024, 07:34
RE: Why the statement no longer have the save option?
kepsta_123 said:
This feature was definitely in the Web based version as I used it a lot and it was extremally useful.
Is there an easy way to convert the statements as printed now into csv format ?
Hi there,
It's a bug and will be fixed soon.
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
25 Mar 2024, 07:31
Hi there,
It uses the last x prices defined by the MA period including the current one.
Best regards,
Panagiotis
@PanagiotisCharalampous
PanagiotisCharalampous
27 Mar 2024, 11:19
Hi there,
Cancelled orders are not available via the API unfortunately.
Best regards,
Panagiotis
@PanagiotisCharalampous