| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Is this Valid? https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3489 |
Page 1 of 1 |
| Author: | Arav [ Sun Mar 09, 2014 5:42 am ] |
| Post subject: | Is this Valid? |
If I attach an EA to say EURUSD chart and then call 'OrderSymbol()' to verify whether it is on EURUSD chart or not like this: if (Order_Symbol()==EURUSD) // ? |
|
| Author: | renexxxx [ Sun Mar 09, 2014 8:06 am ] |
| Post subject: | Is this Valid? |
No, that is not quite valid. 1. It should be Symbol() not Order_Symbol(). Btw. There is a function OrderSymbol() (without the underscore) that returns the name of the symbol previously selected with OrderSelect() ). From the question, I assume that you are not after this one. 2. EURUSD should be between double quotes: "EURUSD". 3. You should be aware that some br0kers use suffixes for their symbols, such as "EURUSD.m". If that is the case, Symbol() would return "EURUSD.m" and the if-statement would return false. You might get away with Code: Select all |
|
| Author: | Arav [ Sun Mar 09, 2014 11:42 am ] |
| Post subject: | Is this Valid? |
Thanks for the reply. Actually I messed up the code. It had to be if (OrderSymbol()=="EURUSD") My requirement is that: After selecting an order, EA will verify that whether it is the Pair it is attached with. Code: Select all Code: Select all Code: Select all |
|
| Author: | renexxxx [ Sun Mar 09, 2014 11:56 am ] |
| Post subject: | Is this Valid? |
If you want your EA to do something specific if it is attached to the "EURUSD" chart, you would do something like: Code: Select all |
|
| Author: | Arav [ Sun Mar 09, 2014 12:25 pm ] |
| Post subject: | Is this Valid? |
No the EA wont do anything Specific while attached with a specific pair. Rather it'll do the same thing for every pair. So I want that there will be single function for Buy & Sell. The Symbol will be different while it'll open trades for different pairs. Also can I do it for all pairs just attaching it to Only One pair? Regards |
|
| Author: | renexxxx [ Sun Mar 09, 2014 7:35 pm ] |
| Post subject: | Is this Valid? |
Yes, you can. |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|