Topic: Stop trading if daily profit target reached?
I'm new here, and I'm playing around and trading like mad for one week, since I discovered this awesome piece of software! Thanks, Mr. Popov.
Now to my question: Is it possible to construct a logic condition, in such a way that it closes all positions, and doesn't start trading until the next day, whenever a user defined equity profit-percentage over the daily starting balance has been reached?
I'll try to express it in "pseudo" code:
UserDefinedProfitPercent = 2 // Default value, can be changed by user
StartBalance = Balance at the beginning of the day (or when launching strategy)
CloseAllPositions = FALSE
NoTradeTillTomorrow = FALSE
//Check profit so far
IF equity > StartBalance + (StartBalance/100*UserDefinedProfitPercent)
CloseAllPositions = TRUE
NoTradeTillTomorrow = TRUE
In other words: I want to make, say, 2% a day, and exit the market if I made it (beware of greed). Otherwise, the trading would continue, but refreshing the StartBalance at the beginning of every new day. This is important, because if you have lost some, you have to lower your expectations.