Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

can't run this Simple code

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

    can't run this Simple code

    The code below is to simply draw a horizontal line from the high of the 1 min bar which is time stamped 2:53pm. Can anyone tell me what is wrong with the code below?

    // Condition set 1
    if (ToTime(Time[0]) == ToTime(14, 53, 0))
    {
    DrawHorizontalLine(
    "My horizontal line" + CurrentBar, High[0], Color.Blue);
    }

    #2
    When you ToTime(Time[0]) you can just compare it directly to an int. There is no need to make another ToTime. You can do something like this instead:
    Code:
    if (ToTime(Time[0]) == 145300)
    Other than that, please check the Control Center logs for errors.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh. Thanks for the quick reply. So How do I change it to 145300 ? And How do I run the code?
      I tried editting the codes using the numeric value in the Misc section of the wizard but it replies back " Return type of leftexpression 'Date Time' and right expression 'double' do not match.you need to select a different item."

      Comment


        #4
        Are you in the Strategy Wizard? If so, disregard.

        Your strategy should work if it was generated from the Wizard. Please ensure you indeed do have a bar with that exact timestamp somewhere on your chart.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I changed the time to 2:35 pm to see if it does trigger but nothing happened.
          On which of my chart is it going to be drawn ? I have several charts open.
          And how exactly is it going to run/trigger? Do I have to trigger it myself or it will happen automatically?

          Comment


            #6
            Please see this link on how to run your strategy: http://www.ninjatrader-support.com/H...romAChart.html
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thank you Josh. I got it.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              612 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              355 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              105 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              561 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              564 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X