Description
I made this to see if it would work.
How NOT TO code.
What you are looking at is a simple Candle Recolour over highs and lows on Wilder 14 average,
Only it's a single line of code ha ha ha.
using cAlgo.API;using cAlgo.API.Indicators;namespace cAlgo{[Indicator(IsOverlay = true, AccessRights = AccessRights.None)]public class C31 : Indicator{MovingAverage MAM; MovingAverage MAH; MovingAverage MAL;protected override void Initialize(){MAM = Indicators.WellesWilderSmoothing (Bars.ClosePrices, 14);MAH = Indicators.WellesWilderSmoothing (Bars.HighPrices, 14);MAL = Indicators.WellesWilderSmoothing (Bars.LowPrices, 14);}public override void Calculate(int index){if ( Bars.ClosePrices.Last(0) > MAM.Result [index] + ( MAH.Result[index] * (3*0.0001)) )Chart.SetBarColor(index, "Lime" );if ( Bars.ClosePrices.Last(0) < MAM.Result [index] + ( MAH.Result[index] * (3*0.0001)) && Bars.ClosePrices.Last(0) > MAM.Result [index] - ( MAL.Result[index] * (3*0.0001)) )Chart.SetBarColor(index, "Orange" );if ( Bars.ClosePrices.Last(0) < MAM.Result [index] - ( MAL.Result[index] * (3*0.0001)) )Chart.SetBarColor(index, "Red" );}}}
It is supposed to look like this
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
public class C3 : Indicator
{
[Parameter("Band", DefaultValue = 3)] // This code lets you adjust the High Low Band
public int B { get; set; }
MovingAverage MAM;MovingAverage MAH;MovingAverage MAL;
protected override void Initialize()
{
MAM = Indicators.WellesWilderSmoothing (Bars.ClosePrices, 14);
MAH = Indicators.WellesWilderSmoothing (Bars.HighPrices, 14);
MAL = Indicators.WellesWilderSmoothing (Bars.LowPrices, 14);
}
public override void Calculate(int index)
{ // Also a different way to calculate the High Low band
var X =(B*0.0001);
if ( Bars.ClosePrices.Last(0) > MAM.Result [index] + ( MAH.Result[index] * (X)) )
Chart.SetBarColor(index, "Lime" );
if ( Bars.ClosePrices.Last(0) < MAM.Result [index] + ( MAH.Result[index] * (X))
&&
Bars.ClosePrices.Last(0) > MAM.Result [index] - ( MAL.Result[index] * (X)) )
Chart.SetBarColor(index, "Orange" );
if ( Bars.ClosePrices.Last(0) < MAM.Result [index] - ( MAL.Result[index] * (X)) )
Chart.SetBarColor(index, "Red" );
}
}
}
The author decided to hide the source code.
VEI5S6C4OUNT0
Joined on 06.12.2022
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: C31.algo
- Rating: 5
- Installs: 594
- Modified: 12/10/2023 11:22