You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Sorted it out and fixed. Thank you.
Thanks for the correction, almost good, why almost...
In the helpe it says
start_time [in] The bar time corresponding to the first element.
And the first element is 0.
But the last element is fine.
If this is the way it was intended, please fix the helpe.
Thanks for the correction, almost good, why almost...
In the helpe it says
start_time [in] The bar time corresponding to the first element.
And the first element is 0.
But the last element is fine.
If that's the way it's meant to be, please fix the helpe.
The situation is that start_time and stop_time in date-to-date case can be any - in any case they form a range. Let's try to be more specific about this in the documentation
I.e. are you saying that Copy* functions will in case of date to date return all elements except the starting one? So I need to write the expression like this:
this question is very important to me.
Please note that when you switch to a new day, this is the kind of thing that happens:
After the update, everything falls into place.
Observe the formation of the transition to a new day, I often notice this shift, and the most interesting thing at the moment of formation of the first bar of the next day update chart does not bring results. (I may be wrong, but I think my previous post has something to do with it too).
Bild 252.
Main Menu: <Graphics> -<Graphics INSTRUMENTS> timeframes are displayed.
Unfortunately, the latest version of CAccountInfo did not make it into the build.
In the attached file, you will find the FreeMarginCheck method (so far only for SYMBOL_CALC_MODE_FOREX).
If you have any comments and (or) ideas, please write.
I found, that FreeMarginCheck method needs to be improved.
1. Let's consider the case SYMBOL_CALC_MODE_FOREX:
work=SymbolInfoString(symbol,SYMBOL_CURRENCY_MARGIN)+Currency();
bid=SymbolInfoDouble(work,SYMBOL_BID);
margin=bid*volume*contract_size/leverage;
margin=free_margin;
break;
If the values of the two summands SymbolInfoString(symbol,SYMBOL_CURRENCY_MARGIN) and Currency() turn out to be equal, then the bid variable gets the value 0 and the margin variable gets the value free_margin.
To fix it, I have done the following:
case SYMBOL_CALC_MODE_FOREX:
bid=1.0;
if (SymbolInfoString(symbol,SYMBOL_CURRENCY_MARGIN)!=Currency())
{
work=SymbolInfoString(symbol,SYMBOL_CURRENCY_MARGIN)+Currency();
bid=SymbolInfoDouble(work,SYMBOL_BID);
}
margin=bid*volume*contract_size/leverage;
margin=free_margin;
break;
May I ask when Copy*() functions will work normally?
In every new build they stop working, does no one use them?
Thanks for the correction, almost good, why almost...
In the helpe it says
start_time [in] The bar time corresponding to the first element.
And the first element is 0.
But the last element is fine.
If this is what you intended, please fix the help.
It is not clear from your example how time1 value is acquired. The attempt to reproduce the situation was unsuccessful.
Found that the FreeMarginCheck method needs to be refined.
Found that the FreeMarginCheck method needs to be refined.
2. Another problem is as follows. Once again consider the case SYMBOL_CALC_MODE_FOREX:
work=SymbolInfoString(symbol,SYMBOL_CURRENCY_MARGIN)+Currency();
bid=SymbolInfoDouble(work,SYMBOL_BID);
If thesymbol variable has a currency that is not directly quoted (e.g. CADJPY) as base currency, SymbolInfoDouble(work,SYMBOL_BID) will output 0.
2.1 Furthermore, it's not clear why the BID price is used when calculating the second variable (bid). After all, we need to ensure that the currencyin which bids are calculated is acquiredat the expense of the deposit currency, i.e. "buy the margin currency, sell the deposit currency". And if in a particular currency pair, the deposit currency is in the second place, then we have to use the ASK price to perform the specified operation.
To rectify the situation, I have done the following:
double course;
//---
switch(SymbolInfoInteger(symbol,SYMBOL_TRADE_CALC_MODE))
{
case SYMBOL_CALC_MODE_FOREX:
course=1.0;
//---Check whether the deposit currency is the base currency of the current currency pair
//pair. If it is, then the value of the course variable will remain 1.0
if(SymbolInfoString(symbol,SYMBOL_CURRENCY_MARGIN)!=Currency())
{
work=SymbolInfoString(symbol,SYMBOL_CURRENCY_MARGIN)+Currency();
//---Check if there is a currency pair whose base currency is the same as the
//the base currency of the current pair, and the quote currency is the same as the deposit currency
//(i.e., if the deposit is in USD, check for a direct quote)
if(SymbolInfoDouble(work,SYMBOL_ASK)!=0)
course=SymbolInfoDouble(work,SYMBOL_ASK);
//--- If the above condition is not met, change the sequence of symbols
//currencies in the work variable is not fulfilled and we obtain a currency pair with base currency
//matches the deposit currency, and the quote currency is the same as the base currency
//current pair (if the deposit is in USD, we obtain the currency pair with the reverse quote).
else
{
work=Currency()+SymbolInfoString(symbol,SYMBOL_CURRENCY_MARGIN);
course=1/SymbolInfoDouble(work,SYMBOL_BID);
}
}
margin=course*volume*contract_size/leverage;
margin=free_margin;
break;