Not a bug

Cumulative Trades Request error when loading indicator after workspace save or clone chart

Bidder 3 years ago updated by JUAN CRUZ 3 years ago 4

The code below in indicator "CumulativeTradesHistoricalSupportTest" will work just fine when the indicator is first loaded on the chart.  But if the workspace is saved and reopened these errors will be sent and the indicator will be removed from the chart.  

The errors will also present themselves if the indicator is added to the chart and then the chart is cloned. The messages below will be sent and the indicator will be removed from the cloned chart. 

Image 19228

#region  CumulativeTradesHistorical (Support Test)
    public class CumulativeTradesHistoricalSupportTest : Indicator
        private int OnceVar = 0, FmVol = 50, ToVol = 9999;
        public CumulativeTradesRequest CumTrd;

        protected override void OnCalculate(int bar, decimal value)
            if (OnceVar == 0)
                DateTime FmDt = DateTime.Now.AddDays(-3);
                DateTime ToDt = DateTime.Now.AddDays(1);
                CumTrd = new ATAS.Indicators.CumulativeTradesRequest(FmDt, ToDt, FmVol, ToVol);
                OnceVar = 1;

        protected override void OnCumulativeTradesResponse(CumulativeTradesRequest InCumTrd, IEnumerable<cumulativetrade> cumulativeTrades)
            base.OnCumulativeTradesResponse(InCumTrd, cumulativeTrades);

            foreach (CumulativeTrade Ct in cumulativeTrades)
                string Rcd = Ct.Time.AddHours(-6) + "," + Ct.Direction.ToString() + "," +
                    Ct.FirstPrice.ToString("0.00") + "," + Ct.Lastprice.ToString("0.00") + "," +
                using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Temp\ATASv5_Output.csv", true))





Thank you. 

Satisfaction mark by Bidder 3 years ago
Not a bug

Just set CumTrd as private.

Yes, that solved the issue.   Thank you very much !

Hello, how are you? I can communicate with you privately, I'll leave you my number +57 3225536790

I need help with a BOT that I want to develop taking data from limited orders