Profit indicator
Profit indicator
28 Jun 2021, 12:51
hey guys, can u help me? i have a free indicator, found somewhere i cant remember and the problem is that the size of the letter too tiny and the colors also not the best for me on the screen, so i have tried to find the letters size, color etc parameters in the source code but i cant see nowhere... im not a programmer so... :D thank you guys
source code:
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
public class profit_indicator : Indicator
{
public override void Calculate(int index)
{
if (IsLastBar)
profitOnChart();
}
private void profitOnChart()
{
var netPips = 0.0;
var netProfit = 0.0;
string chartpair = Symbol.Code;
foreach (var position in Positions)
{
string pospair = position.SymbolCode;
if (pospair == chartpair)
{
netProfit += position.NetProfit;
netPips += position.Pips;
var pps = string.Format("{0} p", netPips);
var nett = string.Format(" / {0: $#,##0.00}", netProfit);
var netclr = Colors.SlateGray;
if (netProfit < 0)
{
//negative
netclr = Colors.Red;
}
if (netProfit > 0)
{
//positive
netclr = Colors.Green;
pps = "+" + pps;
}
if (netProfit == 0)
{
//neither positive or negative,
netclr = Colors.SlateGray;
}
var nets = pps + nett;
ChartObjects.DrawText("p1", "\t\t" + nets, StaticPosition.Right, netclr);
// ChartObjects.RemoveObject("p1");
// int EntryPrice = position.EntryPrice;
// double EntryTime = position.EntryTime;
// int y = Symbol.Ask;
// double x = Server.Time;
//ChartObjects.("tLine", EntryPrice, EntryTime, x, y, Colors.Gainsboro, 2, LineStyle.Lines)
}
}
if (Positions.Count == 0)
{
ChartObjects.RemoveObject("p1");
}
}
}
}