Need help in open position for a specific price by checking 3 positiontotals

 
I am working in a grid system where 1st position will open with current price of a pair, 2nd position will open if it gets down a certain pips and 3rd position will open again after a certain price.1st and 2nd position opens correctly but 3rd position opens but with the same value as the 2nd one.

Conclusion: Please help me out if you can. I am stuck for over a month on this.
Files:
testtest.mq5  2 kb
 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893