Description
This indicator is based on Bob Volman´s setup
- 25EMA
- Round Number with 50 created by adaled
- Position Size Calculator
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo.Indicators
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.EEuropeStandardTime, AccessRights = AccessRights.None)]
public class BobVolman : Indicator
{
//-----------PARAMETER---------------------------
[Parameter("Info", DefaultValue = 1)]
public bool info { get; set; }
[Parameter("Stop Loss", DefaultValue = 6)]
public int StopLoss { get; set; }
[Parameter("Stop Loss Risk %", DefaultValue = 1)]
public double stopLossRiskPercent { get; set; }
[Parameter(DefaultValue = 50)]
public int StepPips { get; set; }
public ExponentialMovingAverage ema;
[Parameter("Period", DefaultValue = 25)]
public int Period { get; set; }
[Parameter("Source")]
public DataSeries Source { get; set; }
[Output("Main", Color = Colors.Black)]
public IndicatorDataSeries Result { get; set; }
protected override void Initialize()
{
ema = Indicators.ExponentialMovingAverage(Source, Period);
double max = MarketSeries.High.Maximum(MarketSeries.High.Count);
double min = MarketSeries.Low.Minimum(MarketSeries.Low.Count);
double step = Symbol.PipSize * StepPips;
double start = Math.Floor(min / step) * step;
for (double level = start; level <= max + step; level += step)
{
ChartObjects.DrawHorizontalLine("line_" + level, level, Colors.Silver);
}
}
public override void Calculate(int index)
{
Result[index] = ema.Result[index];
if (info == true)
{
DisplayPositionSizeRiskOnChart();
}
}
// Position Size Calculator
private void DisplayPositionSizeRiskOnChart()
{
double costPerPip = (double)((int)(Symbol.PipValue * 10000000)) / 100;
double positionSizeForRisk = (Account.Balance * stopLossRiskPercent / 100) / (StopLoss * costPerPip);
string text = "SL is " + StopLoss + " pips = " + Math.Round(positionSizeForRisk, 2) + " Lot";
ChartObjects.DrawText("positionRisk", text, StaticPosition.TopLeft, Colors.White);
if (TimeFrame < TimeFrame.Minute30)
{
string size = "\n" + "06 pips = " + Math.Round((Account.Balance * stopLossRiskPercent / 100) / (6 * costPerPip), 2) + " Lot";
size = size + "\n" + "08 pips = " + Math.Round((Account.Balance * stopLossRiskPercent / 100) / (8 * costPerPip), 2) + " Lot";
size = size + "\n" + "10 pips = " + Math.Round((Account.Balance * stopLossRiskPercent / 100) / (10 * costPerPip), 2) + " Lot";
size = size + "\n" + "12 pips = " + Math.Round((Account.Balance * stopLossRiskPercent / 100) / (12 * costPerPip), 2) + " Lot";
size = size + "\n" + "15 pips = " + Math.Round((Account.Balance * stopLossRiskPercent / 100) / (15 * costPerPip), 2) + " Lot";
ChartObjects.DrawText("calculator", size, StaticPosition.TopLeft, Colors.Gray);
}
}
}
}
BigDeal
Joined on 03.12.2015
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Bob Volman.algo
- Rating: 0
- Installs: 2876
- Modified: 13/10/2021 09:54
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
Hello,
Can you contact me by email ?
Jumpsolid@gmail.com
Thanks in advance
Respectfully,
Jumpsolid