Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 jclose, Today, 09:37 PM
        0 responses
        5 views
        0 likes
        Last Post jclose
        by jclose
         
        Started by WeyldFalcon, 08-07-2020, 06:13 AM
        10 responses
        1,414 views
        0 likes
        Last Post Traderontheroad  
        Started by firefoxforum12, Today, 08:53 PM
        0 responses
        11 views
        0 likes
        Last Post firefoxforum12  
        Started by stafe, Today, 08:34 PM
        0 responses
        11 views
        0 likes
        Last Post stafe
        by stafe
         
        Started by sastrades, 01-31-2024, 10:19 PM
        11 responses
        169 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X