public class MyCustomStrategy12 : Strategy
{
private RSI RSI1;
private RSI RSI2;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "differencearrosrsi";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = false;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
Difference_Amount =40;
AddPlot(Brushes.Goldenrod, "Difference");
}
else if (State == State.Configure)
{
RSI1 = RSI(Close, 8, 3);
RSI2 = RSI(Close, 14, 3);
}
protected override void OnBarUpdate()
{
Difference[0] = RSI1[0] - RSI2[0];
if (Difference[0] < -Difference_Amount && CrossAbove(RSI2,30,1))
{
Draw.TriangleDown(this, @"MyCustomStrategy12 Triangle down_1", false, 0, (High[0] /*+ (4 * TickSize)*/) , Brushes.Red);
else if (Difference[0] > Difference_Amount && CrossBelow(RSI1,-30,1))
{
Draw.TriangleUp(this, @"MyCustomStrategy12 Triangle up_1", false, 0, (Low[0] /*+ (-4 * TickSize)*/) , Brushes.DodgerBlue);
}

Comment