コード例 #1
0
        protected override void OnBarUpdate()
        {
            // this MySharedMethods is in the Indicator namespace
            double median = MySharedMethods.Median(High, Low, 0);

            Print("Median value: " + median);

            // this MySharedMethods is in the Addons namespace
            // we set this in the indicator and then print the value from the strategy
            NinjaTrader.NinjaScript.AddOns.MySharedMethods.SharedDouble = 5;
        }
コード例 #2
0
        protected override void OnBarUpdate()
        {
            // the NinjaTrader.NinjaScript.AddOns.MySharedMethods.SharedDouble is set to 5 in the MySharedMethodsIndicator indicator
            Print("SharedDouble value: " + NinjaTrader.NinjaScript.AddOns.MySharedMethods.SharedDouble);

            if (Position.MarketPosition == MarketPosition.Flat)
            {
                EnterLong();
            }

            MySharedMethods.PrintPositionInfo(Position);
        }