Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw with Strategy

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

    Draw with Strategy

    Hi folks,

    I added a DrawVerticalLine method into my custom strategy but it works only in backtest mode.

    If I launch the strategy in simulation mode I don't see the lines in the live data chart.

    How can I show my custom lines in the live data chart?

    Thanks,
    Marco

    #2
    Hello,
    The DrawVerticalLine() method should work in backtesting and with live data.
    Can you provide a code snippet showing your use with this method?
    I look forward to your reply.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Hi Cody,

      I simply created a strategy like this:

      Code:
              /// <summary>
              /// This method is used to configure the strategy and is called once before any strategy method is called.
              /// </summary>
              protected override void Initialize()
              {
                  CalculateOnBarClose = true;
              }
      
              /// <summary>
              /// Called on each bar update event (incoming tick)
              /// </summary>
              protected override void OnBarUpdate()
              {
      			DrawVerticalLine(Time[0].ToString(), 0, Color.Blue);
              }
      In backtest it works properly, but in realtime chart no line are drawn.

      Thanks

      Comment


        #4
        Hello,
        I have tested that snippet on my end and I see vertical lines drawn on every bar which would be expected.
        I will need to view your whole condition for drawing the vertical lines to assist further.
        If you are not comfortable with sharing the code on the forum feel free to send an email to platformsupport[AT]ninjatrader[DOT]com with ATTN: Cody and the code snippet with the condition or the full strategy attached.
        Cody B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        264 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        168 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        171 views
        1 like
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        257 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        209 views
        0 likes
        Last Post CarlTrading  
        Working...
        X