Description
OrglobalFx Ichimoku Multitimeframe Display
Works on Renko Chart
/*
OrglobalFx Ichimoku 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_ICHI_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; }
//Declarations
public IchimokuKinkoHyo _ichi;
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)
{
return MarketData.GetBars(_tf);
}
//The Logic Function
public void logicfunction(TimeFrame _tf)
{
//SSL Initialization
_ichi = Indicators.IchimokuKinkoHyo(seriestf(_tf), 9, 26, 52);
//ichimoku
var kijun = _ichi.KijunSen;
var tensen = _ichi.TenkanSen;
var chiku = _ichi.ChikouSpan;
var sekuA = _ichi.SenkouSpanA;
var sekuB = _ichi.SenkouSpanB;
//Kumo cloud
var cloudupper = Math.Max(sekuA.Last(26), sekuB.Last(26));
var cloudlower = Math.Min(sekuA.Last(26), sekuB.Last(26));
var price = seriestf(_tf).ClosePrices;
var longpricekumo = price.Last(0) > cloudupper && sekuA.Last(0) > sekuB.Last(0);
var shortpricekumo = price.Last(0) < cloudlower && sekuA.Last(0) < sekuB.Last(0);
//Tensen above Kijun or otherwise
var longtensenkijun = tensen.Last(0) > kijun.Last(0);
var shorttensenkijun = tensen.Last(0) < kijun.Last(0);
//Chiku spann above /below price 26 bars behind
var longchikuprice = chiku.Last(1) > seriestf(_tf).HighPrices.Last(26);
var shortchikuprice = chiku.Last(1) < seriestf(_tf).LowPrices.Last(26);
//Checks if the the kumo has flipped
var longkumoflip = sekuA.Last(0) > sekuB.Last(0);
var shortkumoflip = sekuA.Last(0) < sekuB.Last(0);
//Checks if price has crossed above/below the tensen provided that the tensen is above the kijun or otherwise
var shortpricetensen = price.Last(0) < tensen.Last(0) && tensen.Last(0) < kijun.Last(0);
var longpricetensen = price.Last(0) > tensen.Last(0) && tensen.Last(0) > kijun.Last(0);
//Checks if price has crossed above/below the kijun
var longpricekijun = price.Last(0) > kijun.Last(0);
var shortpricekijun = price.Last(0) < kijun.Last(0);
//Checks if kijun is greater or less than cloud
var longkijuncloud = kijun.Last(0) > cloudupper;
var shortkijuncloud = kijun.Last(0) < cloudlower;
//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 (longpricekumo && longchikuprice && longtensenkijun && longkumoflip && longkijuncloud)
{
lbal = " " + _tf.ToString() + " BULLISH";
}
//Bear Condition. Inverse of Bullish
if (shortpricekumo && shortchikuprice && shorttensenkijun && shortkumoflip && shortkijuncloud)
{
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
Joined on 03.03.2021
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: _OFX_IND_111320210350_ICHI_MTF.algo
- Rating: 0
- Installs: 1214
- Modified: 31/03/2022 14:21
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
No comments found.