# Decreasing Profit Taking by days

42
0
22
Decreasing Profit Taking by days

Lets say I set my profit taking at \$100

How could I set write profit taking decreasing by days
i.e. 10% per day

Day 1: \$100
Day 2: \$90
Day 3: \$80
Day 4: \$70
Day 5: \$60
Day 6: \$50
Day 7: \$40
Day 8: \$30
Day 9: \$20
Day 10: \$10
Day 11: \$0
Day 12: -\$10
Day 13: -\$20
etc..

7,804
253
114
So, you want the take-profit value to decrease by 10% every day for some specific position? For example, if you are long EUR/USD @ 1.1000 with initial TP = 1.1100, you want the TP to move to 1.1099 on the next, then to 1.1098 on the next day, and so on? Or am I misunderstanding something here?

42
0
22
I take profit based on the Balance.
I trying to do this:
After X numbers of days, I would accept taking less and less profit each day.
Say I wanted 1.5/100 which is 1.5% profit initially.

if ((Profit) >= (Balance*(1.5/100)))
I'm trying to modify this line into

Taking 10% less of (Balance*(1.5/100))
as each day passes.

Code (MQL5):

#define ONEDAY 86400 //24 hours in secoonds

void VariTPSL()
{
double Balance = AccountInfoDouble(ACCOUNT_BALANCE);
double Profit = AccountInfoDouble(ACCOUNT_PROFIT);
long delta = TimeCurrent() - PositionGetInteger(POSITION_TIME);

if( delta > (VariTPSL_After_X_Days*ONEDAY) )   // Take decreasing profit after X days
{
if ((Profit) >= (Balance*(1.5/100)))
{
{
Ordering=false;
CloseAll3();
}
}
}

Last edited: Dec 12, 2017

7,804
253
114
OK. With (delta / ONEDAY), you have number of days passed. Just multiply the initial TP by 10% and number of days and subtract that amount from the initial TP:

Code (MQL5):
(Balance*(1.5/100)) - (delta / ONEDAY) * 0.1 * (Balance*(1.5/100))

42
0
22
for some reason
Code (MQL5):
if (Profit >= (  (Balance*(1.5/100)) - (delta / ONEDAY) * 0.1 * (Balance*(1.5/100)) ) )
is always true