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 ghoul, Today, 06:02 PM
                2 responses
                13 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by jeronymite, 04-12-2024, 04:26 PM
                3 responses
                44 views
                0 likes
                Last Post jeronymite  
                Started by Barry Milan, Yesterday, 10:35 PM
                7 responses
                20 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by AttiM, 02-14-2024, 05:20 PM
                10 responses
                180 views
                0 likes
                Last Post jeronymite  
                Started by DanielSanMartin, Yesterday, 02:37 PM
                2 responses
                13 views
                0 likes
                Last Post DanielSanMartin  
                Working...
                X