Need to fund security control

Created at 15 May 2013, 10:19
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
DA

damon153058

Joined 13.04.2013

Need to fund security control
15 May 2013, 10:19


Need to fund security control

Requirements:

Loss greater than 200pips perform all close after stop robots

 

Intentioned people can help me edit this program


@damon153058
Replies

damon153058
15 May 2013, 10:26

RE:

Can someone please help me with the code?

Thanks

 


@damon153058

cAlgo_Fanatic
21 May 2013, 17:40

This code will loop through the Account positions when the robot is stoped and each position whose profit is less than 200 pips will be closed. If this is not your algorithm logic please send some more information or example.

        protected override void OnStop()
        {
            foreach (var position in Account.Positions)
            {
                var pipValue = Symbol.PipSize/Symbol.Ask*position.Volume;
                if (position.NetProfit < -200*pipValue)
                {
                    Trade.Close(position);
                }                
            }
        }




@cAlgo_Fanatic