You're probably using High[], Low[] etc in your code. To check other symbols use iHigh(), iLow() etc instead. You will need to use the symbol string in the calculations, so include the string in your alert to tell you the symbol that the pattern occured on.
Not quite, there are no square brackets
iHigh[1]("EURUSD", PERIOD_D1, 0) //remove [1] iHigh("EURUSD", PERIOD_D1, 0) //this gives the high of the current daily bar iHigh("EURUSD", PERIOD_D1, 1) //this gives the high of the previous(closed) daily bar
You can store the symbol names in a string array and loop through them
- You can't use any predefined variables, can't use the tester, must poll (not OnTick,) and usually other problems.
- Code it to trade the chart pair only. Look at the others if you must.
- Then put it on other charts to trade the other pairs. Done.
Do not trade multiple currencies
- You can't use any predefined variables, can't use the tester, must poll (not OnTick,) and usually other problems.
- Code it to trade the chart pair only. Look at the others if you must.
- Then put it on other charts to trade the other pairs. Done.
Not quite, there are no square brackets
You can store the symbol names in a string array and loop through them
Thanks for all the help. One final question though: can you apply multiple symbols and periods to this? For example, could I write
iHigh("USDCHF, EURUSD, USDCAD", PERIOD_D1, PERIOD_H4, 1)
Im guessing that this would be the wrong way of writing this, but if you understand what I mean, is there a way of doing this, or do you have to write iHigh() for each symbol and period individually?
No, you can't do that
As I said, you can do it with an array and loop. This is an example that may give you some ideas
string symbol_array[]={"EURUSD","EURJPY","GBPUSD","USDJPY"}; //4 symbols used, indexed 0 to 3 string com=""; for (int x=0;x<4;x++) { double symbol_high=iHigh(symbol_array[x],0,0); int dig=(int)MarketInfo(symbol_array[x],MODE_DIGITS); com+=symbol_array[x]+" High="+DoubleToStr(symbol_high,dig)+"\n"; } Comment(com);
- You can't use any predefined variables, can't use the tester, must poll (not OnTick,) and usually other problems.
- Code it to trade the chart pair only. Look at the others if you must.
- Then put it on other charts to trade the other pairs. Done.
-
Pipthagoras: iHigh("USDCHF, EURUSD, USDCAD", PERIOD_D1, PERIOD_H4, 1)No need for that if you
- Code it to trade the chart pair only.
- Then put it on other charts to trade the other pairs.
- Code it to trade the chart pair only.
- GumRai's code is an example of "other problems." The code only runs on a tick of the current symbol and it does not take into account that the other symbol may not have started a new bar when the current symbol has and visa versa.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
So I've written my first EA, which is designed to alert me whenever a Hanging Man candlestick appears. What I am now struggling to understand is, how to apply it to multiple charts. Do I manually have to drag it onto every chart (currency pair AND time frame) individually, or can I make it apply itself to specific currency pairs and time frames when it is launched?
Also, is there a way of adding something to the Alert() that will tell me which of the charts the candlestick has occurred on?
Thanks.