Information
Username: | sascha.dawe |
Member since: | 11 Feb 2019 |
Last login: | 11 Dec 2023 |
Status: | Active |
Activity
Where | Created | Comments |
---|---|---|
Algorithms | 0 | 1 |
Forum Topics | 11 | 13 |
Jobs | 0 | 30 |
About
Last Algorithm Comments
Last Jobs Comments
Hi,
I can have a look at your errors. Send your source code to sascha.coding@gmail.com
Regards,
Sascha
Hi,
I can help you with your bot.
Please send more details to sascha.coding@gmail.com
Regards,
Sascha
Hi,
I can help you with your trade days and daily trade limits modification.
Contact sascha.coding@gmail.com
Regards,
Sascha
Hi,
I can help you with your equity control bot.
Please contact sascha.coding@gmail.com
Regards,
Sascha
Hi,
I can help with this.
Contact sascha.coding@gmail.com
Regards,
Sascha
Hi,
I can help you with your break out bot.
Please contact me at sascha.coding@gmail.com
Regards,
Sascha
Hi,
I can help you with your alarm notification.
Please send further details to sascha.coding@gmail.com
Regards,
Sascha
Hi,
I can help you to add the lot size function.
Please contact sascha.coding@gmail.com
Hi,
I can help you with your ADX indicator.
sascha.coding@gmail.com
Hi Jan,
I could have a look at your existing cbot template and make modifications if you like.
Regards,
Sascha
sascha.coding@gmail.com
Hi Stuart,
I can help you with your strategy. What are you looking to add to your pivot point bot?
Contact sascha.coding@gmail.com
Regards,
Sascha
Hi,
I can help you with the indicator.
Contact sascha.coding@gmail.com
Contact sascha.coding@gmail.com for help with this.
Email sascha.coding@gmail.com to implement this idea.
Hi Zaknafein,
Great work on this cbot. I have made a slight modification, so that when counting max positions, it only counts the open Gerbil positions. This allows you to open manual trades or run other cbots on the same account concurrently, if the max positions are set to one.
I would like to work on this with you further. If you are interested, please contact me via my email account.
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.GMTStandardTime, AccessRights = AccessRights.None)]
public class Gerbil : Robot
{
[Parameter("Trade Start Hour", DefaultValue = 23, MinValue = 0, Step = 1)]
public int TradeStart { get; set; }
[Parameter("Trade End Hour", DefaultValue = 1, MinValue = 0, Step = 1)]
public int TradeEnd { get; set; }
[Parameter("Take Profit (Pips)", DefaultValue = 6, MinValue = 1, Step = 1)]
public int TakeProfit { get; set; }
[Parameter("Stop Loss (Pips)", DefaultValue = 150, MinValue = 1, Step = 1)]
public int StopLoss { get; set; }
[Parameter("Calculate Volume by Percentage?", DefaultValue = false)]
public bool RiskPercent { get; set; }
[Parameter("Quantity (%Risk or Lots)", DefaultValue = 0.01, MinValue = 0.01, Step = 0.01)]
public double Quantity { get; set; }
[Parameter("RSI Source")]
public DataSeries RSISource { get; set; }
[Parameter("RSI Period", DefaultValue = 7, MinValue = 1, Step = 1)]
public int RSIPeriods { get; set; }
[Parameter("RSI Overbought Level", DefaultValue = 80, MinValue = 1, Step = 1)]
public int RSIOverB { get; set; }
[Parameter("RSI Oversold Level", DefaultValue = 40, MinValue = 1, Step = 1)]
public int RSIOverS { get; set; }
[Parameter("ATR Periods", DefaultValue = 15, MinValue = 1, Step = 1)]
public int ATRPeriods { get; set; }
[Parameter("ATR From", DefaultValue = 10, MinValue = 1, Step = 1)]
public int ATRFrom { get; set; }
[Parameter("ATR To", DefaultValue = 100, MinValue = 1, Step = 1)]
public int ATRTo { get; set; }
[Parameter("Max Positions", DefaultValue = 1, MinValue = 1, Step = 1)]
public int MaxPos { get; set; }
[Parameter("Max DD Positions", DefaultValue = 0, MinValue = 0, Step = 1)]
public int MaxDDPos { get; set; }
[Parameter("KillHours", DefaultValue = 0, MinValue = 0, Step = 1)]
public int KillHours { get; set; }
private RelativeStrengthIndex rsi;
private AverageTrueRange atr;
private int DDPos = 0;
protected override void OnStart()
{
rsi = Indicators.RelativeStrengthIndex(RSISource, RSIPeriods);
atr = Indicators.AverageTrueRange(ATRPeriods, MovingAverageType.Simple);
}
protected override void OnBar()
{
if (Time.Hour >= TradeStart || Time.Hour < TradeEnd)
{
var atrVal = atr.Result.LastValue * 100000;
if (atrVal > ATRFrom && atrVal < ATRTo)
{
var positionsGerbil = Positions.FindAll("Gerbil", Symbol);
if (positionsGerbil.Length < MaxPos)
{
if (rsi.Result.LastValue < RSIOverS)
{
Open(TradeType.Buy);
}
else if (rsi.Result.LastValue > RSIOverB)
{
Open(TradeType.Sell);
}
}
}
}
if (KillHours != 0)
{
foreach (var position in Positions.FindAll("Gerbil", Symbol))
{
if (Time > position.EntryTime.AddMinutes(KillHours * 60))
ClosePosition(position);
}
}
}
private void Open(TradeType tradeType)
{
//var position = Positions.Find("SampleRSI", Symbol, tradeType);
var volumeInUnits = CalculateVolume();
ExecuteMarketOrder(tradeType, Symbol, volumeInUnits, "Gerbil", StopLoss, TakeProfit);
}
double CalculateVolume()
{
if (!RiskPercent)
{
return (Symbol.QuantityToVolumeInUnits(Quantity));
}
else
{
// Calculate the total risk allowed per trade.
double riskPerTrade = (Account.Balance * Quantity) / 100;
double totalSLPipValue = (StopLoss + Symbol.Spread) * Symbol.PipValue;
double calculatedVolume = riskPerTrade / totalSLPipValue;
double normalizedCalculatedVolume = Symbol.NormalizeVolumeInUnits(calculatedVolume, RoundingMode.ToNearest);
return normalizedCalculatedVolume;
}
}
}
}