Hi there, need to filter open positions from the pool by its symbol to properly calc its breakeven.
Through this code, I can get just values from the chart symbol:
Also tried this way but makes no sense:
And this one:
Any idea? Thanks in advance.string FindSymbol; FindSymbol="EURUSD";//as example if(OrderSymbol()==FindSymbol) //calculate.....
Try this....
Hi there, need to filter open positions from the pool by its symbol to properly calc its breakeven.
Through this code, I can get just values from the chart symbol:
Also tried this way but makes no sense:
And this one:
Any idea? Thanks in advance.Result of PositionGetSymbol() is not boolean but a string
Try this....
That way I'll have to make at least 30 lines of code, I think must be a better way.
Result of PositionGetSymbol() is not boolean but a string
Yes but this isn't also working properly:
if(PositionGetSymbol(i)==PositionGetString(POSITION_SYMBOL)){
Have any idea to solve the issue? It's for managing deals automated from a single chart.
Yes but this isn't also working properly:
Have any idea to solve the issue? It's for managing deals automated from a single chart.
if(PositionGetSymbol(i)==_Symbol) ...
Try this....
Hi all, got a solution clean and simple:
void OnStart(){ double Long=0,Short=0; for(int s=0;s<SymbolsTotal(false);s++){ // Define a counter loop for all broker symbols. string CurrentS=SymbolName(s,false); // Declare current working symbol from the loop. for(int i=0;i<PositionsTotal();i++){ // Here it goes the main loop for the advisor tool. ulong Ticket=PositionGetTicket(i); if(PositionSelectByTicket(Ticket)){ string PS=PositionGetString(POSITION_SYMBOL); // Declare position symbol value. if(PositionGetString(POSITION_SYMBOL)==CurrentS){ // Check if position symbol is current working symbol. int SD=(int)SymbolInfoInteger(PS,SYMBOL_DIGITS); // Declare symbol digits to get its value. Alert(PS," symbol digits are ",SD); // Print symbol digits value for each symbol. if(PositionGetInteger(POSITION_TYPE)==ORDER_TYPE_BUY){ Long++;if(Long>0){Alert(PS," buy orders are ",Long);} // Count long orders from each symbol and print its value. } if(PositionGetInteger(POSITION_TYPE)==ORDER_TYPE_SELL){ Short++;if(Short>0){Alert(PS," sell orders are ",Short++);} // Count short orders from each symbol and print its value. } } } } } }Now I got another problem by trying to get breakeven price explained in this new topic: https://www.mql5.com/en/forum/323198
Now I got another problem by trying to get breakeven price explained in this new topic: https://www.mql5.com/en/forum/323198
Why open a new topic when it is related to this??
Continue posting here.
I have deleted the new topic.
This topic is outdated, Keith. I'm posting elsewhere.
How can it be outdated?
The code that you have just posted is obviously connected.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi there, need to filter open positions from the pool by its symbol to properly calc its breakeven.
Through this code, I can get just values from the chart symbol:
Also tried this way but makes no sense:
And this one:
Any idea? Thanks in advance.