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 DJ888, Yesterday, 10:57 PM
          0 responses
          6 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          158 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Yesterday, 09:29 PM
          0 responses
          7 views
          0 likes
          Last Post Belfortbucks  
          Started by zstheorist, Yesterday, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          151 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Working...
          X