How To Take Profits ??
How To Take Profits ??
04 Mar 2021, 17:13
Hello,
My strategy depends on taking certain profit targets with no Stop Loss (maximum drawdown). So basically i want the following take profits:
$1
$2
$5
$9
$14
$20
$27
$35
$44
$54
If the Net Profit is =$2 then drops to ≤$1.99 take the profit immediately
if the Net Profit is ≥$2.00 and ≤ $4.99 but then drops to ≤$1.99 take the profit immediately
if the Net Profit is ≥$5.00 and ≤ $8.99 but then drops to ≤$2 take the profit immediately
if the Net Profit is ≥$9.00 and ≤ $13.99 but then drops to ≤$5 take the profit immediately
if the Net Profit is ≥$14.00 and ≤ $19.99 but then drops to ≤$9 take the profit immediately
if the Net Profit is ≥$20.00 and ≤ $26.99 but then drops to ≤$14 take the profit immediately
if the Net Profit is ≥$27.00 and ≤ $34.99 but then drops to ≤$20 take the profit immediately
if the Net Profit is ≥$35.00 and ≤ $43.99 but then drops to ≤$27 take the profit immediately
if the Net Profit is ≥$44.00 and ≤ $53.99 but then drops to ≤$35 take the profit immediately
if the Net Profit is ≥$54.00 and ≤ 63.99 but then drops to ≤$44 take the profit immediately
etc..............
Does anyone know how to configure Ctrader to do this? The market prices moves too fast for me to make such split second decisions. Also, you can visit my Ctrader Copy page by searching "VTX Financial Insitution". My trading strategy has virtually a 100% win rate so far...
Replies
prosteel1
12 Mar 2021, 11:22
( Updated at: 12 Mar 2021, 23:19 )
RE:
Hi I have some code to get you started. This closes 20% of the position if the profit is more than 2%, probably just use the GrossProfit based on your strategy with some extra variables to check if you have already taken profit. Hope this helps.
// Take profit if profit is high
if (LongTradeAggressiveProfitTaking == true && (double)pos.GrossProfit >= (Account.Balance * 0.02))
{
if (pos.VolumeInUnits >= 2000)
{
double newVol = Symbol.NormalizeVolumeInUnits((pos.VolumeInUnits / 5), RoundingMode.Up);
Print("1 pos.Profit = " + pos.GrossProfit + ", Account.Balance = " + Account.Balance + ", " + Math.Round((Account.Balance * 0.02), 2) + ", closing " + newVol + " of " + pos.VolumeInUnits);
ClosePosition(pos, newVol);
}
}
@prosteel1
PanagiotisCharalampous
05 Mar 2021, 08:22
Hi arunsub321,
You will need to program a cBot to achieve this. If you don't know how to do it, you can consider posting a Job.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous