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 rhyminkevin, Today, 04:58 PM
    3 responses
    48 views
    0 likes
    Last Post Anfedport  
    Started by iceman2018, Today, 05:07 PM
    0 responses
    5 views
    0 likes
    Last Post iceman2018  
    Started by lightsun47, Today, 03:51 PM
    0 responses
    7 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    14 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    50 views
    0 likes
    Last Post futtrader  
    Working...
    X