need help with simple coding

Created at 04 Feb 2023, 12:03
CT

ctid5729742

Joined 04.02.2023

need help with simple coding
04 Feb 2023, 12:03


hello i am not good with coding and i need help with what i assume to be simple coding.

i want all trades to be closed when the overall profit of account exceeds 1250$

also

similarly i want all trades to be closed when the overall loss of account exceeds 1250$. 

That is it, i hope someone can help me with this i would really appreciate it.


@ctid5729742
Replies

firemyst
29 May 2023, 06:18

Do you want the exceeds of $1250 to be gross profit or net profit?

Here's an example to test net profit on your account:

            if (Account.UnrealizedNetProfit > 1250)
            {
                foreach (Position p in Positions)
                {
                    ClosePosition(p);
                }
            }

 

 


@firemyst