Indicators question
Indicators question
30 Jun 2018, 12:58
Hey guys
So let's say I need to stop a bot in order to add/alter something. I usually do this on Saturday-Sunday when the market is inactive. So when I switch the bot back on Sunday evening, here's my bot by the way (it's just an example):
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("Source")] public DataSeries SourceSeries { get; set; } public CommodityChannelIndex _cci; protected override void OnStart() { _cci = Indicators.CommodityChannelIndex(20); if (_cci.Result.LastValue > -1000) { ExecuteMarketOrder(TradeType.Buy, Symbol, 5000, "Buy1", 20, 30); Print("Y"); } } } }
So CCI uses 20 periods to calculate its data. I'm trading on 1h chart. Does this mean that it will take 20h after I start the bot again in order to be able to take the decision about Executing a market order?
Replies
irmscher9
03 Jul 2018, 13:21
What about backtesting.
The above cBot doesn;t open a position in the first 20 periods whereas it's coded that way so it should open a position straight away..
@irmscher9
irmscher9
03 Jul 2018, 18:04
I guess it's because the in backtesting mode the chart is generated from a backtesting start date?
I'm just trying to make sure that if I disable and reenable my bots, then it won't take 20 hours to get back in into the trading (in real time).
@irmscher9
PanagiotisCharalampous
03 Jul 2018, 10:19
Hi irmscher9,
It means that the indicator will take into consideration the last 20 periods, each time a value is calculated.
Best Regards,
Panagiotis
@PanagiotisCharalampous