Wrong Monthly Hi Lo Values

Created at 28 Mar 2016, 22:01
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!
GoldnOil750's avatar

GoldnOil750

Joined 07.04.2015

Wrong Monthly Hi Lo Values
28 Mar 2016, 22:01


Hi Spotware,

trying to develop an indicator to draw lines on Monthly "Hi or Lo" Values.  And it is strange that it is drawing something totally wrong.   Using GBPUSD 15-min Chart.

 

Also, if Monthly Time Frame is chosen, the current month Candle is not showing. 

 

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.Text;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class DrawPrevHiLo : Indicator
    {
        ////////////////////////////////////////////////////////////////////////////////
        ///                         GLOBAL VARIABLES                                 ///
        ////////////////////////////////////////////////////////////////////////////////

        private MarketSeries my_Series_Monthly;
        double This_Monthly_Hi, This_Monthly_Lo;

        ////////////////////////////////////////////////////////////////////////////////
        ///                         INITIALIZE                                       ///
        ////////////////////////////////////////////////////////////////////////////////
        protected override void Initialize()
        {
            try
            {
                my_Series_Monthly = MarketData.GetSeries(Symbol, TimeFrame.Monthly);

            } catch
            {
            }
        }
        //END METHOD INITIALIZE

        ////////////////////////////////////////////////////////////////////////////////
        ///                         CALCULATE                                        ///
        ////////////////////////////////////////////////////////////////////////////////
        public override void Calculate(int index)
        {
            // THIS MONTH Hi-Lo VALUE
            //This_Monthly_Hi = my_Series_Monthly.High.LastValue;
            //This_Monthly_Lo = my_Series_Monthly.Low.LastValue;

            This_Monthly_Hi = my_Series_Monthly.High.Last(0);
            This_Monthly_Lo = my_Series_Monthly.Low.Last(0);

            // ---------------------------------------------------------------------------------------------------------
            //  DRAW LINES THROUGH : DAILY
            // ---------------------------------------------------------------------------------------------------------

            // DRAW THIS MONTH Hi-Lo LINES
            ChartObjects.DrawHorizontalLine("TMHL01", (This_Monthly_Hi), Colors.Yellow, 2, LineStyle.Lines);
            ChartObjects.DrawHorizontalLine("TMLL01", (This_Monthly_Lo), Colors.Yellow, 2, LineStyle.Lines);
            // DRAW TEXT ABOVE LINE
            ChartObjects.DrawText("TMHL03", "+Hi This Month", (index + 25), This_Monthly_Hi, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Yellow);
            ChartObjects.DrawText("TMLL04", "-Lo This Month", (index + 25), This_Monthly_Lo, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Yellow);

        }
        //END METHOD CALCULATE

    }
    //END class DisplayDWMPipsonCharts
}
//END namespace cAlgo


@GoldnOil750
Replies

GoldnOil750
29 Mar 2016, 07:30 ( Updated at: 21 Dec 2023, 09:20 )

seems some correction has been done, but a new problem has arrived.  Have attached more Screen Shots.

 

if you set the value to "0" in this below code, you get  THIS MONTH (i.e. March), Hi & Lo :

This_Monthly_Hi = my_Series_Monthly.High.Last(0);

This_Monthly_Lo = my_Series_Monthly.Low.Last(0);

 

 

 

 

BUT if you set the value to "1" in this below code, you get JAN, Hi & Lo instead of Feb Hi-Lo :

This_Monthly_Hi = my_Series_Monthly.High.Last(1);

This_Monthly_Lo = my_Series_Monthly.Low.Last(1);

 

 

DEAR  SPOTWARE,

THIS IS very upsetting that we still have to face these kind of issues.  There is no excuse for these errors !!!  Traders will simply lose money as the indicator will be pointing out a TOTALLY WRONG VALUE !!!!!!!!!!!!!

Please correct this at your earliest and cross-check it in the cBOT code also.  Traders will simply switch back to MT4.

 

Till date, my earlier issue of getting very "SLOW" opening price is not resolved.  cBot still takes 3 to 4 mins and many times just sleep for hours.  On the other hand MT4 get you the price (open, high, low, close)  within seconds of all 28 pairs.

 

Maybe, SPOTWARE focus is on "manual traders" more, as the platform is simply awesome if you want to do manual trading except for the part of @hanging@ on the news. cTRADER platforms hangs everytime.

 

Anyways, please correct this issue of wrong @Hi & Lo@.  Thank you.

 

 


@GoldnOil750

cyfer
29 Mar 2016, 08:45 ( Updated at: 21 Dec 2023, 09:20 )

I Can't find anything wrong with Hi & Lo from GetSeries

 

 private MarketSeries M_Series;

        protected override void Initialize()
        {
            M_Series = MarketData.GetSeries(Symbol, TimeFrame.Monthly);

        }

        public override void Calculate(int index)
        {
            ChartObjects.DrawHorizontalLine("HI", M_Series.High.Last(0), Colors.Green);
            ChartObjects.DrawHorizontalLine("LO", M_Series.Low.Last(0), Colors.Yellow);
        }

 Just this code works very fine with no problem , and if you set it to .Last(whatever) it works accurately .

One thing though that may cause confusion here , The Time Zone you set at the lower right end of cTrader Interface 

here is an example of My Zone +2 & then ServerTime Zone (Pepperstone )

 

 


@cyfer

GoldnOil750
29 Mar 2016, 08:54 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Now, change the "0" to "1" and see that it will draw lines on the month of Jan instead of Feb.

 

cyfer said:

I Can't find anything wrong with Hi & Lo from GetSeries

 

 private MarketSeries M_Series;

        protected override void Initialize()
        {
            M_Series = MarketData.GetSeries(Symbol, TimeFrame.Monthly);

        }

        public override void Calculate(int index)
        {
            ChartObjects.DrawHorizontalLine("HI", M_Series.High.Last(0), Colors.Green);
            ChartObjects.DrawHorizontalLine("LO", M_Series.Low.Last(0), Colors.Yellow);
        }

 Just this code works very fine with no problem , and if you set it to .Last(whatever) it works accurately .

One thing though that may cause confusion here , The Time Zone you set at the lower right end of cTrader Interface 

here is an example of My Zone +2 & then ServerTime Zone (Pepperstone )

 

 

 


@GoldnOil750

cyfer
29 Mar 2016, 09:34 ( Updated at: 21 Dec 2023, 09:20 )

I can't really see what you mean .. it is working as it should 

a simpler way to look at this is to set the chart time frame to Monthly and see where your lines are drawn .. if they match the H & L of the monthly candle .. then its working fine

 

 


@cyfer

GoldnOil750
29 Mar 2016, 09:55 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Yup, it is working now perfectly.   But please do see my earlier screen shots and it was drawing the wrong lines.   spotware must have corrected the error.    like for the current month, it was first drawing on the current week (my 1st post) and then when i complained, that was corrected but was drawing wrong on prev. month hi & lo and when i complained about that (2nd post), it is now seems corrected.

 

Isn't this strange that you have to make complain for these fundamental functions to be correct.   It is not the first time, I have seen these kind of prices issues.  I have also seen two different prices on cALGO and cTRADER platform with same broker.  hahahaha...........

 

cyfer said:

I can't really see what you mean .. it is working as it should 

a simpler way to look at this is to set the chart time frame to Monthly and see where your lines are drawn .. if they match the H & L of the monthly candle .. then its working fine

 

 

 


@GoldnOil750