Fabulous Guido, thanks. This sort of thing is why I make my code so freely available.hilavoku wrote:Hi Steve.
Sorry for the long post![]()
Thats right but why do i get every tick a different value of LtfSlopeVal? I don't think its the rigth way. I can have a slope value of the last closed bar. Okay but how can i calculate the slope of the 'current' bar when the bar has not closed yet? In my opinion its not reliable cause the value of the slope can change a lot within the current bar till it is closed.Why is the value of the LtfSlopeVal changing every tick but the PrevLtfSlopeVal not? These are the values vor calculating the direction of the slope...
Because PrevLtfSlopeVal refers to the value at the close of the previous candle. We do not need it updating at every tick as it will be the same with every tick.
I modifed the 'ReadIndicatorValues()' function as i think it would be right. Would you be so kind to take look? Don't consider the threshold values there represent the hight of the slope change between the last to values.
I added the values OldBarHtfTime and OldBarLtfTime. More important is the variable 'ShiftSlopeVal'. If its set to a value of 1 it means that we take the second last bar for the 'PrevLtfSlopeVal' and the last closed bar for 'LtfSlopeVal'. so we have a synchronized change of both values every time a Ltf bar closes and not every tick.
Hope you can follow my badly written thoughts.
thx in advance
Guido
Guys, Guido has picked up on some muddled thinking on my part. SS only trades at the start of a new candle, yet examines the angle now and compares it with that at the close 1 candle ago.
Clearly, it should be comparing the angle at the close of the previous candle with that of two candles ago.
Version 1a in post 1 fixes this. I am tired and have done quite a lot of coding again today, so I do not promise the code is correct yet.
Thanks Guido.