Trabalho concluído
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Termos de Referência
Ok here's what I need.
I open the bot with "attach to a chart"
1. A start time (hh:mm:ss) and date(preset=current date) can be entered
2. A number of variables can be set:
a) "amount" =amount of money to be used for the PO, in percent of balance // e.g. balance=200$; amount=8 means 16$ are used for each PO
b) "distance" (=distance of the POs to current price in pips)
c) "stoploss" (=distance to open order price in pips)
e) "stroke" (=seconds)
f) "gain" (=amount of gain in percent of used margin(not free margin!)) e.g. margin=20$ gain=0.5 gain would equal 1($)
g) "fallback"
h) "trailstop" (in pips)
What should happen?
1. At start time (working with PC clock) the bot will open two POs(one sell/one buy) in "distance" to the current price. Lotsize will be using amount considering the leverage of the present chart (this is very important!) . Also "stoploss" will be applied.
2. a) If one of the pending orders is opened then the other one will be closed and the process continues with 3.
2. b) As long as no orders are opened the POs will be closed and immediately reopened after "stroke" seconds - same process as 1.
-----------------------------------
3. a) If (the now) open order gains "gain" percent(of margin) then cancel "stoploss"
b) If current gain is falling back to "gain x "fallback" then close order
e.g. the order has a margin of 100$; "gain"=0.5; "fallback"=0.9
when 50 cent profit are realized the sl is cancelled; if the profit decreases to (50cent x 0.9=45cent) then the order will be closed
c) Start a tsl with trailstop (which will close the order in case it's still open)
That's all folks
I don't have a clue how difficult it is to create a mql5 version parallel to the mql4 one, but I wouldn't mind having both
No beginners please - I prefer pros
Kind regards