Hi,
I created a TrailingStop ea to help to modify stop loss position. After that, my data provider is OANDA, the first position I opened is USDJPY.sml and second position is AUDJPY. However, when I run this ea with the code below, it fails to return second position AUDJPY, for both index 0 and 1, it still returns USDJPY.sml as the symbol, although ulong posTicket does return 2 numbers.
I printed the comment and get result like:
i:1 get ticket: 11594375 Symbol: USDJPY.sml
i:0 get ticket: 11591608 Symbol: USDJPY.sml
Initially I thought the Avatrade mt5 got hidden bug, so I downloaded the official mt5 but still got the same problem.
So, it failed to return symbol AUDJPY. May someone advise me on this? Thank you.
I have found out the issue. The problem is with
PositionGetSymbol(POSITION_SYMBOL)
instead it should be
PositionGetSymbol(i)
I am newbie in mql5 programming, so I followed a Youtuber to write the code. So the problem is solved.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I created a TrailingStop ea to help to modify stop loss position. After that, my data provider is OANDA, the first position I opened is USDJPY.sml and second position is AUDJPY. However, when I run this ea with the code below, it fails to return second position AUDJPY, for both index 0 and 1, it still returns USDJPY.sml as the symbol, although ulong posTicket does return 2 numbers.
I printed the comment and get result like:
i:1 get ticket: 11594375 Symbol: USDJPY.sml
i:0 get ticket: 11591608 Symbol: USDJPY.sml
Initially I thought the Avatrade mt5 got hidden bug, so I downloaded the official mt5 but still got the same problem.
So, it failed to return symbol AUDJPY. May someone advise me on this? Thank you.