Tick chart problem
Created at 07 Apr 2019, 13:52
A.
Tick chart problem
07 Apr 2019, 13:52
Hello,
I have an indicator on a t1 (tick) chart and I want to calculate averages and more things from the past data on the OnStart function.
I can't do GetSeries to access .Close because TimeFrame.Tick does not exist. How can I do it ?
Replies
PanagiotisCharalampous
10 Apr 2019, 15:54
Hi a.fernandez.martinez,
You can pass the timeframe as a parameter like the below
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo { [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class NewIndicator : Indicator { [Parameter(DefaultValue = 0.0)] public TimeFrame Timeframe { get; set; } [Output("Main")] public IndicatorDataSeries Result { get; set; } MarketSeries series; protected override void Initialize() { series = MarketData.GetSeries(Timeframe); } public override void Calculate(int index) { Print(series.Close.LastValue); } } }
Best Regards,
Panagiotis
@PanagiotisCharalampous
a.fernandez.martinez
08 Apr 2019, 05:17
The only solution I found for the moment is run the bot on backtesting first and get the values from the variables you want to pass to the real bot, is there another way to do all in one?
@a.fernandez.martinez