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
It's always been difficult to manage pending orders. on mt4 too. maybe you could try to get away from that? for example, make virtual pending orders (just store them in variables and open when the price has crossed the market). Time is important now...
I have no time... I just debugged the code.
at least have time to do some testing and tweaking
Such single mistakes will not affect the fate of your EA in the championship. But if in the absence of money it will make repeated attempts to open a position generating gigabytes in its log, as it happened in the previous Championships, it will be disqualified.
I wouldn't want my EA to be excluded from the competition because of this kind of reliance on recommended features. But then how do I know the correct allowed stop level for a given symbol at the moment?
P.S. I would hate to use selection with incremental increase in case of error, and the number of errors in this case will increase.I have a problem in determining stop levels for pending orders. When the market is calm and we want to place a stop order at a permissible level, the function SymbolInfoInteger(SYMBOL_TRADE_STOPS_LEVEL) works perfectly well; the orders are placed and everyone is happy including me. However, if market starts to vibrate strongly at the beginning of a trading session, this function stops working, orders are not placed and the terminal starts generating errors about invalid stops.
I wouldn't want my EA to be excluded from the competition because of this kind of reliance on recommended features. But then how do I know the correct allowed stop level for a given symbol at the moment?
P.S. I would very much hate to use a selection with incremental increase in case of an error, and the number of errors in this case would increase.For pending orders, the error of invalid stops also occurs when the open price is closer to the current one.
I.e. you have to check not only stops, but also opening price.
I believe that there is an error in the HistoryDealsTotal() function , if it is started after HistorySelectByPosition() .
It repeatedly displays the number of deals equal to 0, and this despite having an open position (multicurrency variant).
Here is the code:
void GetDealQuantity(string smbl)
{
long pos_id;
int total, quantity=0;
ulong ticket=0; newticket;
PositionSelect(smbl);
pos_id=PositionGetInteger(POSITION_IDENTIFIER);
bool select=HistorySelectByPosition(pos_id);
total=HistoryDealsTotal();
Print(__FUNCTION__," select=",select," total=",total);
for(int i=HistoryDealsTotal()-1;i>=0;i--)
{
newticket=HistoryOrderGetTicket(i);
if(ticket!=newticket) { quantity++; ticket=newticket; }
}
if(smbl==symbol1) quantity1=quantity;
if(smbl==symbol2) quantity2=quantity;
Print(__FUNCTION__," quantity=",quantity);
}
Prints it into the journal:
2010.01.04 00:20:05 GetDealQuantity select=true total=0
2010.01.04 00:20:05 GetDealQuantity quantity=0
2010.01.04 00:20:05 EURJPY volume=0.1 quantity=0
2010.01.04 00:20:05 GetDealQuantity select=true total=1
2010.01.04 00:20:05 GetDealQuantity quantity=1
2010.01.04 00:20:05 AUDUSD volume=0.1 quantity=1
Try to insert the code correctly in your posts. Try redoing your example like this:
Is there an example script somewhere to write the last quote to the clipboard or something similar?
Windows clipboard?
I have to look in msdn to see which dll the required functions are in...