Topics
Replies
cindyarhodia
04 Jul 2024, 21:25
RE: Relevance of Symbol.MinCommissionType
Hi hi,
Thank you for enlightening me.
I understand it's supposed to add ease of use and improve understanding of developers, but the opposite happened to me when I saw this property in the symbol namespace. It confused me more than anything else. Having said that, I'm not really a dev, so maybe my thinking process isn't the most logical.
Here is why :
First of all, it's named “Type” so I was expecting something related to CommissionType (which is kinda stupid since, of course, MinimumCommission can only be a fixed amount, when we think about it).
Secondly, I agree that commission fees are a big part of trading, and must be included in every strategy, if not then risk management will be flawed. It's even more true for scalpers with a tight SL but plays a role for swingers too. Either way, I assume everyone will compare and convert MinCommissionAsset to Account.Asset if they are different, independently of MinCommissionType.
About quicker comparative check and enhanced clarity, it returns a specific type value (SymbolMinCommissionType), which is unique for this property. No casting is possible so the only way I can think of to use it is :
if (symbol.MinCommissionType == SymbolMinCommissionType.QuoteAsset) { minCommInAccAsset = MinimumCommission / accountAssetToQuoteAssetRate }
else { minCommInAccAsset = MinimumCommission / accountAssetToMinimumCommissionAssetRate }
Whereas without accessing that property we can directly do :
if (symbol.MinCommissionAsset != Account.Asset) { minCommInAccAsset = MinimumCommission / accountAssetToMinimumCommissionAssetRate }
Actually we don't even need to compare anything, since if both Assets are the same, Rate will equal to 1, so we can divide anyway. The second case is more clear (to me, at least)
I'm assuming you have some statistics about how frequently a property is accessed and I guess some people use it. Developers that implemented that specific property had probably good reasons to do so, but in my eyes it's not useful at all (again, I'm not flaming, just sharing my feedback)
On another note, not really related but since I talked about rates, the Asset.Convert method is rounding a lot (!) I find it a bit meh (although not exactly disturbing) that to get precision we need to do something alike :
double amount = 1000000000;
double accToUsdRate = Account.Asset.Convert("USD", amount) / amount
Not doing that with an account where asset is JPY (for example) will return a rate equals to 0 (if amount = 1, hence skipping the division), instead of 0,00619974333 currently.
Thank you for all the work you put in, and the time you take to answer people on the forum. I hope I'm not annoying you with my explanations <3
I'm not waiting for any answer to this post but you're more than welcome if you want to discuss about it :)
Sea yah!
@cindyarhodia
cindyarhodia
24 Jun 2024, 19:25
Do you know any broker that offers demo account that got some assets where the commission type is quote currency per one lot? I'm desperately looking for that to ensure my functions are working in that precise case, I already tried TopFX, Blackbull Markets, FP Markets, Pepperstone and Purple Trading, but unfortunately no one of those got an asset charged that way.
Tyvm !
@cindyarhodia
cindyarhodia
20 Jun 2024, 19:08
Kinda agree with that, a TextBox.KeyPress event would be lovely.
@cindyarhodia
cindyarhodia
20 Jun 2024, 19:08
Kinda agree with that, a TextBox.KeyPress event would be lovely.
@cindyarhodia
cindyarhodia
17 Jun 2024, 08:39
( Updated at: 17 Jun 2024, 10:07 )
Aye, thanks for the fast reply.
I'll do my best, prob can find some base formulas online somewhere. Not the priority right now so no rush. I'm developing a trade assistant, first time I do some c# and I like it so far!
Sea yah!
@cindyarhodia
cindyarhodia
10 Jul 2024, 22:22
RE: Minor issues with TextBox Style
Thank you, you the boss!
What about the SelectionStart property, any chance your team will implement it ? I managed to solve my initial problem using a lock + countdown to prevent the ObjectsUpdated event from firing when user is typing in a TextBox, but I now face a similar issue (aka the caret is jumping in front of the chars when typing).
I made a simple ValidateInput(TextBox) method to ensure the value entered in a TextBox matches some parameters: only one ‘.’ is allowed, max amount of decimal digits equals symbol.Digits, and append a ‘0’ if string starts with a ‘.’ I'm using this inside the TextChanged event handler. The method works fine, except the caret is jumping to the left if we append a ‘0’ or if the amount of decimal digits is too big. Since the text gets set in every case, I assume it really gets updated only if there is a difference between original text and filtered text, right? Here is the code, self-explanatory I believe :
private void ValidateInput(TextBox textBox)
{
string text = textBox.Text;
bool decimalPointFound = false;
int decimalDigits = 0;
StringBuilder filteredText = new();
foreach (char c in text) {
if (char.IsDigit(c)) {
if (decimalPointFound && decimalDigits < _symbol.Digits) {
filteredText.Append(c);
decimalDigits++;
} else if (!decimalPointFound) {
filteredText.Append(c);
}
} else if (c == '.' && !decimalPointFound) {
if (filteredText.Length == 0) {
filteredText.Append(0);
}
filteredText.Append(c);
decimalPointFound = true;
}
}
textBox.Text = filteredText.ToString();
textBox.SelectionStart = filteredText.Length; // Would be nice to be able to do that, effectively setting the caret position to end of text
}
Tyty, sea yah !
@cindyarhodia