Hoping some one here can help with a spot of code that i am unsure of. What i want to do is lookback n candles and if a variable is met (Dev1) within the period then it is confirmation of an entry. i am using the DivergenceRSI indicator for the variable and it is either 0,1 or -1. I want to look back n candles and see if it has been triggered in that period.
i was thinking of doing an if statement with the barindex but i am unsure how to get the down to a small number or if this is even the correct way of doing it.
This will also cause an issue if DivergenceRSI is at 0 on the close of the current candle but has been triggered in the last n candles.
Hi, you can use summation command of div1 over previous n candles by checking if the value it had on the previous candle (to avoid including current one) is at least one (so your div1 event happened at least once during this interval) :
Sorry to be a pain I’m trying to figure this out for the inverse of the above. when divergenceRSI goes opposite divergence it throws -1 not 1. how can i get this to count a negative number. currently it is staying at 0 when the divergence indicator shows an opposite divergence with the following code. i need this to review if within any of the last [n] periods the indicator went -1 as well as 1
Me again, Sorry just wanted to let you know that i sorted it out. i needed to stop thinking that the entry2 variable had to be -1 that can be 1 as it is not the indicator result.
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue