Maybe bug in the symbol field
-
Hello,
i try to open position by special symbol when my EA is run on the other symbols windows but just EA can open position on the current chart window.i don't know it is a bug or normal!!!!
For example, my EA is on the USDCAD and my variable is USDNZD and i want open a position on the USDNZD but EA just opened a position on USDCAD
-
@xfire Are you using a 'string' type variable to do that?
-
@l-andorrà yes it is a string and all blocks working as well just this one cant work with variables.
what do you think? can be a bug? -
@xfire This is certainly weird. I know this can sound weird but delete the block and rebuilt it from a new one. Sometimes blocks are corrupt. If it doesn't work you should fdefinitely contact the admin.
-
@l-andorrà said in Maybe bug in the symbol field:
This is certainly weird. I know this can sound weird but delete the block and rebuilt it from a new one. Sometimes blocks are corrupt. If it doesn't work you should fdefinitely contact the admin.
i try. thank you
-
When you look from EA's perspective, the chart in which it is opened is giving its parameters to the EA. For example, in MQL4/5 there is a function Symbol() that returns the symbol name of the chart. Also, the EA receives the ticks from the symbol of the chart.
But otherwise, you can open a trade in a symbol that is different from the one of the chart. The opened trade is in no way linked to the chart. And the way to do that is of course to write the exact name of the other symbol. It really should work if the variable named "fxname" is really a string variable with value USDNZD.
I looked into your last EA and I see that the variable has no initial value, but in Init it is defined like this:

Well, this sets the value USDCAD (assuming you opened the EA in USDCAD chart). I found one more place in Tick where you set the same variable in the same way (block 73). You have some Custom MQL blocks, but I don't see this variable there. So I don't really see where the value of this variable could become USDNZD.I see that you are opening another charts with a custom code in block 311. But when you do that, I don't see how this changes the fact that the EA is still working on the original chart. ChartOpen() is just opening another chart, similar to how you would do it manually.
-
Thank you for the complete explanation.
I notice from the first part of your explanation that my variable doesn't fill correctly.I did this part as a test so you couldn't see my sample block.
Thank you so much