Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Value of last occurrence

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

    Value of last occurrence

    Hello,
    I have two indicators I want to use in my strategy. One is an exhaustion reading of 90 and 10. The other I'm using to establish a trend.
    What I'd like to do is figure out how to incorporate the value of the last occurrence in my strategy.
    Example: A short signal is if the exhaustion indicator is 90 AND the trend indicator value of this bar is BELOW the last time the exhaustion indicator read 90.
    Exhaustion indicator 90 or >, Trend indicator = 65, last time Exhaustion indicator 90 or >, Trend indicator = 70, put on position

    or

    Ex. Indicator >= 90, Trend Ind. = 65, last time Ex. Indicator >=90, Trend indicator = 50, do not put on trade
    Thank you

    #2
    Hello bstzgr,

    Thank you for your post.

    You could achieve this by storing the value of the Trend Indicator when the Exhaustion Indicator is above 90. For example, if set a double variable named prevTrendInd and set it to zero to start we could use the following:
    Code:
    // Check condition is true.
    if(ExInd()[0] >= 90 && TrendInd()[0] = 65 && TrendInd()[0] > prevTrendInd)
    {
    // If the prevTrendInd is 0 (initial value) then do not trade.
    if(prevTrendInd != 0)
    {
    // Place trade.
    }
    // Set the current value of the TrendInd as the value for the prevTrendInd.
    prevTrendInd = TrendInd()[0];
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cre8able, Today, 01:16 PM
    2 responses
    9 views
    0 likes
    Last Post cre8able  
    Started by chbruno, 04-24-2024, 04:10 PM
    3 responses
    48 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by samish18, Today, 01:01 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by WHICKED, Today, 12:56 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by WHICKED, Today, 12:45 PM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X