You have to specify which position with an index, 0 being the latest one.
See the section about positioninfo.
Normally(without classes) you do
PositionGetTicket(index) in a loop where index is the position number.
I suppose you get to know the debugger, set stop points at every line of your code and put every variable under watch, then go through the code line by line in debugger and see what values the respective variable gets at what point in time. Maybe set up a test program to buy without condition so that it has some position to process.

Debugging MQL5 Programs
- www.mql5.com
This article is intended primarily for the programmers who have already learned the language but have not fully mastered the program development yet. It reveals some debugging techniques and presents a combined experience of the author and many other programmers.
pennyhunter #:
I suppose you get to know the debugger, set stop points at every line of your code and put every variable under watch, then go through the code line by line in debugger and see what values the respective variable gets at what point in time. Maybe set up a test program to buy without condition so that it has some position to process.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
trying to change the stoploss of an order, I get the error in question and "error n 4756"
i'm using a library downloaded from this site, it's called k_orders, i've changed it a bit believing i'll solve the problem but i still get the error.
the library is in the attachment.
p.s. I'm trying to move the stoploss up by about 16 pips.
p.s.2 This happens in the strategy tester, I didn't do other tests.
wha'ts the problem? how to solve it?
thanks