My need to wear warm slippers while trading/programming, even in the peak of summerMrLong wrote:Where did the name come from by way?
I have to ask ... are you sure? Lets imagine askPrice is 1.0, Pivots[cc] is 0.9 and Pivots[cc+1] is 1.1. We know that askPrice is less than Pivot[cc+1] as the controlling if() statement tests for it.Code: Select all
for (int cc = 0; cc < ArraySize(Pivots); cc++) { if (askPrice > Pivots[cc] && askPrice < Pivots[cc + 1] && askPrice < top) { pivot = NormalizeDouble(Pivots[cc + 1], digits); if (askPrice - pivot < (MinimumToNextSR / PFactor(symbol))) pivot = NormalizeDouble(Pivots[cc + 2], digits); return(pivot); } } }
No this looks correct to me, because we are looking for a LONG trade, ASK would be high and pivot would be low.
So, pivot is set to Pivots[cc+1], hence its 1.1. In the statement "if (askPrice - pivot < blah)" it'll always evaluate to true, as 1.0 - 1.1 = -0.1
Therefore the statement "pivot = NormalizeDouble(Pivots[cc+2], digits)" will always be executed ... and there's no checking to see if cc+2 < ArraySize(Pivots). By the same token in the Support function it could end up referencing Pivots[-1].