Hi @pipsacoin ,
You are trying to use same buffer with same candleID which will provide same info/signal every time. I mean you will never get a different value with Buffer0 (CandleID 0-emtpy) > Buffer0 (CandleID 0-empty).
In the code, line 23 declares that buffer 4 is set to provide info about trend.
I use an indicator named buffers-explorers (which Iattached a version of it) to see what data is provided via buffers. Buffer 4 of ozymandias indicator provides numeric value 1 when trend is down (middle line color is tomato) and provides numeric value 0 when trend is up (middle line color is DeepSkyBlue).
So you may set a simple condition for a scenario up trend turns down as below;
Buffer 4 = 0 (candleID 1 for previous candle time) --> trend is UP for previous candle
Buffer 4 = 1 (candleID 0-or leave emtpy- for current candle time) --> trend is DOWN for current candle
0_1604472911222_ozyindi.JPG
In my experience, using 4 conditions with 4 candleIDs (at least 3 with 2 for previous and 1 for current time) provides better results in such setups.
For example:
Buffer 4 (cID 3) = 0
Buffer 4 (cID 2) = 0
Buffer 4 (cID 1) = 1
Buffer 4 (cID 0) = 1
I didn't try it but you should get it work this way, or you'll find right way to work.
Buffers explorer 2.mq4
Buffers explorer 2.ex4
Regards.
Notify: @l-andorrà