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

I need help !!

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

    I need help !!

    I'd like to modify my indicator so that it ignores all gaps occuring between one day and the next.

    How should I change this code ?
    privateint period = myinput;
    double myHigh1=MAX(High,period)[0];
    double myLow1=MIN(Low,period)[0];
    bullishthrust.Set((
    3*Close[0]-2*myLow1-Open[period])/Close[0]*100);
    bearishthrust.Set((Open[period]+
    2*myHigh1-3*Close[0])/Close[0]*100);

    My guess is that I should a condition that wouuld substract the range between the close of the last session bar and the open of the current session bar when the session begins but I don't know how to do.

    May someone help ?

    #2
    What kind of chart do you run this on?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Sorry I don't understand the question ?

      Comment


        #4
        Are you running your code on a 1min chart? Daily chart?
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          mainly on Tick charts (233 tick to be more precise)

          Comment


            #6
            Ok great. For intraday charts you can use this to get your previous day's close: http://www.ninjatrader-support.com/H...orDayOHLC.html

            With that you compare it to the open of your first bar on the current day and then you can deduce the gap.

            To check for first bar of current day you can do something like this:
            Code:
            if (Bars.FirstBarOfSession)
            {
                 gap = Open[0] - PriorDayOHLC().PriorClose[0];
            }
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              ok great. But there's another problem.
              If you look more closely at my code, you can see that there is a period parameter (= number of bars ago taken into account for the calculation).

              Does it change anything ?

              Comment


                #8
                Well I don't know what kind of calculated value you want at the end. The code snippet I provided will allow you to get the gap value between yesterday and today. You will need to take out the trusty ole calculator and run through it by hand to see how you want to coordinate in removing the gap value to get what you want.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by ZenCortexHurry, Today, 01:07 PM
                0 responses
                1 view
                0 likes
                Last Post ZenCortexHurry  
                Started by ZenCortexHurry, Today, 01:04 PM
                0 responses
                0 views
                0 likes
                Last Post ZenCortexHurry  
                Started by f.saeidi, Today, 12:14 PM
                3 responses
                9 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by Russ Moreland, Today, 12:54 PM
                1 response
                3 views
                0 likes
                Last Post NinjaTrader_Erick  
                Started by philmg, Today, 12:55 PM
                1 response
                4 views
                0 likes
                Last Post NinjaTrader_ChristopherJ  
                Working...
                X