I have already found a solution regarding with my problem. I used a matlab function block in order to process my signal given with a varying thresholding value. The picture below shows a block that accepts two signals: the real-time signal I have processed and the thresholding value of that given signal. The output is satisfactory, however this method is not applicable for getting all the peaks. I need to figure out some other solutions for this problem yet.
Note: I am currently trying to detect ECG peaks for this function block.