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 Brevo, Today, 01:45 AM
        0 responses
        6 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        3 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        6 views
        0 likes
        Last Post oviejo
        by oviejo
         
        Working...
        X