Topics
Replies
ncel01
23 Nov 2024, 18:33
( Updated at: 25 Nov 2024, 06:26 )
Dear firemyst,
What did you not understand from my previous reply ?
I welcome every suggestion, however, the way you try to impose your own “solutions” on every case, regardless of its specifics, is just annoying. And this is not the first time.
Is it so hard to accept the evidence? Or a “NO”?
Tip: I suggest that you keep any “hammered” solutions to your projects instead.
I must also say that I have no time to spend on endless/pointless conversations.
So, if, from now on, you can refrain from comment any of my threads that would be appreciated :)
Thanks for your understanding.
You're initial post only referred to “balance”, not “equity”.
Really? My initial post or your reply to it?
I guess you're a bit confused here.
An account balance either increases in funds available, or decreases. Those could be caused by transfers, positions being closed, or something else. But at the end of the day, an account balance is either going to “increase” or “decrease”, either from funds being deposited into the account, or withdrawn from the account.
Thanks for the lesson. I feel much more educated in finance now :)
Also, an “end of the day” solution does not fit my needs. Thanks for your understanding.
So genuinely asking, what else is “balance” affected by in your situation?
That's not relevant since, as I said, an “end of the day” solution does not fit my needs.
I haven't assumed a cbot has to be running when a deposit/withdrawal takes place.
No, you just provided a piece of code, to “catch” any possible deposits/withdrawals, which will (obviously) only work if a cBot is running.
However, your initial post said you need to access the information via API. Code can only access an API when code is executed. Now, since your post is in the “calgo” forum, which is primarily for bots/indicators/plugins, even by Spotware's own definition: “cTrader Algo is an all-in-one solution that gives users the opportunity to use various automated trading tools including custom indicators, cBots and plugins.”
Couple that with the fact an API can only be access when code is executed, …. that's the reasoning. Whether it's a bot running, or even something simple like dragging/dropping an object on the screen, code has to be executed for an API to be accessed.
If it's for another reason not related to a bot/indicator/plugin, like you're creating your own trading interface or application, or calling a web service or something else, then perhaps you should have posted in either the “Fix API” or “Open API” forums?
Do you want to add something else here, maybe? What about being pragmatic?
I never said I wanted a solution not involving cBots. What I don't want is a “solution” that can be only achieved if/while a cBot is running. Can't you really understand the difference?
I suggest that you read my previous reply, again.
I would suggest putting these into the “Suggestions” forum if you want to see Spotware possibly implement them in the future.
I've already suggested for this, together with some other missing account properties:
https://ctrader.com/forum/suggestions/44392/#post-111643
@ncel01
ncel01
21 Nov 2024, 13:45
RE: RE: RE: Deposits-withdrawals collections / events
firemyst said:
ncel01 said:
Because I want to be able calculate balance/equity drawdown within certain time frames.
How do you calculate this without any information on the cash flow?
You check the account balance. Set up your own timer event, and check every x minutes/hours.
Or on every tick or like every 3rd tick that comes in.
And program your bot/indicator to only check within the time frames you want to check.
You have your current account balance. Next time you check, if it increase you know how much came in; if it decreases you know how much went out. That would be your cash flow.
So if your account balance is $10k, and in 3 ticks it's $10.5k, you know $500 came in. What's the difference between that and having a “Deposit event” that was triggered with $500?
//Class variabledouble _previousAccountBalance = Account.Balance;//in onTick or whenever, call a method to check your balanceCheckMyBalance();//basic structure for methodprivate void CheckMyBalance(){if (Account.Balance > _previousAccountBalance){ ///a deposit came in //do what you need to //taking into account whether or not a position was closed}else if (Account.Balance < _previousAccountBalance){ ///a withdrawal happened //do what you need to //taking into account whether or not a position was closed}}
I also have my own workaround for this.
Workarounds can be done for a lot of situations, which does not mean that certain basic features/properties should not be made available.
It is not that straight forward in my case.
- Balance/equity are not only affected by deposit/withdrawals.
- Why do you assume that a cBot is running when a deposit/withdrawal takes place?
- How to get this info when starting a cBot? Should I store this info in a file?
My workaround:
Comparing the sum of gross P&L for all the closed deals and current P&L with the equity. However, the previous deposit/withdrawal balance is still required as an input.
There's always some kind workaround possible, the question is, why tring to kill an ant with a cannon?
Moreover, withdrawal and deposits are basic properties of an account. It shouldn't be necessary to convince anyone about this.
@ncel01
ncel01
21 Nov 2024, 11:39
RE: Deposits-withdrawals collections / events
firemyst said:
Why not just use the Account.Balance property?
That will have your updated balance which you can use to calculate for risk management purposes, because you'll only be allowed to base your risk management on whatever's in your account anyway.
Because I want to be able calculate balance/equity drawdown within certain time frames.
How do you calculate this without any information on the cash flow?
I believe that, at this time, this information should be already accessible via API. After all, this is basic information about any account (trading or not).
Can you think of any account where this information is not available/accessible? I don't.
@ncel01
ncel01
31 Oct 2024, 07:43
RE: RE: Improvements to memory usage observed
PanagiotisCharalampous said:
ncel01 said:
Hello,
To be fair, it looks to me that a lot of progress has been made here lately :
The RAM usage in time seems to be much more stable, even with cBots running. I am now able to keep cTrader open for weeks without noticing any relevant increase in memory usage.
Although there is always room for refinements, the improvements are clear.
@Panagiotis
Do you confirm that significant improvements to memory management have been performed lately?
Please always be mindful of any memory leaks when adding new features/tools, as this is crucial for the overall platform stability.
Hi ncel01,
We do performance improvements on almost every update
Hi Panagiotis,
I mean major improvements, as this seems to me to be the case. I'd just like to be aware.
@ncel01
ncel01
30 Oct 2024, 10:59
Improvements to memory usage observed
Hello,
To be fair, it looks to me that a lot of progress has been made here lately :
The RAM usage in time seems to be much more stable, even with cBots running. I am now able to keep cTrader open for weeks without noticing any relevant increase in memory usage.
Although there is always room for refinements, the improvements are clear.
@Panagiotis
Do you confirm that significant improvements to memory management have been performed lately?
Please always be mindful of any memory leaks when adding new features/tools, as this is crucial for the overall platform stability.
@ncel01
ncel01
22 Oct 2024, 07:15
RE: RE: RE: RE: Brokers
PanagiotisCharalampous said:
ncel01 said:
PanagiotisCharalampous said:
ncel01 said:
Hi there,
Some remark:
Although TopFX is still marked as offering cTrader Copy, this broker have already discontinued this service almost 4 months ago.As far as I know they still offer the service through their non EU entity, same as IC Markets and FxPro
I see.
However, in my opinion, since this is a half-truth it should be made clear.
It's not our job to do such clarifications. The specified brokers are full members of the service. It's them who need to clarify for which of their clients the service is available or not.
Panagiotis,
I can also understand your point.
@ncel01
ncel01
21 Oct 2024, 09:43
( Updated at: 21 Oct 2024, 10:00 )
RE: RE: Brokers
PanagiotisCharalampous said:
ncel01 said:
Hi there,
Some remark:
Although TopFX is still marked as offering cTrader Copy, this broker have already discontinued this service almost 4 months ago.As far as I know they still offer the service through their non EU entity, same as IC Markets and FxPro
I see.
However, in my opinion, since this is a half-truth it should be made clear.
@ncel01
ncel01
14 Oct 2024, 08:29
RE: RE: RE: RE: RE: Positions.Count is returning 0 inside Positions_Opened()
PanagiotisCharalampous said:
ncel01 said:
PanagiotisCharalampous said:
ncel01 said:
PanagiotisCharalampous said:
Hi there,
Unfortunately we were not able to reproduce the problem. Positions amount shows correctly for us
Best regards,
Panagiotis
Panagiotis,
Can you please check this under the same conditions (broker, symbol, etc) ?
This way you'll be (obviously) more likely to be able to reproduce the issue.
Remark: It has been already noticed in the past that many issues that applied to indices were not applicable to forex.
Thanks.
We did but with no luck unfortunately. We will keep it in mind though in case we stumble upon it in any other occasion
Panagiotis,
I really don't understand how you're not able to reproduce this issue.Try the following backtest settings and let me know.
Using the exact same cBot code and backtest settings I can't expect anything else than the same outcome.Hi there,
We finally managed to reproduce it, thanks.
Best regards,
Panagiotis
Hi Panagiotis,
I am glad you did it. You're welcome!
@ncel01
ncel01
13 Oct 2024, 16:44
( Updated at: 14 Oct 2024, 05:07 )
I don't really get why this is taking so long to be fixed.
Although this has been communicated as solved already 3 month ago (here below), the issue still remains:
https://ctrader.com/forum/announcements/44366/
@ncel01
ncel01
13 Oct 2024, 16:34
RE: RE: RE: Positions.Count is returning 0 inside Positions_Opened()
PanagiotisCharalampous said:
ncel01 said:
PanagiotisCharalampous said:
Hi there,
Unfortunately we were not able to reproduce the problem. Positions amount shows correctly for us
Best regards,
Panagiotis
Panagiotis,
Can you please check this under the same conditions (broker, symbol, etc) ?
This way you'll be (obviously) more likely to be able to reproduce the issue.
Remark: It has been already noticed in the past that many issues that applied to indices were not applicable to forex.
Thanks.
We did but with no luck unfortunately. We will keep it in mind though in case we stumble upon it in any other occasion
Panagiotis,
I really don't understand how you're not able to reproduce this issue.
Try the following backtest settings and let me know.
Using the exact same cBot code and backtest settings I can't expect anything else than the same outcome.
@ncel01
ncel01
26 Sep 2024, 05:31
RE: Positions.Count is returning 0 inside Positions_Opened()
PanagiotisCharalampous said:
Hi there,
Unfortunately we were not able to reproduce the problem. Positions amount shows correctly for us
Best regards,
Panagiotis
Panagiotis,
Can you please check this under the same conditions (broker, symbol, etc) ?
This way you'll be (obviously) more likely to be able to reproduce the issue.
Remark: It has been already noticed in the past that many issues that applied to indices were not applicable to forex.
Thanks.
@ncel01
ncel01
25 Sep 2024, 19:33
( Updated at: 26 Sep 2024, 05:02 )
This seems to be the opposite of what I reported below and it can be somehow related.
In my case, both Positions.Count and Account.Margin return 0 inside Positions_Opened().
So far I didn't get any feedback regarding this.
https://ctrader.com/forum/ctrader-algo/44773/
@ncel01
ncel01
24 Aug 2024, 18:24
RE: Defining conditions for an order to be filled
PanagiotisCharalampous said:
Hi ncel01,
You guessed right, this is not possible. We are not considering this either, since in the majority of cases, this need can be covered by cTrader Algo.
Best regards,
Panagiotis
Hi Panagiotis,
Thanks for clarifying.
Unlike spreads, I agree that such feature could be a bit redundant for the remaining account/symbol properties mentioned, due to the following:
- These can be checked as often as needed (OnTick())
- The process of filling out orders and closing positions is not directly depending on these
However, spread has a direct impact on filing pending orders and closing positions (with a harmful effect on the SL side).
This impact can be particularly negative when considering sudden spikes in spreads and cannot be avoided via cAlgo (on the cBot side), unless some instruction is stored on the server. Am I right?
I understand that spreads can be checked before placing market orders which will mitigate the risk, however, I don't really see how this can be achieved when it comes to pending orders and open positions.
@ncel01
ncel01
24 Aug 2024, 17:31
RE: RE: RE: RE: RE: RE: RE: RE: Account.Margin not correct : Unacceptable
PanagiotisCharalampous said:
ncel01 said:
PanagiotisCharalampous said:
ncel01 said:
PanagiotisCharalampous said:
ncel01 said:
PanagiotisCharalampous said:
ncel01 said:
?
This issue has been fixed, it's been a while. I cannot reproduce it. Make sure you download historical data when you backtest.
Hi Panagiotis,
The values I get for the account margin are still not matching while backtesting the code above.
Are you backtesting an index? Probably not.I selected the historical data, as suggested.
However, the account and symbol currency is the same (USD) and still I am getting different results when selecting/unselecting this option. Why?
I checked this with both Varianse and Pepperstone (using historial data).
Below is the backtest output with Varianse.Hi ncel01,
Yes I do
However, the account and symbol currency is the same (USD) and still I am getting different results when selecting/unselecting this option. Why?
The functionality should work correctly when the option is checked. We are checking why it is not working when unselected and the quote currency matches the account currency. In the meanwhile, keep it checked.
Panagiotis,
The functionality should work correctly when the option is checked.
How come, when my screenshot clearly shows that Account.Margin is returning 0 even with an open position?
Did you check this with some other accounts/brokers (apart from Spotware)? If not, can you please double-check this?
Thanks.Hi ncel01,
It works fine on Variance as well.
Please send a full screenshot like the above, so that we can understand what you are doing
Hi Panagiotis,
Thanks for looking into this again. I meant an account with a different broker, not exactly the broker version of cTrader.
So far, I found that Account.Margin is not correct in the following cases (at least):
- Example 1: Any live account (tested with Pepperstone and TopFX)
- Example 2: New demo accounts (without trading activity) where Symbol Leverage > Account Leverage (tested with Varianse)
I've added a screenshot for each of these examples (see below). I am running the cBot shared above (historical data is checked).
Note that, regardless of what leverage is considered (symbol/account), the calculated account margin does not match Account.Margin in any of the cases shown.Something is clearly not going as expected here.
The results show that there is not a unique/consistent calculation for Account.Margin, no matter the situation.Example 1:
Example 2:
Something else I noticed in the meantime that I also don't understand: Positions.Count is returning 0 while called inside Positions_Opened().
See below.Hi ncel01,
As far as I can see, in all the cases with discrepancy, your account currency is different to the symbol currency, however your calculations do not include any conversion logic. The API's property converts the margin to the account's currency value. The XTE issue seems a separate issue, can you report it in a different thread?
Best regards,
Panagiotis
Hi Panagiotis,
You're completely right, I messed it up. Please disregard the examples 1 and 2 above!
My apologies for the hassle!
Regarding Positions.Count = 0, I'll create a new post, as suggested.
I believe this can be related to my screenshot above, where Positions.Count = 1, while Account.Margin = 0. However, on that example, I was using a Varianse account.
Unfortunately, I am no longer able to reproduce that issue again.
Thank you once gain!
@ncel01
ncel01
21 Aug 2024, 17:50
RE: RE: cTrader Desktop 5.0.28 Release Notes
PanagiotisCharalampous said:
ncel01 said:
Given the absence of any clarifications, I will assume that the following has been announced by mistake:
The following issues were addressed
- Wrong Account.BrokerName and Account.Number for a bot with cloud instance
Hi ncel01,
Sorry for the delay, I had to do some research for this, it seems this has not been delivered yet. It's fixed on the cAlgo side but the server team needs to do some work as well.
Best regards,
Panagiotis
Hi Panagiotis,
No worries. Thanks for informing!
@ncel01
ncel01
21 Aug 2024, 17:49
RE: RE: RE: RE: RE: RE: Account.Margin not correct : Unacceptable
PanagiotisCharalampous said:
ncel01 said:
PanagiotisCharalampous said:
ncel01 said:
PanagiotisCharalampous said:
ncel01 said:
?
This issue has been fixed, it's been a while. I cannot reproduce it. Make sure you download historical data when you backtest.
Hi Panagiotis,
The values I get for the account margin are still not matching while backtesting the code above.
Are you backtesting an index? Probably not.I selected the historical data, as suggested.
However, the account and symbol currency is the same (USD) and still I am getting different results when selecting/unselecting this option. Why?
I checked this with both Varianse and Pepperstone (using historial data).
Below is the backtest output with Varianse.Hi ncel01,
Yes I do
However, the account and symbol currency is the same (USD) and still I am getting different results when selecting/unselecting this option. Why?
The functionality should work correctly when the option is checked. We are checking why it is not working when unselected and the quote currency matches the account currency. In the meanwhile, keep it checked.
Panagiotis,
The functionality should work correctly when the option is checked.
How come, when my screenshot clearly shows that Account.Margin is returning 0 even with an open position?
Did you check this with some other accounts/brokers (apart from Spotware)? If not, can you please double-check this?
Thanks.Hi ncel01,
It works fine on Variance as well.
Please send a full screenshot like the above, so that we can understand what you are doing
Hi Panagiotis,
Thanks for looking into this again. I meant an account with a different broker, not exactly the broker version of cTrader.
So far, I found that Account.Margin is not correct in the following cases (at least):
- Example 1: Any live account (tested with Pepperstone and TopFX)
- Example 2: New demo accounts (without trading activity) where Symbol Leverage > Account Leverage (tested with Varianse)
I've added a screenshot for each of these examples (see below). I am running the cBot shared above (historical data is checked).
Note that, regardless of what leverage is considered (symbol/account), the calculated account margin does not match Account.Margin in any of the cases shown.
Something is clearly not going as expected here.
The results show that there is not a unique/consistent calculation for Account.Margin, no matter the situation.
Example 1:
Example 2:
Something else I noticed in the meantime that I also don't understand: Positions.Count is returning 0 while called inside Positions_Opened().
See below.
@ncel01
ncel01
25 Nov 2024, 12:53 ( Updated at: 25 Nov 2024, 12:55 )
RE: RE: Deposits-withdrawals collections / events
firemyst said:
Hi again :)
It looks to me that you're making a mountain out of a molehill.
I think that you're handicapping yourself by not accepting the evidence.
Again, I welcome every suggestion. Just try not to impose you own solutions at any cost.
My original post is very explicit as it clearly states all the features/properties I need to achieve a feasible solution in my case.
As you can imagine, I don't have any formula to “shield” my posts against all kinds of (mis)interpretations.
Should I write a book? Or make a picture out of it, maybe?
Your replies are quite extensive but they don't say a lot. In fact, I still don't know what of the following situations apply.
Can you please clarify so that I can reply accordingly, making it even more clear?
2.1. You agree.
2.2. You do not agree (please specify exactly why)
2.3. Other (please specify)
Thanks for clarifying the above.
I am (definitely) not into useless/endless conversations and this one is already going to long.
@ncel01