Advertisement
Guest User

Untitled

a guest
Dec 31st, 2020
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1. namespace NinjaTrader.NinjaScript.Indicators
  2. {
  3.     public class TestRSI : Indicator
  4.     {
  5.         private RSI myRSI;
  6.        
  7.         protected override void OnStateChange()
  8.         {
  9.             if (State == State.SetDefaults)
  10.             {
  11.                 Description                                 = @"Enter the description for your new custom Indicator here.";
  12.                 Name                                        = "TestRSI";
  13.                 Calculate                                   = Calculate.OnBarClose;
  14.                 IsOverlay                                   = true;
  15.                 DisplayInDataBox                            = true;
  16.                 DrawOnPricePanel                            = true;
  17.                 DrawHorizontalGridLines                     = true;
  18.                 DrawVerticalGridLines                       = true;
  19.                 PaintPriceMarkers                           = true;
  20.                 ScaleJustification                          = NinjaTrader.Gui.Chart.ScaleJustification.Right;
  21.                 //Disable this property if your indicator requires custom values that cumulate with each new market data event.
  22.                 //See Help Guide for additional information.
  23.                 IsSuspendedWhileInactive                    = true;
  24.             }
  25.             else if (State == State.Configure)
  26.             {
  27.             }
  28.             else if (State == State.DataLoaded)
  29.             {
  30.                 myRSI = RSI(Close, 20, 5);
  31.             }
  32.         }
  33.  
  34.         protected override void OnBarUpdate()
  35.         {
  36.             if(CurrentBar < 20) return;
  37.             Print(myRSI[0]);
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement