i.e. like Close array i want to maintain a LongSignal & ShortSignal array specific to each bar. below is my script snippet; have defined LongSignal & ShortSignal as double array & for every bar they get initialized at the start on onBarUpdate with 0. later on these values get reset if my buy/sell condition meets with 1.
am sure i am making very basic mistake here, any help would be appreciated.
my final intent is to have these signal array exposed to a strategy.
OUTPUT FOR LOG WINDOW;
6/23/2019 12:39:47 PM | NinjaScript | SHORT INDICATOR: CurrentBar=5179- 100/100 |
protected override void OnBarUpdate()
{
LongSingle[CurrentBar]= 0; // initialize with 0 at the bar start,
ShortSignal[CurrentBar]=0; // initialize with 0.at the bar start,
if(SOME CONDITION ) {
ShortSignal[CurrentBar]=1; // set LongSignal for current bar to 1.
Log("SHORT INDICATOR: CurrentBar="+CurrentBar+"-"+LongSignal[CurrentBar].ToString()+"/"+ShortSignal[CurrentBar],LogLevel.Information);
// below also does not work
// Log("SHORT INDICATOR: CurrentBar="+CurrentBar+"-"+LongSignal.GetValueAt(CurrentBar).ToString()+"/"+ShortSignal.GetValueAt(CurrentBar),LogLevel. Info rmation);
}
#region Properties
[Browsable(false)]
[XmlIgnore]
public Series<double> LongSignal
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> ShortSignal
{
get { return Values[0]; }
}
#endregion
Comment