Announcement

Collapse
No announcement yet.

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 CarlTrading, 03-31-2026, 09:41 PM
                1 response
                43 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 04-01-2026, 02:41 AM
                0 responses
                20 views
                0 likes
                Last Post CarlTrading  
                Started by CaptainJack, 03-31-2026, 11:44 PM
                0 responses
                29 views
                1 like
                Last Post CaptainJack  
                Started by CarlTrading, 03-30-2026, 11:51 AM
                0 responses
                46 views
                0 likes
                Last Post CarlTrading  
                Started by CarlTrading, 03-30-2026, 11:48 AM
                0 responses
                38 views
                0 likes
                Last Post CarlTrading  
                Working...
                X