Jusyer:
Yes, it is possible to run code on a Symbol(s) other than the current Chart, although without seeing your code cannot provide further advice.
Hi.
I wonder if you can change the symbol in a single execution of the script. I have a script that analyzes various candles symbol of the window where I throw it, and I would like, in the same execution, change the symbol and also analyze candles of the new symbol.
All this is to not have to go putting the script in all windows, and work less well :)
Thanks, greetings.
Thanks for responding.
The code is simple, measures a number of candles and returns how many over a certain size.
Would I have to change the core of the code? or you can put some instruction before, which change the symbol and then run the core of the code?
No code no help. Sorry. Use SRC when posting code.
Look at documentation on MarketInfo
Jusyer:
Thanks for responding.
The code is simple, measures a number of candles and returns how many over a certain size.
Would I have to change the core of the code? or you can put some instruction before, which change the symbol and then run the core of the code?
One way of doing it would be to put the symbols in a string array
ie
string Symbs="EURUSD,GBPUSD,USDJPY"
You can change and/or add symbol names. Just separate them with a comma. The symbol names must be the same as your broker uses
string Symbs="EURUSDm,GBPUSDm,USDJPYm,USDCHFm,EURJPYm"
input string Symbs="EURUSD,GBPUSD,USDJPY"; string SymbolArray[]; int array_size; //in onOnit ushort u_sep=StringGetCharacter(",",0); StringSplit(Symbs,u_sep,SymbolArray); array_size=ArraySize(SymbolArray); //In Main code for(int x=0;x<array_size;x++) { double last_candle_close=iClose(SymbolArray[x],PERIOD_H1,1); int dig=(int)MarketInfo(SymbolArray[x],MODE_DIGITS); string lcc=DoubleToStr(last_candle_close,dig); Print(SymbolArray[x]+"Last candle close="+lcc); //The Print is just to show that it works. }
input int Puntos = 100; input int Velas = 7200; void OnStart() { int contador=0; for (int i=0; i<Velas; i++) { if(Open[i]-Close[i]>Puntos*Point || Close[i]-Open[i]>Puntos*Point) { contador++; ObjectCreate(ChartID(),"flecha"+i,OBJ_VLINE,0,Time[i],High[i]); } } Alert(Symbol() + ": Analizadas: " + Velas + ". Tamaño: " + Puntos + ". Total: " + contador); }This is the code, very simple.
Jusyer: I wonder if you can change the symbol in a single execution of the script. change the symbol and also analyze candles of the new symbol.
| Not possible. If you change the chart, you get a pop up message, the script exits and it's gone.
|

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
Hi.
I wonder if you can change the symbol in a single execution of the script. I have a script that analyzes various candles symbol of the window where I throw it, and I would like, in the same execution, change the symbol and also analyze candles of the new symbol.
All this is to not have to go putting the script in all windows, and work less well :)
Thanks, greetings.