Description
This Bot buy when current price larger than the highest price of last candle. Use only for Gold. Money Pairs I will code later.
If you like my work and effort then please consider to make a donation via Paypal
Email: nghiand.amz@gmail.com
Facebook: https://www.facebook.com/nghiand.amz
Telegram: +84 969228100
Here is back test result on D2 candle
1. Param
2. Chart
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.UTC, AccessRights = AccessRights.None)]
public class GoldTrend : Robot
{
[Parameter("Initial Volume Percent", DefaultValue = 1, MinValue = 0)]
public double InitialVolumePercent { get; set; }
[Parameter("Stop Loss", DefaultValue = 500)]
public int StopLoss { get; set; }
[Parameter("Take Profit", DefaultValue = 1000)]
public int TakeProfit { get; set; }
[Parameter("Source")]
public DataSeries Source { get; set; }
private double lastHight;
protected override void OnStart()
{
}
protected override void OnBar()
{
}
protected override void OnTick()
{
var volumne = Math.Floor(Account.Balance * InitialVolumePercent / 1000) * 10;
if (Positions.Count == 0)
{
// Put your core logic ere
Print("Symbol.Bid {0}", Symbol.Bid);
if (Bars.Last(1).High + Symbol.PipSize < Symbol.Ask)
{
ExecuteMarketOrder(TradeType.Buy, Symbol.Name, volumne, "NghiandLastBar", StopLoss, TakeProfit);
}
}
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
nghiand.amz
Joined on 06.07.2020
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: GoldTrend.algo
- Rating: 0
- Installs: 2849
- Modified: 13/10/2021 09:54
Comments
Hello,
I downloaded & backtested your bot using the very same parameters you used. i.e.
Asset: XAUUSD
Timeframe: D2
From: 15/01/2020
To: 15/08/2021 (Not 2020)
SL: 500
TP: 1000
I'm afraid i have very bad news!
<B>-3318.74$ (-33%)</B> is the result i got. A profit factor of '0'
I realise the bot you uploaded is not the one that gave you remarkable result you posted. May i ask for the actual bot or is this for sale?
I also reran the test after moving the code from the Ontick() event to the OnBar() event and used a SL of 1000 & TP of 1000. It resulted in a bad loss!!!