Real Time Indicator

Created at 12 Apr 2013, 21:17
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

Real Time Indicator
12 Apr 2013, 21:17


Hi Support

Please could you help me with the following.

I would like the 233 SMA to not show on the chart till its is equal to or less than the Upper Band 3 or Lower Band 3 of the Fibonacci Indicator

Here is an example of what I'm trying to achevie. 

Thanks


@Scott
Replies

Scott
12 Apr 2013, 21:19

RE: the code for both indicators

//#reference: C:\Users\scott\Documents\cAlgo\Sources\Indicators\averageTrueRange.algo

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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true)]
    public class FibGrid7Chart : Indicator
    {
        private averageTrueRange _averageTrueRange;
        private ExponentialMovingAverage _exponentialMovingAverage;

        [Parameter(DefaultValue = 55)]
        public int PeriodEma { get; set; }

        [Parameter(DefaultValue = 21)]
        public int PeriodAtr { get; set; }

        [Output("Upper Band 1", Color = Colors.Aqua)]
        public IndicatorDataSeries UpperBand1 { get; set; }

        [Output("Upper Band 2", Color = Colors.DeepSkyBlue)]
        public IndicatorDataSeries UpperBand2 { get; set; }

        [Output("Upper Band 3", Color = Colors.DodgerBlue)]
        public IndicatorDataSeries UpperBand3 { get; set; }

        [Output("Upper Band 4", Color = Colors.Aquamarine)]
        public IndicatorDataSeries UpperBand4 { get; set; }

        [Output("Lower Band 1", Color = Colors.Aqua)]
        public IndicatorDataSeries LowerBand1 { get; set; }

        [Output("Lower Band 2", Color = Colors.DeepSkyBlue)]
        public IndicatorDataSeries LowerBand2 { get; set; }

        [Output("Lower Band 3", Color = Colors.DodgerBlue)]
        public IndicatorDataSeries LowerBand3 { get; set; }

        [Output("Lower Band 4", Color = Colors.Aquamarine)]
        public IndicatorDataSeries LowerBand4 { get; set; }

        [Output("EMA", Color = Colors.Purple)]
        public IndicatorDataSeries Ema { get; set; }

        protected override void Initialize()
        {
            _averageTrueRange = Indicators.GetIndicator<averageTrueRange>(PeriodAtr);
            _exponentialMovingAverage = Indicators.ExponentialMovingAverage(MarketSeries.Close, PeriodEma);
        }


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

            for (int i = index - 10; i <= index; i++)
            {
                double ema = _exponentialMovingAverage.Result[index];
                double atr = _averageTrueRange.atr[index];

                UpperBand1[i] = ema + 1.62*atr;
                UpperBand2[i] = ema + 2.62*atr;
                UpperBand3[i] = ema + 4.23*atr;
                UpperBand4[i] = ema + 1*atr;
                LowerBand1[i] = ema - 1.62*atr;
                LowerBand2[i] = ema - 2.62*atr;
                LowerBand3[i] = ema - 4.23*atr;
                LowerBand4[i] = ema - 1*atr;

                Ema[i] = ema;
            }
            for (int i = 0; i < index - 10; i++)
            {
                UpperBand1[i] = double.NaN;
                UpperBand2[i] = double.NaN;
                UpperBand3[i] = double.NaN;
                UpperBand4[i] = double.NaN;
                LowerBand1[i] = double.NaN;
                LowerBand2[i] = double.NaN;
                LowerBand3[i] = double.NaN;
                LowerBand4[i] = double.NaN;

                Ema[i] = double.NaN;
            }

            int xPos = index + 1;
            double yPos = UpperBand1[index];
            string text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj1", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Aqua);

            yPos = UpperBand2[index];
            text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj2", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left,
                                  Colors.DeepSkyBlue);

            yPos = UpperBand3[index];
            text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj3", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left,
                                  Colors.DodgerBlue);

            yPos = UpperBand4[index];
            text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj4", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Aquamarine);

            yPos = LowerBand1[index];
            text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj5", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Aqua);
            yPos = LowerBand2[index];
            text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj6", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left,
                                  Colors.DeepSkyBlue);
            yPos = LowerBand3[index];
            text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj7", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left,
                                  Colors.DodgerBlue);
            yPos = LowerBand4[index];
            text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj8", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Aquamarine);
            
            yPos = Ema[index];
            text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj9", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Purple);
        }
    }
}

 

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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true)]
    public class FibGrid7Chart : Indicator
    {
        [Parameter]
        public DataSeries Source { get; set; }

        [Parameter("L1", DefaultValue = 21)]
        public int Periods { get; set; }
        [Parameter("L2", DefaultValue = 34)]
        public int Periods2 { get; set; }
        [Parameter("L3", DefaultValue = 55)]
        public int Periods3 { get; set; }

        [Parameter("L7", DefaultValue = 233)]
        public int Periods7 { get; set; }

        [Output("Level1", Color = Colors.Lime, Thickness = 5, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries Result { get; set; }
        [Output("Level2", Color = Colors.Yellow, Thickness = 5, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries Result2 { get; set; }
        [Output("Level3", Color = Colors.White, Thickness = 5, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries Result3 { get; set; }

        [Output("Level7", Color = Colors.Red, Thickness = 5, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries Result7 { get; set; }

        private SimpleMovingAverage _simpleMovingAverage1;
        private SimpleMovingAverage _simpleMovingAverage2;
        private SimpleMovingAverage _simpleMovingAverage3;        

        private SimpleMovingAverage _simpleMovingAverage7;


        protected override void Initialize()
        {
            _simpleMovingAverage1 = Indicators.SimpleMovingAverage(Source, Periods);
            _simpleMovingAverage2 = Indicators.SimpleMovingAverage(Source, Periods2);
            _simpleMovingAverage3 = Indicators.SimpleMovingAverage(Source, Periods3);

            _simpleMovingAverage7 = Indicators.SimpleMovingAverage(Source, Periods7);


        }


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

    for (int i = index - 10; i <= index; i++)
    {
        Result[i] = _simpleMovingAverage1.Result[index];
        Result2[i] = _simpleMovingAverage2.Result[index];
        Result3[i] = _simpleMovingAverage3.Result[index];

        Result7[i] = _simpleMovingAverage7.Result[index];
    }
    for(int i = 0; i < index - 10; i++)
    {
        Result[i] = double.NaN;
        Result2[i] = double.NaN;
        Result3[i] = double.NaN;

        Result7[i] = double.NaN;
    }
    int xPos = index + 1;
    double yPos = _simpleMovingAverage1.Result[index];
    var text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
    ChartObjects.DrawText("obj1", text, xPos, yPos, VerticalAlignment.Center, HorizontalAlignment.Left,Colors.Lime);

    yPos = _simpleMovingAverage2.Result[index];
    text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
    ChartObjects.DrawText("obj2", text, xPos, yPos, VerticalAlignment.Bottom, HorizontalAlignment.Left,Colors.Yellow);

    yPos = _simpleMovingAverage3.Result[index];
    text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
    ChartObjects.DrawText("obj3", text, xPos, yPos, VerticalAlignment.Center, HorizontalAlignment.Left,Colors.White);



    yPos = _simpleMovingAverage7.Result[index];
    text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
    ChartObjects.DrawText("obj7", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Red);
}
}
}

 

 

 


@Scott

cAlgo_Fanatic
22 Apr 2013, 12:43

You will have to reference the first indicator in the other (same as with the AverageTrueRange) and the SMA 233 will be set to a value if the condition your are describing is met.

// add the reference to FibGrid7Chart 

// in the global scope before any methods private FibGrid7Chart FibGrid7ChartIndicator;
// inside the for loop that displays the results in the caclulate method
//the 233 SMA to not show on the chart till its is equal to or less than the Upper Band 3 or Lower Band 3 of the Fibonacci Indicator bool condition = _simpleMovingAverage7.Result[index] <= FibGrid7ChartIndicator.Upperband3[index] || _simpleMovingAverage7.Result[index] <= FibGrid7ChartIndicator.LowerBand3.[index] if(condition) Result7[i] = _simpleMovingAverage7.Result[index];




@cAlgo_Fanatic

Scott
26 May 2013, 23:11

RE:
cAlgo_Fanatic said:

You will have to reference the first indicator in the other (same as with the AverageTrueRange) and the SMA 233 will be set to a value if the condition your are describing is met.

// add the reference to FibGrid7Chart 

// in the global scope before any methods private FibGrid7Chart FibGrid7ChartIndicator;
// inside the for loop that displays the results in the caclulate method
//the 233 SMA to not show on the chart till its is equal to or less than the Upper Band 3 or Lower Band 3 of the Fibonacci Indicator bool condition = _simpleMovingAverage7.Result[index] <= FibGrid7ChartIndicator.Upperband3[index] || _simpleMovingAverage7.Result[index] <= FibGrid7ChartIndicator.LowerBand3.[index] if(condition) Result7[i] = _simpleMovingAverage7.Result[index];



could you show me where the code goes I've tried mutiple combonations, I've followed your instructions but I carn't seem to work out where I'm going wrong,   thanks


@Scott

cAlgo_Fanatic
27 May 2013, 12:53

    private FibGrid7Chart FibGrid7ChartIndicator;

    protected override void Initialize()
    {
        FibGrid7ChartIndicator = Indicators.GetIndicator<FibGrid7Chart>(55, 21);
        // ...                        
    }
    public override void Calculate(int index)
    {
        if (!IsRealTime) return;

        bool condition = _simpleMovingAverage7.Result[index] <= FibGrid7ChartIndicator.UpperBand3[index]
                        || _simpleMovingAverage7.Result[index] <= FibGrid7ChartIndicator.LowerBand3[index];

        for (int i = index - 10; i <= index; i++)
        {
            Result[i] = _simpleMovingAverage1.Result[index];
            //...
            Result6[i] = _simpleMovingAverage6.Result[index];

            if (condition)
                Result7[i] = _simpleMovingAverage7.Result[index];

        }
        // ...

 


@cAlgo_Fanatic

Scott
29 May 2013, 22:11

RE:

Hi support

still carn't get this to work, I see that I posted the wrong information in the first place.

what i'm trying to do is the same but the indicator is the fibbandsRT indicator doesnt want to show the 233 SMA from the fiblevelsRT Indicator if the 233sma is above band3 of fibbandsRT or bottom band3

the code below shows the name changes as above and builds but now none of the sma will not show

the two indicators are on the site /algos/indicators/show/267    fibbandsRT and fiblevelsRT 

 

//#reference: C:\Users\scott\Documents\cAlgo\Sources\Indicators\fibbandsRT.algo
using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true)]
    public class fiblevelsRT : Indicator
    {
        private fiblevelsRT fiblevelsRTIndicator;    
        private fibbandsRT fibbandsRTIndicator;
       
        [Parameter]
        public DataSeries Source { get; set; }

        [Parameter("L1", DefaultValue = 21)]
        public int Periods { get; set; }
        [Parameter("L2", DefaultValue = 34)]
        public int Periods2 { get; set; }
        [Parameter("L3", DefaultValue = 55)]
        public int Periods3 { get; set; }

        [Parameter("L7", DefaultValue = 233)]
        public int Periods7 { get; set; }

        [Output("Level1", Color = Colors.Lime, Thickness = 5, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries Result { get; set; }
        [Output("Level2", Color = Colors.Yellow, Thickness = 5, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries Result2 { get; set; }
        [Output("Level3", Color = Colors.White, Thickness = 5, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries Result3 { get; set; }

        [Output("Level7", Color = Colors.Red, Thickness = 5, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries Result7 { get; set; }

        private SimpleMovingAverage _simpleMovingAverage1;
        private SimpleMovingAverage _simpleMovingAverage2;
        private SimpleMovingAverage _simpleMovingAverage3;        

        private SimpleMovingAverage _simpleMovingAverage7;


        protected override void Initialize()
        {
            _simpleMovingAverage1 = Indicators.SimpleMovingAverage(Source, Periods);
            _simpleMovingAverage2 = Indicators.SimpleMovingAverage(Source, Periods2);
            _simpleMovingAverage3 = Indicators.SimpleMovingAverage(Source, Periods3);

            _simpleMovingAverage7 = Indicators.SimpleMovingAverage(Source, Periods7);


        }


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

bool condition = _simpleMovingAverage7.Result[index] <= fibbandsRTIndicator.UpperBand3[index]
                        || _simpleMovingAverage7.Result[index] <= fibbandsRTIndicator.LowerBand3[index];
                        
    for (int i = index - 10; i <= index; i++)
        {
        
        Result[i] = _simpleMovingAverage1.Result[index];
        Result2[i] = _simpleMovingAverage2.Result[index];
        Result3[i] = _simpleMovingAverage3.Result[index];

        Result7[i] = _simpleMovingAverage7.Result[index];
     }
    for(int i = 0; i < index - 10; i++)
    {
        Result[i] = double.NaN;
        Result2[i] = double.NaN;
        Result3[i] = double.NaN;

        Result7[i] = double.NaN;
    }
    
     for (int i = index - 10; i <= index; i++)
        {
            Result[i] = _simpleMovingAverage1.Result[index];
            //...
            Result7[i] = _simpleMovingAverage7.Result[index];

            if (condition)
                Result7[i] = _simpleMovingAverage7.Result[index];

        }
    
    int xPos = index + 1;
    double yPos = _simpleMovingAverage1.Result[index];
    var text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
    ChartObjects.DrawText("obj1", text, xPos, yPos, VerticalAlignment.Center, HorizontalAlignment.Left,Colors.Lime);

    yPos = _simpleMovingAverage2.Result[index];
    text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
    ChartObjects.DrawText("obj2", text, xPos, yPos, VerticalAlignment.Bottom, HorizontalAlignment.Left,Colors.Yellow);

    yPos = _simpleMovingAverage3.Result[index];
    text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
    ChartObjects.DrawText("obj3", text, xPos, yPos, VerticalAlignment.Center, HorizontalAlignment.Left,Colors.White);



    yPos = _simpleMovingAverage7.Result[index];
    text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
    ChartObjects.DrawText("obj7", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Red);
}
}
}


@Scott

cAlgo_Fanatic
30 May 2013, 12:20

Try to copy paste the following code into the Calculate method and tell us if it is what you need:

            if (!IsRealTime) return;

            bool condition = _simpleMovingAverage7.Result[index] >= fibbandsRTIndicator.UpperBand3[index]
                            || _simpleMovingAverage7.Result[index] <= fibbandsRTIndicator.LowerBand3[index];

            
            for (int i = 0; i < index - 10; i++)
            {
                Result[i] = double.NaN;
                Result2[i] = double.NaN;
                Result3[i] = double.NaN;

                Result7[i] = double.NaN;
            }

            for (int i = index - 10; i <= index; i++)
            {
                 Result[i] = _simpleMovingAverage1.Result[index];
        		 Result2[i] = _simpleMovingAverage2.Result[index];
        		 Result3[i] = _simpleMovingAverage3.Result[index];
                 
                 if (condition)
                    Result7[i] = _simpleMovingAverage7.Result[index];

            }

            int xPos = index + 1;
            double yPos = _simpleMovingAverage1.Result[index];
            var text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj1", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left,
                                  Colors.Lime);

            yPos = _simpleMovingAverage2.Result[index];
            text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj2", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left,
                                  Colors.Yellow);

            yPos = _simpleMovingAverage3.Result[index];
            text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj3", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left,
                                  Colors.White);


	    if (condition)
            {
            	yPos = _simpleMovingAverage7.Result[index];
            	text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            	ChartObjects.DrawText("obj7", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Red);
            }



I also wanted to let you know that you only uploaded the averageTrueRange Indicator here:  /algos/indicators/show/267

 


@cAlgo_Fanatic

Scott
30 May 2013, 19:18 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Hi Support, It wouldn't build till I added 3 } at the bottom of the page and then it would build but the sma are not showing up on the chart, below is a screen shot and the code

I'm aware that I didn't put all the code in the download for the indicator as I thought that I would be able to have several downloads as a option as I published 3 indicators, I did put the code in the discription and made clear instuctions, I only did this as I had seen other indicators published this way, I will do a update as soon as I've got this problem solved 

thanks for all you help its always appreciated

//#reference: C:\Users\scott\Documents\cAlgo\Sources\Indicators\fibbandsRT.algo
using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true)]
    public class fiblevelsRT : Indicator
    {
        private fiblevelsRT fiblevelsRTIndicator;    
        private fibbandsRT fibbandsRTIndicator;
       
        [Parameter]
        public DataSeries Source { get; set; }

        [Parameter("L1", DefaultValue = 21)]
        public int Periods { get; set; }
        [Parameter("L2", DefaultValue = 34)]
        public int Periods2 { get; set; }
        [Parameter("L3", DefaultValue = 55)]
        public int Periods3 { get; set; }

        [Parameter("L7", DefaultValue = 233)]
        public int Periods7 { get; set; }

        [Output("Level1", Color = Colors.Lime, Thickness = 5, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries Result { get; set; }
        [Output("Level2", Color = Colors.Yellow, Thickness = 5, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries Result2 { get; set; }
        [Output("Level3", Color = Colors.White, Thickness = 5, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries Result3 { get; set; }

        [Output("Level7", Color = Colors.Red, Thickness = 5, LineStyle = LineStyle.DotsVeryRare)]
        public IndicatorDataSeries Result7 { get; set; }

        private SimpleMovingAverage _simpleMovingAverage1;
        private SimpleMovingAverage _simpleMovingAverage2;
        private SimpleMovingAverage _simpleMovingAverage3;        

        private SimpleMovingAverage _simpleMovingAverage7;


        protected override void Initialize()
        {
            _simpleMovingAverage1 = Indicators.SimpleMovingAverage(Source, Periods);
            _simpleMovingAverage2 = Indicators.SimpleMovingAverage(Source, Periods2);
            _simpleMovingAverage3 = Indicators.SimpleMovingAverage(Source, Periods3);

            _simpleMovingAverage7 = Indicators.SimpleMovingAverage(Source, Periods7);


        }


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

            bool condition = _simpleMovingAverage7.Result[index] >= fibbandsRTIndicator.UpperBand3[index]
                            || _simpleMovingAverage7.Result[index] <= fibbandsRTIndicator.LowerBand3[index];

            
            for (int i = 0; i < index - 10; i++)
            {
                Result[i] = double.NaN;
                Result2[i] = double.NaN;
                Result3[i] = double.NaN;

                Result7[i] = double.NaN;
            }

            for (int i = index - 10; i <= index; i++)
            {
                 Result[i] = _simpleMovingAverage1.Result[index];
                 Result2[i] = _simpleMovingAverage2.Result[index];
                 Result3[i] = _simpleMovingAverage3.Result[index];
                 
                 if (condition)
                    Result7[i] = _simpleMovingAverage7.Result[index];

            }

            int xPos = index + 1;
            double yPos = _simpleMovingAverage1.Result[index];
            var text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj1", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left,
                                  Colors.Lime);

            yPos = _simpleMovingAverage2.Result[index];
            text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj2", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left,
                                  Colors.Yellow);

            yPos = _simpleMovingAverage3.Result[index];
            text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
            ChartObjects.DrawText("obj3", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left,
                                  Colors.White);


        if (condition)
            {
                yPos = _simpleMovingAverage7.Result[index];
                text = String.Format("{0}", Math.Round(yPos, Symbol.Digits));
                ChartObjects.DrawText("obj7", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Red);
            }
            }
            }
            }
            
             


@Scott