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

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 CortexZenUSA, Today, 12:53 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by CortexZenUSA, Today, 12:46 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by usazencortex, Today, 12:43 AM
              0 responses
              5 views
              0 likes
              Last Post usazencortex  
              Started by sidlercom80, 10-28-2023, 08:49 AM
              168 responses
              2,265 views
              0 likes
              Last Post sidlercom80  
              Started by Barry Milan, Yesterday, 10:35 PM
              3 responses
              11 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X