Coding signals based on turning points in indicators

 

Okay I've been trading a discretionary system with some success based on about 8 indicators, 4 of them have clear turning points that I want to use as signals. For example say I want my exit signal to be when a 9 day RSI goes above 80, hits a high and then turns down below 80. Now I assume it will have something to do with counting iRSI values from when iRSI(NULL,0,9,PRICE_CLOSE,0)=80 and then sending a signal when iRSI<80. It would be useful to know what the highs were during that count as well so i can compare for divergence.


Which leads me to another question, how do I compare MACD values when price is setting new highs or lows over a period of say 50 or 100 bars? For example if you look at GBPPJPY 1H chart, around 20:00 GMT Jan 28 price hits a new high of 129.650, MACD(12,26,9) about 0.9, later price tips over 130 but MACD is only about 0.5. I'm looking to open a sell position on that divergence but have no idea how to code it. By the by I picked up just shy of 4000 pips on that trade = )


Thanks

Reason: