Only allow trades to be placed monday-friday so position is not open during weekend

Created at 26 Jun 2017, 13:54
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!
FR

fredrik

Joined 02.05.2017

Only allow trades to be placed monday-friday so position is not open during weekend
26 Jun 2017, 13:54


Hi guys,

how can I acchieve so that my bot does not have any positions during the weekend?

Lets say it starts to take trades monday morning at 09:05 and close any positions by friday 22:00?

Today I have:

// Entering long positions

            if (conditions...)
            {
                ExecuteMarketOrder(TradeType.Buy, Symbol, Quantity, Label", stopLoss, takeProfit);
            }

// Entering short positions

            if (conditions...)
            {
                ExecuteMarketOrder(TradeType.Sell, Symbol, Quantity, Label", stopLoss, takeProfit);
            }

 


@fredrik
Replies

ClickAlgo
26 Jun 2017, 15:34

Visit here

https://clickalgo.com/cTrader-algorithmic-trading-school-for-beginners

scroll down to the section - How to Write a Risk Management Robot with Visual Studio

You can download source code and watch a video code walkthrough, it covers what you are looking for.

https://clickalgo.com/Published/Documents/ClickAlgo-RMM-example-min.pdf


@ClickAlgo