Category Trend  Published on 18/03/2022

OrglobalFx SSL MultitimeFrame Display

Description

  OrglobalFx SSL MultitimeFrame Indicator with Color.

Contact:
Telegram: @orglobalng

For customizations.
E.g Telegram Alerts etc

 

 

 

 


/*
OrglobalFx SSL MultitimeFrame Indicator with Color.

Contact:
Telegram: @orglobalng

For customizations.
E.g Telegram Alerts etc

*/


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

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.EasternStandardTime, AccessRights = AccessRights.None)]
    public class _OFX_IND_111320210350_SSL_MTF : Indicator
    {
//Timeframe Selection Parameter
        [Parameter("Timeframe1", DefaultValue = "Monthly", Group = "TimeFrame")]
        public TimeFrame Time_frame1 { get; set; }
        [Parameter("Timeframe2", DefaultValue = "Weekly", Group = "TimeFrame")]
        public TimeFrame Time_frame2 { get; set; }
        [Parameter("Timeframe3", DefaultValue = "Daily", Group = "TimeFrame")]
        public TimeFrame Time_frame3 { get; set; }
        [Parameter("Timeframe4", DefaultValue = "Hour4", Group = "TimeFrame")]
        public TimeFrame Time_frame4 { get; set; }
        [Parameter("Timeframe5", DefaultValue = "Hourly", Group = "TimeFrame")]
        public TimeFrame Time_frame5 { get; set; }
        [Parameter("Timeframe6", DefaultValue = "Minute15", Group = "TimeFrame")]
        public TimeFrame Time_frame6 { get; set; }

//SSL Parameters
        [Parameter("Length", DefaultValue = 20, Group = "SSL")]
        public int _length { get; set; }
        [Parameter("MA Type", DefaultValue = MovingAverageType.Simple, Group = "SSL")]
        public MovingAverageType _MAType { get; set; }

//Declarations
        public SSLChannel _ssl2;
        public string lbal;

        protected override void Initialize()
        {
//Displays the Symbol name on the chart          
            Chart.DrawStaticText("symbol_label", SymbolName.ToString(), VerticalAlignment.Top, HorizontalAlignment.Left, Color.White);
        }

        public override void Calculate(int index)
        {
//Logic functions Usecase           
            logicfunction(Time_frame1);
            mycolor("a", "\n\n");

            logicfunction(Time_frame2);
            mycolor("b", "\n\n\n");

            logicfunction(Time_frame3);
            mycolor("c", "\n\n\n\n");

            logicfunction(Time_frame4);
            mycolor("d", "\n\n\n\n\n");

            logicfunction(Time_frame5);
            mycolor("e", "\n\n\n\n\n\n");

            logicfunction(Time_frame6);
            mycolor("f", "\n\n\n\n\n\n\n");
        }

//Bars function
        public Bars seriestf(TimeFrame _tf)
        {
            Bars series = MarketData.GetBars(_tf);
            return series;
        }

//The Logic Function
        public void logicfunction(TimeFrame _tf)
        {
//SSL Initialization
            _ssl2 = Indicators.GetIndicator<SSLChannel>(seriestf(_tf), _length, _MAType);

//Conditions for bullish
// Current Upper ssl is greater/above current lower ssl. And the current bar on the timeframe is greater than the ssl lines
            if (_ssl2._sslUp.Last(0) > _ssl2._sslDown.Last(0) && seriestf(_tf).ClosePrices.Last(0) > _ssl2._sslUp.Last(0) && seriestf(_tf).ClosePrices.Last(0) > _ssl2._sslDown.Last(0))
            {
                lbal = "    " + _tf.ToString() + "  BULLISH";
            }
//Bear Condition. Inverse of Bullish
            else if (_ssl2._sslUp.Last(0) < _ssl2._sslDown.Last(0) && seriestf(_tf).ClosePrices.Last(0) < _ssl2._sslUp.Last(0) && seriestf(_tf).ClosePrices.Last(0) < _ssl2._sslDown.Last(0))
            {
                lbal = "    " + _tf.ToString() + "  BEARISH";
            }
//            
            else
            {
                lbal = "    " + _tf.ToString() + "  NEUTRAL";
            }
        }

//Function to change the color depending on the signal
        public void mycolor(string tlabell, string llbl)
        {
            if (lbal.Contains("BULL"))
            {
                Chart.DrawStaticText(tlabell, llbl + lbal, VerticalAlignment.Top, HorizontalAlignment.Left, Color.Green);
            }
            else if (lbal.Contains("BEAR"))
            {
                Chart.DrawStaticText(tlabell, llbl + lbal, VerticalAlignment.Top, HorizontalAlignment.Left, Color.Red);
            }
            else if (lbal.Contains("NEU"))
            {
                Chart.DrawStaticText(tlabell, llbl + lbal, VerticalAlignment.Top, HorizontalAlignment.Left, Color.Yellow);
            }
        }
    }
}


Orglobalfx01's avatar
Orglobalfx01

Joined on 03.03.2021

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: _OFX_IND_111320210350_SSL_MTF.algo
  • Rating: 0
  • Installs: 1435
Comments
Log in to add a comment.
HU
hughescaroline498 · 2 years ago

Looks very interesting!