a variable is created in the strategy.cs and filled with a value. now the value of this variable is to be read and used in another .cs file (indicator). in the indicator i can create a new instance of my strategy and also access this variable. unfortunately, however, the value of the variable is not changed when it is changed in the strategy. what am i doing wrong?
namespace NinjaTrader.NinjaScript.Strategies
{
public class SidiUnmanaged : Strategy
{
protected override void OnStateChange()
{
if (State == State.DataLoaded)
StrategyId = this.Id;
}
[XmlIgnore, Browsable(false)]
public long StrategyId
{
get
{
return this.strategyId;
}
set
{
if(value != this.strategyId)
{
this.strategyId = value;
}
}
}
}
}
namespace NinjaTrader.NinjaScript.Indicators.MyIndicators
{
public class SidiHistoricalTrades : Indicator
{
SidiUnmanaged sidiUnmanaged = new SidiUnmanaged();
protected override void OnBarUpdate()
{
Print(sidiUnmanaged.StrategyId.ToString());
}
}
}
is there actually no possibility to insert already formatted text here in the forum, or have i not found it yet?
Comment