How can the script programmatically go through all the instruments that are selected in the Market Watch window? - page 5

 
eevviill:

The last one.

I also sent it to a customer and he did the same.

I had to remove

if(SymbolsTotal(true)!=ArraySize(symbols))

Which one is the latter one? Can you attach a screenshot before and after running the script? How many symbols are there in marketwatch?
 
alexey_pak:
What is the last one? Can you attach a screenshot before you run the script and after? How many characters in marketwatch?

890

It's not a script. It's an EA.

I'll try to make the fault again now.

 

Here, put the EA on the chart and compare what it opens with what is in the overview.

Files:
 
eevviill:

Here, put the EA on the chart and compare what it opens with what is in the overview.

Why do orders open that are not in the market watch?
 
eevviill:
Why are orders that are not in Market Watch open?

What's not in MarketWatch? Orders or symbols?

You have an order open on AUDCHF. The deposit currency is probably USD. To calculate the profit and margin requirements , 2 other pairs - AUDUSD and USDCHF - are implicitly selected in MarketWatch after opening a position in AUDCHF.

 
stringo:

What's not in MarketWatch? Orders or symbols?

You have an order open on AUDCHF. The deposit currency is probably USD. To calculate the profit and margin requirements on each tick in MarketWatch, after opening a position on AUDCHF, two more pairs are implicitly selected - AUDUSD and USDCHF

И? Is that like my mistake?

It's all right in the code. So it's yours.

P.S. Orders.

 
Are you going to fix this bug?
 
eevviill:
Will you fix this bug?

What's the point? If you want to trade a limited set of instruments, set it explicitly by listing it on a line.

Well, they will fix this bug. It will not solve the problem. I know of other variants where the list of symbols in the overview may change in situations beyond the trader's control.

 
Mislaid:

Well, they'll fix the bug. It won't solve the problem.

So maybe everything needs to be fixed.

 

Since Rustam has already posted this, let me repeat it:

FAQ 18.12.2012 19:13


Pass a clean array to the function, get a list of symbols from the "market overview" panel

//+------------------------------------------------------------------+

//| Description: |

//+------------------------------------------------------------------+

int SymbolsList(string &Symbols[], bool Selected)

{

string SymbolsFileName;

int Offset, SymbolsNumber;

if(Selected) SymbolsFileName = "symbols.sel;

else SymbolsFileName = "symbols.raw";

int hFile = FileOpenHistory(SymbolsFileName, FILE_BIN|FILE_READ);

if(hFile < 0) return(-1);

if(Selected) { SymbolsNumber = (FileSize(hFile) - 4) / 128; Offset = 116; }

else { SymbolsNumber = FileSize(hFile) / 1936; Offset = 1924; }

ArrayResize(Symbols, SymbolsNumber);

if(Selected) FileSeek(hFile, 4, SEEK_SET);

for(int i = 0; i < SymbolsNumber; i++){

Symbols[i] = FileReadString(hFile, 12);

FileSeek(hFile, Offset, SEEK_CUR);

}

FileClose(hFile);

return(SymbolsNumber);

}

//+------------------------------------------------------------------+

Reason: