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

Custom daily Open and Closeing Prices

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

    Custom daily Open and Closeing Prices

    Hi everyone,

    Was wondering if anyone could lend a hand with a little problem I’m having. I'm trying to run 24 hour data and define my own daily open and closing prices, to then reference for trading. Running on Minute bars.



    Id like to be able to change times I choose to state the myopen and myclose for optimisation purposes, this is why I’m not just doing this within session manager.

    For example im stuck here,

    Code:
    private int my_Closing_time = 203001
    private int my_Close = 0
    Code:
            protected override void OnBarUpdate()
            {
                if (ToTime(Time[0]) == my_Closing_time)
                {
                my_Close = Close[0] ;
                }
           }
    Error generated:
    CS0135 - when I try to reference my_Close to place orders.



    Thanks in advance if youre able to help, Im new to NS, moved from EasyLanguage.
    Last edited by james22395; 05-30-2019, 07:40 AM.

    #2
    Hello james22395,

    Below is a link to the Strategy Wizard 301 course for NinjaTrader 7 which demonstrates a time filter.
    https://www.youtube.com/watch?v=FmBiNYsf1e8&feature=youtu.be&t=28m20s

    As well as a link to the reference sample in the help guide.
    https://ninjatrader.com/support/helpGuides/nt7/using_a_time_filter_to_limit_t.htm

    And a link to a forum post with helpful information about getting started with NinjaScript.
    https://ninjatrader.com/support/forum/forum/ninjatrader-7/indicator-development-aa/94724-help?p=775232#post775232


    What is the error message you are getting?


    If this is the first time you are using NinjaTrader, I would recommend our current flagship application NinjaTrader 8.
    NinjaTrader is a futures trading platform that delivers integrated multi-device trading. Discover our best platform to trade futures for active futures traders.
    Last edited by NinjaTrader_ChelseaB; 05-30-2019, 07:42 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi ChelseaB,

      Error generated:
      CS0135 - when I try to reference my_Close to place orders.

      Thank you for the material, Ill see if I can make some progress. I have to use NT7 for this project.


      James

      Comment


        #4
        Hello James,

        What is the error message you are getting?
        (Not the error code)
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by james22395 View Post
          Hi everyone,

          Was wondering if anyone could lend a hand with a little problem I’m having. I'm trying to run 24 hour data and define my own daily open and closing prices, to then reference for trading. Running on Minute bars.



          Id like to be able to change times I choose to state the myopen and myclose for optimisation purposes, this is why I’m not just doing this within session manager.

          For example im stuck here,

          Code:
          private int my_Closing_time = 203001
          private int my_Close = 0
          Code:
          protected override void OnBarUpdate()
          {
          if (ToTime(Time[0]) == my_Closing_time)
          {
          my_Close = Close[0] ;
          }
          }
          Error generated:
          CS0135 - when I try to reference my_Close to place orders.



          Thanks in advance if youre able to help, Im new to NS, moved from EasyLanguage.
          my_close should be a double, not an int.
          You also need semi colons at end of statements defining your variables.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          26 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, Yesterday, 09:53 PM
          2 responses
          49 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          191 views
          0 likes
          Last Post Hasadafa  
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,231 views
          0 likes
          Last Post xiinteractive  
          Working...
          X