I have another question
I wrote an indicator and I would like to change 1 of the variables "MoveUpAfterLow" from int to double
because I want to change the value 10 in (High[0]/200)
Is this possible?
I hereby send you the parts of the code
namespace NinjaTrader.NinjaScript.Indicators
{
public class LongDOWJONES1minBestPRT1401 : Indicator
{
// Internal variables
bool hammer = false;
double irsi = 0;
int tolowrsi = 0;
double point1v, point2v,point3v,RSI1,RSI2,LOW1,LOW2,CLOSE1,CLOSE2;
int point1bar,point2bar,point3bar;
RSI rsi;
bool bInit = false;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Mijn indicator uit PRT";
Name = "LongDOWJONES1minBestPRT1401";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = true;
//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;
// Input default values
RSIbottom1 = 28;
MoveUpAfterLow = 10;
NumberOfBars = 35;
Laagstersiwaarde = 20;
RSI_Period = 14;
//Plots/Lines
AddPlot(new Stroke(Brushes.LimeGreen, 2), PlotStyle.TriangleUp, "CompletedSignal");
}
else if (State == State.Configure)
{
}
else if (State == State.DataLoaded)
{
tolowrsi = 0;
rsi = RSI(RSI_Period,1);
}
}
protected override void OnBarUpdate()
{
if (Calculate != Calculate.OnBarClose)
{
if (CurrentBar < 5)
Draw.TextFixed(this,"COBC",Name+" must run with Calculate set to OnBarClose",TextPosition.Center,Brushes.Red,new SimpleFont("Tahoma",20),Brushes.Red,Brushes.LightP ink,100);
return;
}
if (CurrentBar < 75)
return; // there is a lookback in here hardwired to 75!
if (!bInit)
{
//my setup search system
RSI1=1000;
RSI2=1000;
LOW1=Close[0]*100;
LOW2=Close[0]*100;
CLOSE1=Close[0]*100;
bInit = true;
return;
}
RSI1=1000;
RSI2=1000;
LOW1=Close[0]*100;
LOW2=Close[0]*100;
CLOSE1=Close[0]*100;
bInit = true;
return;
}
*
*
*
then all the code of the indicator
And then
#region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
private LongDOWJONES1minBestPRT1401[] cacheLongDOWJONES1minBestPRT1401;
public LongDOWJONES1minBestPRT1401 LongDOWJONES1minBestPRT1401(int rSIbottom1, int moveUpAfterLow, int numberOfBars, int laagstersiwaarde, int rSI_Period)
{
return LongDOWJONES1minBestPRT1401(Input, rSIbottom1, moveUpAfterLow, numberOfBars, laagstersiwaarde, rSI_Period);
}
public LongDOWJONES1minBestPRT1401 LongDOWJONES1minBestPRT1401(ISeries<double> input, int rSIbottom1, int moveUpAfterLow, int numberOfBars, int laagstersiwaarde, int rSI_Period)
{
if (cacheLongDOWJONES1minBestPRT1401 != null)
for (int idx = 0; idx < cacheLongDOWJONES1minBestPRT1401.Length; idx++)
if (cacheLongDOWJONES1minBestPRT1401[idx] != null && cacheLongDOWJONES1minBestPRT1401[idx].RSIbottom1 == rSIbottom1 && cacheLongDOWJONES1minBestPRT1401[idx].MoveUpAfterLow == moveUpAfterLow && cacheLongDOWJONES1minBestPRT1401[idx].NumberOfBars == numberOfBars && cacheLongDOWJONES1minBestPRT1401[idx].Laagstersiwaarde == laagstersiwaarde && cacheLongDOWJONES1minBestPRT1401[idx].RSI_Period == rSI_Period && cacheLongDOWJONES1minBestPRT1401[idx].EqualsInput(input))
return cacheLongDOWJONES1minBestPRT1401[idx];
return CacheIndicator<LongDOWJONES1minBestPRT1401>(new LongDOWJONES1minBestPRT1401(){ RSIbottom1 = rSIbottom1, MoveUpAfterLow = moveUpAfterLow, NumberOfBars = numberOfBars, Laagstersiwaarde = laagstersiwaarde, RSI_Period = rSI_Period }, input, ref cacheLongDOWJONES1minBestPRT1401);
}
}
}
namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
{
public Indicators.LongDOWJONES1minBestPRT1401 LongDOWJONES1minBestPRT1401(int rSIbottom1, int moveUpAfterLow, int numberOfBars, int laagstersiwaarde, int rSI_Period)
{
return indicator.LongDOWJONES1minBestPRT1401(Input, rSIbottom1, moveUpAfterLow, numberOfBars, laagstersiwaarde, rSI_Period);
}
public Indicators.LongDOWJONES1minBestPRT1401 LongDOWJONES1minBestPRT1401(ISeries<double> input , int rSIbottom1, int moveUpAfterLow, int numberOfBars, int laagstersiwaarde, int rSI_Period)
{
return indicator.LongDOWJONES1minBestPRT1401(input, rSIbottom1, moveUpAfterLow, numberOfBars, laagstersiwaarde, rSI_Period);
}
}
}
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{
public Indicators.LongDOWJONES1minBestPRT1401 LongDOWJONES1minBestPRT1401(int rSIbottom1, int moveUpAfterLow, int numberOfBars, int laagstersiwaarde, int rSI_Period)
{
return indicator.LongDOWJONES1minBestPRT1401(Input, rSIbottom1, moveUpAfterLow, numberOfBars, laagstersiwaarde, rSI_Period);
}
public Indicators.LongDOWJONES1minBestPRT1401 LongDOWJONES1minBestPRT1401(ISeries<double> input , int rSIbottom1, int moveUpAfterLow, int numberOfBars, int laagstersiwaarde, int rSI_Period)
{
return indicator.LongDOWJONES1minBestPRT1401(input, rSIbottom1, moveUpAfterLow, numberOfBars, laagstersiwaarde, rSI_Period);
}
}
}
#endregion
Kind regards,
Ladis
Comment