Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw Region doesn't work in Strategy Analyzer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Draw Region doesn't work in Strategy Analyzer

    Hello,

    I have attached a sample strategy/indicator " Bollinger_TripleState_v4NT8" from http://www.ninjatrader.com/support/f...catid=7&id=701

    Problem:
    As soon as I start trying to access Indicator values from strategy - Draw.Region stops working immediately.

    As soon as I comment these couple of lines - Draw.Region starts working again.

    I encountered it when trying to automate IchimokuCloud indicator in this thread as general question: http://ninjatrader.com/support/forum...ad.php?t=80327

    However, now I see that it is a bug and is reproducible with other indicators as well.

    Can you please confirm it on your side + include fix for this in a nearest Beta release...?

    Please see attachment + snapshot below:

    public class Ichimoku_Only : Strategy
    {
    private BollingerTripleState_V4NT8 bollinger;
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Strategy here.";
    Name = "Ichimoku_Only";
    Calculate = Calculate.OnBarClose;
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.AllEntries;
    IsExitOnSessionCloseStrategy = false;
    ExitOnSessionCloseSeconds = 30;
    IsFillLimitOnTouch = false;
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    OrderFillResolution = OrderFillResolution.Standard;
    Slippage = 0;
    StartBehavior = StartBehavior.AdoptAccountPosition;
    TimeInForce = TimeInForce.Gtc;
    TraceOrders = false;
    RealtimeErrorHandling = RealtimeErrorHandling.IgnoreAllErrors;
    StopTargetHandling = StopTargetHandling.PerEntryExecution;
    BarsRequiredToTrade = 52;
    }
    else if (State == State.Configure)
    {
    bollinger = BollingerTripleState_V4NT8(2, 14, 4, 8, false, true, true, 15);
    AddChartIndicator(bollinger);
    }
    }

    protected override void OnBarUpdate()
    {
    if (CurrentBar <= 52)
    return;

    //once these lines are uncommented - draw on strategy analyzer chart will stop working.
    var x = bollinger.Lower[0];
    var y = bollinger.Middle[0];
    }
    }

    Thank you
    Attached Files

    #2
    Hello music_p13,

    Thank you for your post.

    I will test this on my end and follow up with you.

    Comment


      #3
      I have also reproduced issue with Draw.Line(...) that happens in StrategyAnalyzer Map from following thread:


      I tried SDY indicator from http://ninjatrader.com/support/forum...3&d=1430840132

      It seems that both - Draw.Line and Displacement doesn't work as expected here in Strategy Analyzer Maps.

      I am attaching sample strategy with indicator to reproduce and screenshots.

      Thanks

      p.s. It looks like (from original thread) when using input series passed to another function like:

      public double GetIchimokuValue(phIchimokuCloud ichimokuCloud)
      {
      var x = phIchimokuCloud(9, 26, 52, 26).SpanALine[1]; //this line works and doesn't cause paint issues in strategy analyzer
      var y = ichimokuCloud.SpanALine[1]; //this line causes Draw.Region to stop working, as if series in Indicator for some reason is null / not initialized - was breaking my head why in debugger was seeing ichimokuCloud.SpanALine as "NULL"...
      }
      Attached Files
      Last edited by music_p13; 11-27-2015, 03:28 PM.

      Comment


        #4
        Hello music_p13,

        Thank you for your response.

        I was unable to reproduce these items, likely because I am not testing as you are.

        Can you send me the strategy with the proper indicators and with the lines uncommented that are needed to produce this behavior?

        I tried a few combinations but was unable to get the same results as your screenshot when the values are accessed.

        Comment


          #5
          Hello Patrick,

          Please find "BollingerDrawBug.zip" file that has a simple just-generated strategy and associated indicator.

          If you comment out the var x = bollinger.Lower[0]; - then it would draw region between bollinger bands.
          If you leave this line in as it is now, compile in NT, re-run in strategy Analyzer without changing anything - then the following line in Indicator doesn't seem to be working:

          if(shading)
          {
          Draw.Region(this, "reg" + CurrentBar, 1, 0, Upper , Lower, Brushes.Transparent, wideColor, opacity);
          }

          Please let me know if you are able to reproduce it.

          p.s. I was using 2 months of tick data on EURUSD using 600 ticks using NT to generate strategy with default settings taken from FXCM (don't think that matters since once line of code makes a difference).

          Thanks
          Attached Files
          Last edited by music_p13; 12-01-2015, 06:02 PM.

          Comment


            #6
            I have reproduced same behavior on NtB7.
            However if I change from
            else if (State == State.Configure)
            {
            bollinger = BollingerTripleState_V4NT8(2, 14, 4, 8, false, true, true, 15);
            AddChartIndicator(bollinger);
            }
            To
            else if (State == State.Configure)
            {

            AddChartIndicator(BollingerTripleState_V4NT8(2, 14, 4, 8, false, true, true, 15));
            }

            And then in the strategy change from
            protected override void OnBarUpdate()
            {
            var x = bollinger.Lower[0];
            }
            To
            protected override void OnBarUpdate()
            {
            var x = BollingerTripleState_V4NT8(2, 14, 4, 8, false, true, true, 15).Lower[0];
            }

            Then the drawing seems to work just fine.

            Have a feeling that when we try to save Indicator Class to Variable - something somewhere is not getting properly initialized and as a result Draw method stops working.

            Please update if you can reproduce the same with Beta 7.

            Thanks
            Last edited by music_p13; 12-03-2015, 07:08 PM.

            Comment


              #7
              Hello music_p13,

              Thank you for your patience.

              I have still been unable to reproduce this on my end.

              If you would not mind, could we set up a time via e-mail to look into this on your PC?
              You can send us a note to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H - 1423721" in the subject line.

              Comment


                #8
                Originally posted by NinjaTrader_PatrickH View Post
                Hello music_p13,

                Thank you for your patience.

                I have still been unable to reproduce this on my end.

                If you would not mind, could we set up a time via e-mail to look into this on your PC?
                You can send us a note to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H - 1423721" in the subject line.
                Hello,

                I have uploaded the video at http://www.screencast.com/t/bkvU70KoYEHe

                With easy to reproduce steps.

                Indicator and Strategy are already attached in previous post.

                Please let me know if you can reproduce it on your PC or we can set up time in the evening or weekend...

                Thanks

                Comment


                  #9
                  Hello music_p13,

                  I see the issue you detail with the 'bollinger' assigned, however I can not get the var x = BollingerTripleState_V4NT8 to work with AddChartIndicator(bollinger) or AddChartIndicator(BollingerTripleState_V4NT8(2, 14, 4, 8, false, true, true, 15)).

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by elderan, Today, 08:03 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post elderan
                  by elderan
                   
                  Started by algospoke, Today, 06:40 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post algospoke  
                  Started by maybeimnotrader, Today, 05:46 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post maybeimnotrader  
                  Started by quantismo, Today, 05:13 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post quantismo  
                  Started by AttiM, 02-14-2024, 05:20 PM
                  8 responses
                  169 views
                  0 likes
                  Last Post jeronymite  
                  Working...
                  X