JJ
Can this be done
26 Feb 2018, 10:56
I dont know if i can put a logick in to my cbot to to open a trade at a specific price
example; Yen ,when the sma crosses below a surten price say150.000 the cbot then opens a Sell position
i want to use the sma combined with the actual price or the round number indicator
please explane if this is posseble

PanagiotisCharalampous
26 Feb 2018, 12:40
Hi jjwes76@gmail.com,
Yes this is possible. See an example below
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewcBot : Robot { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } [Parameter(DefaultValue = 0.0)] public double TargerPrice { get; set; } private SimpleMovingAverage _sma; protected override void OnStart() { _sma = Indicators.SimpleMovingAverage(MarketSeries.High, 5); } protected override void OnTick() { if (_sma.Result.LastValue < TargerPrice) ExecuteMarketOrder(TradeType.Sell, Symbol, 1000); } protected override void OnStop() { // Put your deinitialization logic here } } }Best Regards,
Panagiotis
@PanagiotisCharalampous