Replies

stevenrm
12 Aug 2024, 07:06 ( Updated at: 12 Aug 2024, 08:47 )

RE: Daily Limit on loss and Win

firemyst said: 

There is a way to do it, but you have to code it into your bots. Here's an example:

//Get historical tradePosition p1 = args.Position;//Running Totals_runningTotalsPipsGainedLost += p1.Pips;_runningTotalsNetGainLoss += p1.NetProfit//Stop the bot if the running net gain/loss pips falls below our specified amountif (_runningTotalsPipsGainedLost < StopBotWhenPipLossesFallBelow){	//stop bot	Stop();}//Stop the bot if the running net gain/loss total falls below our specified amountif (_runningTotalsNetGainLoss < StopBotWhenLossesFallBelow){	//stop bot	Stop();}

Note that this only works on each individual bot instance for each bot.

If you want the running totals to be across all instances of a particular bot, then you need to set static variables that are public that all bot code would have access to.

Have your bots check that value every time they start, and before entering any positions. If that global static amount is below a certain threshold, either stop your bot, or don't allow it to enter a new position.

 

Hello, thank you for your assistance. I will test it with my bot and provide feedback. It's exactly what I need: preventing my bot from opening a new position if it surpasses a certain threshold.

 


@stevenrm