The issue is, getting the ADD function to recognize my line of code which includes variables. This is what the normal static line would look like without variables
Add(BzvOpeningRange4("0300", "0400", "1400"));
Im looking to replace the three time slots with variables and created the following code:
#region variables
private string ORind = null; //String to hold the full code for the Opening Range Indicator
private int orstarth = 300; // Opening Range Start Hour
private int orstartm = 30; // Opening Range Start Minutes
private int orendh = 400; // Opening Range End Hour
private int orendm = 0; // Opening Range End Minutes
private int orstoph = 1300; // Opening Range Stop Hour
private int orstopm = 0; // Opening Range Stop Minutes
private int orstart = 0; // Opening Range Start Time. Hour and minutes combined
private int orend = 0; // Opening Range End Time. Hour And Minutes Combined
private int orstop = 0; // Opening Range Stop Time. Hour And Minutes Combined
#endregion
protected override void Initialize()
{
orstart = orstarth+orstartm; //Combines the Hour and minutes
orend = orendh+orendm; //Combines the Hour and minutes
orstop = orstoph+orstopm; //Combines the Hour and minutes
ORind = "BzvOpeningRange4(\"0"+orstart+"\", \"0"+orend+"\", \""+orstop+"\")"; //Combines all the above into a string
PrintWithTimeStamp(ORind); //Prints Output just for visual confirmation
Add(ORind); //Actual line which ADDs the indicator
}
BzvOpeningRange4("0300", "0400", "1400")
but when compiling I get the following error messages
"The best overloaded method match for 'NinjaTrader.Strategy.StrategyBase.Add(NinjaTrader .Indicator.IndicatorBase)' has some invalid arguments"
"Strategy\OrbNay1g.cs Argument '1': cannot convert from 'string' to 'NinjaTrader.Indicator.IndicatorBase' CS1503 - click for info 977 8"
Any help would be appreciated

Comment