Veles OrderOpen withRisk
This is an assistant script to help a trader open a position in any direction with a required % of risk, with a fixed Stop Loss or set on the nearest High or Low, and with a Take Profit value calculated as Stop Loss multiplied by a coefficient. In addition, it can set any pending order at a specified distance from the current price with a fixed Stop Loss and calculated Take Profit. The slippage parameter is also adjustable.
The trick! Has a Magic setting. Its default value is 0, which corresponds to the manual order. However, if you use an Expert Advisor, set its magic for the script, and the order opened by the script will further be managed by your Expert Advisor.
- PercentRiskDepozit - % of deposit lost if an order is closed by Stop Loss, 2 - 2%
- TypeOrder - select an order type
- StopLoss - number of pips for a selected Stop Loss from the order open price
- ExtremumforStop - only for Market orders, false - Stop Loss fixed, true - Stop Loss on the nearest extremum based on the number of bars
- NBarforExtremum - the number of bars to find extremum
- DeltaforStopExtremum - additional indent in pips from the extremum for the Stop Loss order
- KoefforProfit - Stop Loss pips multiplier to calculate Take Profit
- DistansforOtlog - distance from the current price to place a pending order
- Sleppage - slippage in pips
- Magic - set 0 for a manual order