Please I need your help in solving this nagging problem of assigning each name of pairs to OrderSend function to open, I was able to call all the symbols from the market watch but to assign a particular pair for each OrderSend is the problem, it was just picking all the symbols and buying them all but I want it to buy/sell a few that I will assign to it with variables. Below is the codes I have gotten so far:
4106 for mt4 means "unknown symbol" - check your symbol names, or upload a screenshot of your market watch so we know you've got the symbol names right...
4106 for mt4 means "unknown symbol" - check your symbol names, or upload a screenshot of your market watch so we know you've got the symbol names right...
4106, Yes I know. i got the symbol pairs right but please read my question from the beginning and you will understand what i am saying. Thanks anyway
Well, you want to open orders for those pairs that you choose - am I right? To get any useful reply you'll have to let us know HOW you prefer to make the selection? Do you prefer a dialog box with checkboxes? Or an array which you hardcode? Or read from a text file? As far as I'm concerned, that is the EASY and STRAIGHTFORWARD part.
4106 is the main problem here - and you've mentioned that the same code behaved differently when run on demo and your life account (tell-tale sign that the code works). So if you cannot get rid of the 4106 error, what's the point of creating a sub-list of pairs? Then you'll end up blaming the sub-list?
Hope someone else will see things from your perspective... I've tried, and let's take it that I failed to understand what you're saying.
Well, you want to open orders for those pairs that you choose - am I right? To get any useful reply you'll have to let us know HOW you prefer to make the selection? Do you prefer a dialog box with checkboxes? Or an array which you hardcode? Or read from a text file? As far as I'm concerned, that is the EASY and STRAIGHTFORWARD part.
4106 is the main problem here - and you've mentioned that the same code behaved differently when run on demo and your life account (tell-tale sign that the code works). So if you cannot get rid of the 4106 error, what's the point of creating a sub-list of pairs? Then you'll end up blaming the sub-list?
Hope someone else will see things from your perspective... I've tried, and let's take it that I failed to understand what you're saying.
if (id== CHARTEVENT_OBJECT_CLICK ) { string name="USDBasketBuy"; if(ObjectGetInteger(0,name,OBJPROP_STATE)==true) { ObjectSetInteger(0,name,OBJPROP_STATE,false); RefreshRates(); struct symbols { string s; color c; }; symbols Symbols[]= { {"USDCAD",Green}, {"USDJPY",Green}, {"USDCHF",Green}, {"GBPUSD",Red}, {"AUDUSD",Red}, {"NZDUSD",Red}, {"EURUSD",Red} }; for(int i=0; i<7; i++) res=OrderSend(Symbols[i].s,OP_BUY,LotB,Ask,1,0,0,"",MagicNo,0,Symbols[i].c); Print("All orders opened successfully!"); }Possible so
Possible so
Thanks for this piece. Tried it and it returned all the selected pairs as expected but it didn't send the pairs' orders, only returning error 4106
I believe there is more you can do for me to make it work.
While waiting, thanks so much, I am grateful
symbols Symbols[]= { {addSymbol("USDCAD"),Green}, {addSymbol("USDJPY"),Green}, {addSymbol("USDCHF"),Green}, {addSymbol("GBPUSD"),Red}, {addSymbol("AUDUSD"),Red}, {addSymbol("NZDUSD"),Red}, {addSymbol("EURUSD"),Red} }; //------------------------ string addSymbol(const string _symbol) { if(_symbol == "") return _Symbol; //--- int total = SymbolsTotal(false); string symbol = _symbol; bool p = StringToUpper(symbol); for(int i=0; i<total; i++) { string _s = SymbolName(i, false); p = StringToUpper( _s ); if( _s != symbol && StringFind(symbol, _s, 0) < 0 && StringFind(_s, symbol, 0) < 0) continue; symbol = SymbolName(i, false); break; } if( !SymbolSelect(symbol, true) ) return _Symbol; //--- return symbol; }
I can't read minds.
Need to see code. Something to fix.
I can only assume. That you have something with symbols.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Gurus in the house,
Please I need your help in solving this nagging problem of assigning each name of pairs to OrderSend function to open, I was able to call all the symbols from the market watch but to assign a particular pair for each OrderSend is the problem, it was just picking all the symbols and buying them all but I want it to buy/sell a few that I will assign to it with variables. Below is the codes I have gotten so far: