Deal Map
Created at 27 Jul 2024, 01:00
RO
Deal Map
27 Jul 2024, 01:00
CTRADER FOR MACBOOK OU IPHONE NAO TEM O DEAL MAP ?
CTRADER FOR MACBOOK OR IPHONE DOESN'T HAVE THE DEAL MAP?
Replies
levd20
01 Sep 2024, 15:15
( Updated at: 02 Sep 2024, 05:28 )
RE: Deal Map
Hi, feel free to use this indicator.
best regards
levd20
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
public class paddysDealMap : Indicator
{
#region Parameter
[Parameter("Show Vertical Lines", Group = "Visibility", DefaultValue = true)]
public bool showVerticalLines { get; set; }
[Parameter("Show Trade Lines", Group = "Visibility", DefaultValue = true)]
public bool showTradeLines { get; set; }
[Parameter("Show Deal Stats", Group = "Visibility", DefaultValue = true)]
public bool showDealStats { get; set; }
#endregion
protected override void Initialize()
{
Chart.RemoveAllObjects();
DrawVerticalLines();
DrawDealMap();
DrawDealStats();
}
#region own Methods
private void DrawVerticalLines()
{
foreach (var Trade in History)
{
if(showVerticalLines && Trade.TradeType == TradeType.Buy) // green Line, when it's a Long-Order
{
Chart.DrawVerticalLine(
"Open_" + Trade.PositionId,
Trade.EntryTime,
Color.Green
);
}
if(showVerticalLines && Trade.TradeType == TradeType.Sell) // red Line, when it's a Short-Order
{
Chart.DrawVerticalLine(
"Open_" + Trade.PositionId,
Trade.EntryTime,
Color.Red
);
}
}
}
private void DrawDealMap()
{
foreach (var Trade in History)
{
if(showTradeLines && Trade.NetProfit>0) // When Trade was profitable -> green dealMapLine
{
var TrendLine = Chart.DrawTrendLine(
"TradelLine " + Trade.PositionId, // unique Name of the TrendLine
Trade.EntryTime, // X1 OpenTime
Trade.EntryPrice, // Y1 OpenPrice
Trade.ClosingTime, // X2 ClosingTime
Trade.ClosingPrice, // Y2 ClosingPrice
Color.LightGreen, // Color
3, // Line Thickness
LineStyle.Solid // Line Style
);
}
if(showTradeLines && Trade.NetProfit<0) // When Trade was profitable -> green dealMapLine
{
var TrendLine = Chart.DrawTrendLine(
"TradelLine " + Trade.PositionId, // unique Name of the TrendLine
Trade.EntryTime, // X1 OpenTime
Trade.EntryPrice, // Y1 OpenPrice
Trade.ClosingTime, // X2 ClosingTime
Trade.ClosingPrice, // Y2 ClosingPrice
Color.Magenta, // Color
3, // Line Thickness
LineStyle.Solid // Line Style
);
}
}
}
private void DrawDealStats()
{
foreach (var Trade in History)
{
string sign = Trade.NetProfit > 0 ? "+" : "";
string dealStats = $"{sign}{Trade.NetProfit / Account.Balance:0.00%}\n"+Trade.NetProfit.ToString("F2")+" €";
if(showDealStats && Trade.NetProfit > 0)
{
Chart.DrawText(
"DealNetProfit" + Trade.PositionId,
dealStats,
Trade.ClosingTime,
Trade.ClosingPrice,
Color.LightGreen
);
}
if(showDealStats && Trade.NetProfit < 0)
{
Chart.DrawText(
"DealNetProfit" + Trade.PositionId,
dealStats,
Trade.ClosingTime,
Trade.ClosingPrice,
Color.Magenta
);
}
}
}
#endregion own Methods
public override void Calculate(int index) { }
}
}
@levd20
PanagiotisCharalampous
28 Jul 2024, 07:19
Hi there,
No it does not. It will be added in a future release.
Best regards,
Panagiotis
@PanagiotisCharalampous