Help with ea to close position after an input price is hit

 
I need help in coding a condition where I input a price (actually 3 prices), and when that price is hit (I will be using a long position for this example) the ea will "know and remember" the exact bar that hit this price. At this point, the ea will use the low price of this bar to exit the trade. It would seem that an array/loop would be needed in this situation, but the thing is I do not want the ea to do is use another bar that happens to hit the input price later on, I just want the ea to use the original bar's low for the exit (the bar that first hit the input price). For example, if I input a price of 1.0234 and and bar hits that price with a low of 1.0220, I want the ea to close the trade at 1.0220. If the price bar moves away from the input price but does not hit the low price of 1.0220, but instead moves back to the input price of 1.0234, I want the ea to still use the original bar with the low of 1.0220 and not use the new updated bar's low that just hit the input price. Using a loop, the bar will keep updating. My overall goal is to input three prices in the ea, and the ea will check to see if the unit hit the first price entered. If that price is hit, it will use the low as the exit. If the low is never hit the ea will wait for either the low to be hit of the original bar, or wait until the unit hits the second input price. I want the ea to do this for all three input prices. Any help will be greatly appreciated.
 
You can consider Freelance section.  Regards.
Freelance service at MQL5.com
Freelance service at MQL5.com
  • www.mql5.com
To be corrected: For example: monthly percentage = 0.50, so, if current percentage = 0.25, then BUY and SELL should not open. arrived at = 0.50 if current percentage = 0.50 positive, then only BUY allowed if current percentage = - 0.50 negative, then only SELL allowed this must be valid for each time frame Daily input = 00:00 Weekly input =...
Reason: