Stop the BOT when reaching the Total Profit or Loss
Stop the BOT when reaching the Total Profit or Loss
21 Aug 2020, 11:35
Good night business friends ...
I looked for a reference in the forum but I didn't find it, what I'm trying to implement is a function in my Robot that would work as follows.
Assign 2 parameters to the Robot
Profit by section
Loss by section
Suppose I set the profit to $2 and the loss to -$1
This means that as soon as the Robot makes a total profit of $2 (including operations already closed and those opened as well), it closes all orders and stops running.
However, if he is left with a total loss of -$1 (including operations already closed and those open as well), he closes all orders and stops running.
This calculation must be done with each new section, that is ...
If I turn on the Bot, it starts the calculation until it turns off.
If I call again, it restarts the calculation.
I don't know if I explained myself well, but if anyone has any doubts, I explain a little better, anyway, if there is someone who can help me create this function, I am very grateful ...
hugs
firemyst
26 Aug 2020, 14:24
This is relatively easy.
See code example below. You'll obviously have to make adjustments for it to fit in your code.
@firemyst