Always Add EquityProfitClose
01 Feb 2018, 23:21
Good night,
Regardless of trade result, profit or loss, always add the "EquityProfitClose" to de "CloseOnProfit" Example with 1000€ bankroll:
Trade 1: WIN . Balance: 1001€
Trade 2: WIN . Balance: 1002€
Trade 3: LOSS . Balance: 1001€
Trade 4: WIN . Balance: 1003€ (Last profit trade "Trade 2" + EquityProfitClose)
Thank you,
[Parameter("Profit (€)", DefaultValue = 1)]
public double EquityProfitClose { get; set; }
(...)
private void CloseOnProfit()
{
var _EquityProfitClose = Account.Equity - Account.Balance;
if (_EquityProfitClose > EquityProfitClose)
{
CloseAllPositions();
}
}
protected override void OnTick()
{
var myPositions = Positions.FindAll(LabelBuy, Symbol);
CloseOnProfit();
if (myPositions.Length == 0)
{
ExecuteOrderBuy(VolumeInUnits, OpenBuyPosition());
//ExecuteOrderSell(VolumeInUnits, OpenSellPosition());
}
}
Replies
PanagiotisCharalampous
02 Feb 2018, 09:23
Hi DelTrader,
I would love to help you but I did not understand what you are trying to do. Would you please try to explain this a little bit better?
Best Regards,
Panagiotis
@PanagiotisCharalampous
DelFonseca
02 Feb 2018, 16:09
Good afternoon,
Sorry, but my English is not perfect.
For each trade of profit or loss, I want to add the value of "EquityProfitClose" to the balance.
Example:
Opening balance: € 1000
EquityProfitClose: € 10
If I apply "Takeprofit = Account.Balance + EquityProfitClose" there is no problem because the take will be given at 1010 €, but if it was a loss, I would have the balance of 990 € (so far so good) but the next trade would take the € 1000 ("Takeprofit = Acchount.Balance + EquityProfitClose") and in reality I wanted to take 1020 € which would be the value of the takeprofit of the lost trade
Another example,
Let's imagine 10 trades followed with profit, Takeprofit will always be +10 €, but in the eventualdiade of losing a trade, I want as profit the previous continuity, 1010 €, 1020 €, 1030 €, ... 1090 €, 1100 €.
Thank you so much
@DelFonseca

DelFonseca
01 Feb 2018, 23:22
*im sorry, anyone can help me ?
Thank you
@DelFonseca