Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator in strategy?

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

    Indicator in strategy?

    Hello,

    What graphic possibilities in strategy? I need to draw point of desired color on the chart when some event occurs. Is it possible?


    Regards,
    Igor

    #2
    Please see the Help Guide for all the available draw objects. Go to the index and just search Draw. You will find it listed out.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,

      I added the code to my strategy:
      Code:
      [FONT=Courier New][SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] iDotCount = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2];[/SIZE][/FONT]
       
      [FONT=Courier New][SIZE=2][COLOR=#0000ff]protected[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] PrintDot([/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] y, Color color)[/SIZE][/FONT]
      [SIZE=2][FONT=Courier New]{ [/FONT][/SIZE]
      [FONT=Courier New][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2] sTag = [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000]"tag"[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]+iDotCount.ToString();[/SIZE][/FONT]
      [SIZE=2][FONT=Courier New]iDotCount++;[/FONT][/SIZE]
      [SIZE=2][FONT=Courier New]DrawDot(sTag, [/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2], [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2], y, color);[/SIZE][/FONT]
      [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
      and try to draw it like:
      Code:
      [FONT=Courier New][SIZE=2]PrintDot(High[[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]]+TickSize,Color.LightGreen);[/SIZE][/FONT]
      but see nothing on the chart. Can you say where I'm wrong, please?

      Comment


        #4
        Instead of creating a function I suggest you just do:
        Code:
        DrawDot("tag"[B][COLOR=Red] + CurrentBar[/COLOR][/B], HIgh[0] + TickSize, Color.Blue);
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I'll try this, thanks!

          Comment


            #6
            Oh, I was so stupid! I simply must start my strategy from indicator window.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            63 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            35 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            54 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            61 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            48 views
            0 likes
            Last Post CarlTrading  
            Working...
            X