Check Position by Symbol, not by Positionstotal

 

Hi Everybody,

normally, I want to open only one Trade at the same time with my EA.

It looks like this and works pretty fine

 && (PositionsTotal()==0)

But now I want to run the EA in different Charts with different values. Now I have to check if there is an open trade by Symbol.

This was my idea

&& (PositionGetSymbol("EURUSD")==0)

Am I right, or did I understand anything wrong? Compiler says warning: implicit conversion from string to number. I can't check cause the Strategy Tester can only handle one EA in one Symbol and test in a Demo Account isn't good either cause a Trade in this EA normaly is about 30 days and more.

Thanks for your help and opinion. Greetings from Germany, eurodirk

Documentation on MQL5: Conversion Functions / StringToDouble
Documentation on MQL5: Conversion Functions / StringToDouble
  • www.mql5.com
StringToDouble - Conversion Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
eurodirk:

Hi Everybody,

normally, I want to open only one Trade at the same time with my EA.

It looks like this and works pretty fine

But now I want to run the EA in different Charts with different values. Now I have to check if there is an open trade by Symbol.

This was my idea

Am I right, or did I understand anything wrong? Compiler says warning: implicit conversion from string to number. I can't check cause the Strategy Tester can only handle one EA in one Symbol and test in a Demo Account isn't good either cause a Trade in this EA normaly is about 30 days and more.

Thanks for your help and opinion. Greetings from Germany, eurodirk

Best would be to read the documentation about PositionGetSymbol.

Obviously you haven't done so jet.

Once you did, and you can show little more code than just one line (which already has 2 errors), we can give advice to how to go forward.