Problem solved!
First of all you must obtain the participants list that is used during evaluation. To do that you must use the assign class declared previously.
Use this:
global $CFG;
global $PAGE;
require_once($CFG->dirroot . '/mod/assign/locallib.php');
$context = context_module::instance($PAGE->cm->module);
$assignment = new assign($context, $PAGE->cm, $PAGE->cm->course);
$useridlist = array_keys($assignment->list_participants(0, true));
sort($useridlist);
Then you must obtain the row number (array key of $useridlist). Here we state the problem:
Before the advance grading plugin renderer is called in locallib.php of assign module, all the $_POST variables are deleted by using $_POST = array(), and so you can't check if the user has pressed either 'next' or 'previous' buttons thus you can't define if the next student evaluated is of index key -1 or +1. You can't use optional_param() function or any other similar, and of course you can't use $_POST to get your variables!
Solution: You use the $_REQUEST array object with the appropriate key e.g. 'saveandshownext' and you check whether the 'next' button was pressed or any other! Using the same object you can obtain the previous rownum and with these you can get the appropriate student id from the user id list above.
$rownum = $_REQUEST['rownum'];