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 sjsj2732, Yesterday, 04:31 AM
        0 responses
        27 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        283 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        280 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        131 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        90 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X