Tick Indicator has stopped working

Created at 20 Feb 2013, 21:26
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
Scott's avatar

Scott

Joined 18.01.2013

Tick Indicator has stopped working
20 Feb 2013, 21:26


Tick Indicator has stopped working, and my indicator that shows the pip distance from various SMA's is also stoped working, instead of showing the pip distance they all read "NaN"


@Scott
Replies

cAlgo_Fanatic
21 Feb 2013, 09:46

Hello,

Is it the indicator found here /algos/show/207 that you are refering to? 

Regards,


@cAlgo_Fanatic

rkokerti
21 Feb 2013, 12:04

Hello, 

I use another Indicators, but I have the same problem. I have to reload all indicators when I restart cAlgo, because the displayed values NaN. The reloading solved the problem, but please investigate it because it's very uncomfortable.

Thanks in advance!

 


@rkokerti

Scott
21 Feb 2013, 12:10

RE:
cAlgo_Fanatic said:

Hello,

Is it the indicator found here /algos/show/207 that you are refering to? 

Regards,

Yes I'm using that tick indicator, also I have a indicator that shows the pips between SMA and that is not working as well.  Instead of the data I get "NaN" same on tick indicator.


@Scott

cAlgo_Fanatic
21 Feb 2013, 14:08

Thank you. You need to send us an email to engage@ctrader.com and let us know which cAlgo you are using (from Top Menu -> Help -> About cAlgo)

 


@cAlgo_Fanatic

Scott
21 Feb 2013, 14:30

RE:
cAlgo_Fanatic said:

Thank you. You need to send us an email to engage@ctrader.com and let us know which cAlgo you are using (from Top Menu -> Help -> About cAlgo)

 

Hi I'm using Ver: 1.0.24 cAlgo, I not using the indicators as a robot just trading with them in cTrader, the indicators are not working in both though.


@Scott

cAlgo_Fanatic
21 Feb 2013, 16:21

We have identified an issue with cTrader and are currently working on a solution which should be available in the next release. cAlgo is working properly though. 

Regards,


@cAlgo_Fanatic

Scott
21 Feb 2013, 17:20

RE:
cAlgo_Fanatic said:

We have identified an issue with cTrader and are currently working on a solution which should be available in the next release. cAlgo is working properly though. 

Regards,

How long till the next relase?  Is there no fix for now?,  below is the code for my indicator Pip Levels

using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo.Indicators
{
        [Indicator(IsOverlay = false)]
        public class PipLevels : Indicator
        {
//-----------------------------------------------------------------
    [Parameter]
      public DataSeries Source { get; set; }

    [Parameter(DefaultValue = 21)]
      public int PeriodMA1 { get; set; }
      
    [Parameter(DefaultValue = 34)]
      public int PeriodMA2 { get; set; }      
      
    [Parameter(DefaultValue = 21)]
      public int PeriodMA3 { get; set; }
      
    [Parameter(DefaultValue = 55)]
      public int PeriodMA4 { get; set; } 

    [Parameter(DefaultValue = 21)]
      public int PeriodMA5 { get; set; }
      
    [Parameter(DefaultValue = 75)]
      public int PeriodMA6 { get; set; }      
      
    [Parameter(DefaultValue = 21)]
      public int PeriodMA7 { get; set; }
      
    [Parameter(DefaultValue = 100)]
      public int PeriodMA8 { get; set; } 
         
    [Parameter(DefaultValue = 21)]
      public int PeriodMA9 { get; set; }
      
    [Parameter(DefaultValue = 144)]
      public int PeriodMA10 { get; set; }      
      
    [Parameter(DefaultValue = 21)]
      public int PeriodMA11 { get; set; }
      
    [Parameter(DefaultValue = 233)]
      public int PeriodMA12 { get; set; } 
          
    [Parameter(DefaultValue = 75)]
      public int PeriodMA13 { get; set; }
      
    [Parameter(DefaultValue = 233)]
      public int PeriodMA14 { get; set; } 
//-----------------------------------------------------------------        
        private Position position;
    private SimpleMovingAverage sma1;
    private SimpleMovingAverage sma2;
    private SimpleMovingAverage sma3;
    private SimpleMovingAverage sma4; 
    private SimpleMovingAverage sma5;
    private SimpleMovingAverage sma6;
    private SimpleMovingAverage sma7;
    private SimpleMovingAverage sma8; 
    private SimpleMovingAverage sma9;
    private SimpleMovingAverage sma10;
    private SimpleMovingAverage sma11;
    private SimpleMovingAverage sma12; 
    private SimpleMovingAverage sma13;
    private SimpleMovingAverage sma14; 
    private double L1vL2;    
    private double L1vL3;  
    private double L1vL4; 
    private double L1vL5; 
    private double L1vL6; 
    private double L1vL7;     
    private double L4vL7; 
//-----------------------------------------------------------------
        protected override void Initialize()
        {
        sma1 = Indicators.SimpleMovingAverage(Source,PeriodMA1);
        sma2 = Indicators.SimpleMovingAverage(Source,PeriodMA2);
        sma3 = Indicators.SimpleMovingAverage(Source,PeriodMA3);
        sma4 = Indicators.SimpleMovingAverage(Source,PeriodMA4);        
        sma5 = Indicators.SimpleMovingAverage(Source,PeriodMA5);
        sma6 = Indicators.SimpleMovingAverage(Source,PeriodMA6);
        sma7 = Indicators.SimpleMovingAverage(Source,PeriodMA7);
        sma8 = Indicators.SimpleMovingAverage(Source,PeriodMA8); 
        sma9 = Indicators.SimpleMovingAverage(Source,PeriodMA9);
        sma10 = Indicators.SimpleMovingAverage(Source,PeriodMA10);
        sma11 = Indicators.SimpleMovingAverage(Source,PeriodMA11);
        sma12 = Indicators.SimpleMovingAverage(Source,PeriodMA12); 
        sma13 = Indicators.SimpleMovingAverage(Source,PeriodMA13);
        sma14 = Indicators.SimpleMovingAverage(Source,PeriodMA14);         
        }
//-----------------------------------------------------------------     
    
        public override void Calculate(int index)
        {

    string L1vL2 = "             " + Math.Round((sma1.Result[index] - sma2.Result[index]) / Symbol.PipSize,0);
    string L1vL3 = "\n             " + Math.Round((sma3.Result[index] - sma4.Result[index]) / Symbol.PipSize,0);    
    string L1vL4 = "\n\n             " + Math.Round((sma5.Result[index] - sma6.Result[index]) / Symbol.PipSize,0);
    string L1vL5 = "\n\n\n             " + Math.Round((sma7.Result[index] - sma8.Result[index]) / Symbol.PipSize,0);    
    string L1vL6 = "                     " + Math.Round((sma9.Result[index] - sma10.Result[index]) / Symbol.PipSize,0);
    string L1vL7 = "\n                     " + Math.Round((sma11.Result[index] - sma12.Result[index]) / Symbol.PipSize,0);      
    string L4vL7 = "\n\n                     " + Math.Round((sma13.Result[index] - sma14.Result[index]) / Symbol.PipSize,0);   
    ChartObjects.DrawText("Labels", 
    "L1vL2:" + "\n"
    + "L1vL3:" + "\n"
    + "L1vL4:" + "\n"
    + "L1vL5:" + "\n"
    , StaticPosition.TopLeft, Colors.Green);
    ChartObjects.DrawText("Labels2",
    "L1vL6:" + "\n"
    + "L1vL7:" + "\n"
    + "L4vL7:" + "\n"
    , StaticPosition.TopCenter, Colors.Green);

    ChartObjects.DrawText("L1vL2", L1vL2, StaticPosition.TopLeft, Colors.LightBlue);
    ChartObjects.DrawText("L1vL3", L1vL3, StaticPosition.TopLeft, Colors.LightBlue);   
    ChartObjects.DrawText("L1vL4", L1vL4, StaticPosition.TopLeft, Colors.LightBlue);
    ChartObjects.DrawText("L1vL5", L1vL5, StaticPosition.TopLeft, Colors.LightBlue);   
    ChartObjects.DrawText("L1vL6", L1vL6, StaticPosition.TopCenter, Colors.LightBlue);
    ChartObjects.DrawText("L1vL7", L1vL7, StaticPosition.TopCenter, Colors.LightBlue);   
    ChartObjects.DrawText("L4vL7", L4vL7, StaticPosition.TopCenter, Colors.LightBlue);  
    }
   } 
}

Really like the new platform being able to execute all my open possitions at once is going to add to my profit, it all ready has good work.


@Scott

rkokerti
21 Feb 2013, 17:55

Hello,

Sorry, but cAlgo has the same problem!

As I mentioned above the displayed values of indicator are "NaN" on charts. Please investigate it.

Thanks


@rkokerti

cAlgo_Fanatic
21 Feb 2013, 17:55

Hi Scott,

We apologize for the inconvenience that this is causing. Please try to use cAlgo for the time being. The next release is soon. We will look at your code even though I suspect it the same issue.

Regards,


@cAlgo_Fanatic

cAlgo_Fanatic
22 Feb 2013, 11:01

We have identified the problem and are currently working on the solution. Again, we apologize for this inconvenience.

The problem has been identified to be affecting only indicators displayed on a separate panel.  A temporary workaround would be to modify the indicator to be overlayed on the chart.

  [Indicator(IsOverlay = true)]

 

For the tick chart indicator the workaround solution would be to access Symbol properties such as Ask and Bid via the Depth of Market. Other Symbol properties such as the Symbol code, pipsize may be input parameters or hardcoded.

TickChart Modified code:

using System;
using cAlgo.API;

namespace cAlgo.Indicators
{
    [Indicator(ScalePrecision = 5, IsOverlay = false)]
    public class TickChart : Indicator
    {
        [Parameter("Symbol Code", DefaultValue = "EURUSD")]
        public string SymbolCode { get; set; }

        [Parameter("PipSize", DefaultValue = 0.00001)]
        public double PipSize { get; set; }

        [Output("Ask", Color = Colors.Blue)]
        public IndicatorDataSeries Ask { get; set; }

        [Output("Bid", Color = Colors.Red)]
        public IndicatorDataSeries Bid { get; set; }

        private MarketDepth depth;
        private double ask;
        private double bid;

        protected override void Initialize()
        {
            depth = MarketData.GetMarketDepth(SymbolCode); // We must explicitly specify symbol code here
            depth.Updated += OnDepthUpdated;
        }

        private void OnDepthUpdated()
        {
            if (depth.AskEntries.Count > 0 && depth.BidEntries.Count > 0)
            {
                ask = depth.AskEntries[0].Price;
                bid = depth.BidEntries[0].Price;

                ChartObjects.DrawText("QuotesLabel", "BID: " + bid + ", ASK: " + ask, StaticPosition.TopCenter);
            }
        }
        private static void ShiftDataSeries(IndicatorDataSeries dataSeries)
        {
            for (var i = 0; i < dataSeries.Count - 1; i++)
            {
                dataSeries[i] = dataSeries[i + 1];
            }
        }

        private static void FillDataSeries(IndicatorDataSeries dataSeries, double value, int startIndex, int count)
        {
            for (var i = startIndex; i < startIndex + count; i++)
                dataSeries[i] = value;
        }

        public override void Calculate(int index)
        {
            if (!IsRealTime)
                return;

            if (!double.IsNaN(Ask[index]))
            {
                ShiftDataSeries(Ask);
                ShiftDataSeries(Bid);
            }

            FillDataSeries(Ask, ask, index, 50);
            FillDataSeries(Bid, bid, index, 50);

            var spread = Math.Round((ask - bid) / PipSize, 1);
            ChartObjects.DrawText("Spread label", "Spread:\t" + spread + " pips", StaticPosition.BottomRight);
        }

        
    }
}




The next release will be between 27/2 and 05/03. 


@cAlgo_Fanatic

flashpipuk
22 Feb 2013, 11:04

This happens everytime theres an update. Nothing seems to work again and again and yet again. Its getting some what anoying. Also why is my profit on the new market order on the euro/usd now calculated in euros yet on a limit order its calculated in gbp. i have to say that over the course of the last year that ive been using this kit i very much doubt you guys test anything before you release the update. Is it beyond your scope of development to bother to test your work. Also how long does it take to develop a trailing stop thats built into the program as standard. A basic feature in most trading programs. Yet still not in c trader.


@flashpipuk

cAlgo_Fanatic
22 Feb 2013, 11:28

Can you please send us a screenshot of this. Why do you think it is calculated in GBP? 


@cAlgo_Fanatic

flashpipuk
22 Feb 2013, 11:57

im not usualy this grumpy in the morning and i really do like the kit but these little things start to add up to a lot over the course of time. click the scroll> market order next to the word profit (eur) yet you then click on limit order then next to the word profit (gbp) then check stop order this also says profit(GBP) so what is it GBP or EUR?


@flashpipuk

cAlgo_Fanatic
22 Feb 2013, 12:46

RE:
flashpipuk said:

im not usualy this grumpy in the morning and i really do like the kit but these little things start to add up to a lot over the course of time. click the scroll> market order next to the word profit (eur) yet you then click on limit order then next to the word profit (gbp) then check stop order this also says profit(GBP) so what is it GBP or EUR?

The issue lies with updating the text string from EUR to the account's currency. The correct is the account's currency, in your case I presume GBP. It will be fixed in the next release. Again, we apologize for the error and thank you for your patience while we resolve this.

Regards,


@cAlgo_Fanatic

Scott
22 Feb 2013, 21:58 ( Updated at: 21 Dec 2023, 09:20 )

RE:
cAlgo_Fanatic said:

Hi Scott,

We apologize for the inconvenience that this is causing. Please try to use cAlgo for the time being. The next release is soon. We will look at your code even though I suspect it the same issue.

Regards,

Hi Support 

Got it working by having it as a overlay on the chart, however there seams to be a problem with USDJPY its not showing the last 3 calculations see below

Thanks


@Scott

cAlgo_Fanatic
25 Feb 2013, 11:14 ( Updated at: 21 Dec 2023, 09:20 )

If you changed the code please repost it so that we can investigate. The original code you posted with the only modification of overlaying the output on the chart produces this result:


@cAlgo_Fanatic