• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing Cross Over Value for Stochastics

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

    Accessing Cross Over Value for Stochastics

    Hi guys,

    I'm sure this is something stupid simple but I can't seem to figure it out. I'm using CrossAbove (or CrossBelow) that lets me know that a Cross-over has occurred. I'm checking this cross-over 1 bar ago to be sure that the cross-over existed for sure. And I'm cool with this.

    However I now have a need to get the exact value at the cross-over point. How is this possible?

    #2
    Maybe something like this would work:

    if (CrossAbove(StochInd.K, Threshold, 1))
    Print (StochInd.K[1]);

    Assuming StochInd is your instance and Threshold is your defined Stochastic Threshold.

    Comment


      #3
      Thank you! I’ll give it a shot and report back

      Comment


        #4
        I used ".D" as the Threshold since I'm looking for a CrossOver between .K and .D and the result give me the value of %K at the close of the previous bar (which makes sense since I'm asking it to give me the value at [1]. That's close but still not close enough. In the attached image you'll see the Output Window showing a value of 90.53... whereas I'm looking for something closer to 88.57 (Where the actual CrossOver occurs).

        Attached Files

        Comment


          #5
          I have Tick Replay and Calculate.OnEachTick setup so I suppose the closest I could get to a real answer using this method is if I had a lookback period of 1 tick (rather than 1 bar).

          Not sure if I'm missing something but would this be a feature request? i.e. a high resolution lookback? Or maybe a different approach to a solution?

          Comment


            #6
            Hello Bluebeep,

            The look back period is how many bars back can a cross have occured within. This is because we are comparing the current value of each series with the previous bars value.

            In real-time this means that a cross can occur multiple times within a single bar and the condition would evaluate as true multiple times while that bar is open. This is the same with Tick Replay and Calculate.OnEachTick.

            The action would be triggered at the moment the cross occurs and any values of any series would be the values at that exact moment when the cross occurs (and would not be the final values of that bar once that bar is actually closed).
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ArmKnuckle, Today, 01:59 AM
            1 response
            15 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by seppyr, Today, 01:53 AM
            1 response
            17 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by matthewbartlett, Today, 01:22 AM
            1 response
            8 views
            0 likes
            Last Post Emma1
            by Emma1
             
            Started by ct_fx, Today, 05:14 AM
            0 responses
            12 views
            0 likes
            Last Post ct_fx
            by ct_fx
             
            Started by Beauregard, Today, 04:36 AM
            0 responses
            9 views
            0 likes
            Last Post Beauregard  
            Working...
            X