Forum Topics not found
iandelmar305 26 Jan 2023, 22:42
amusleh said:
Hi, Here is an example: using cAlgo.API; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class DrawIcon : Robot { private double _initialEquity; [Parameter("Equity Increase Amount", DefaultValue = 100)] public double EquityIncreaseAmount { get; set; } protected override void OnStart() { _initialEquity = Account.Equity; } protected override void OnTick() { if (Account.Equity - _initialEquity >= EquityIncreaseAmount) { Stop(); } } } } It works properly only if your cBot trades the current chart symbol, if it trades multiple symbols then you have to use all symbols Tick events and check equity every time a symbol tick is received.
Hi,
Here is an example:
using cAlgo.API; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class DrawIcon : Robot { private double _initialEquity; [Parameter("Equity Increase Amount", DefaultValue = 100)] public double EquityIncreaseAmount { get; set; } protected override void OnStart() { _initialEquity = Account.Equity; } protected override void OnTick() { if (Account.Equity - _initialEquity >= EquityIncreaseAmount) { Stop(); } } } }
It works properly only if your cBot trades the current chart symbol, if it trades multiple symbols then you have to use all symbols Tick events and check equity every time a symbol tick is received.
iandelmar305
26 Jan 2023, 22:42
Hello, could you add a "close all cbots" and all open orders? that would be nice" thanks
amusleh said:
@iandelmar305