Job finished

Specification
The idea of the expert
Create an expert that allows for back-testing and live trading for forex based on the previous candle high, previous candle low, and current candle open. If the close of the prior candle is closer to the high, then go long with the prior candle high as take profit. If the close of the prior candle is closer to the low, then go short with the prior candle low as the take profit. Please calculate the ratio of the current open to the high or low by using these formulas below. Each value should be between 0-1.
For long entry ratio: (current candle open price – prior candle low)/(prior candle high – prior candle low)
For short entry ratio: (prior candle high – current candle open price)/(prior candle high – prior candle low)
Inputs are:
· Minimum ratio to enter trade:
o Example: only take long trades if ratio is greater than 51
· Maximum ratio to enter trade:
o Example: only take long trades if ratio is less than 90
· Profit target
o For long trade, take profit is the high value of prior candle or close trade at the close of the candle.
o For short trade, take profit is the low value of the prior candle or close trade at the close of the candle.
· Stop loss
o Allow the stop loss to be a multiple of the take profit range.
o For example, for long trade the profit range is: prior candle close – current open
o Allow a multiple of this range for stop.
o Example: Enter 2 and the stop loss will be twice the size of the take profit. Enter 1 and the stop loss distance will be the same as the take profit.
· Risk
o Be able to select risk % of total account balance
· Lot Size
o Based on the stop loss distance from entry and risk %, automatically calculate appropriate lot size
o Round to nearest 0.01
o For example, if risk is set to 1%, then automatically calculate lot size give the distance to stop loss, so that 1% is risked per trade.
o Formula should be: Balance*Risk%/(entry price – stop loss price)/CurrentPipValue/100000