Andy,
It's something to do with styleCloud. If you replace styleCloud with styleLine in your PlotOHLC statements, your code works fine. I've not used styleCloud so I don't have any insight into why styleCloud operates differently than styleLine. Regards, David _____ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Sirbrainfart Sent: 04/11/2007 9:15 AM To: Amibroker Yahoo Group Subject: [amibroker] Strange indicator plot scaling Grateful if someone could help me see where the code below is going funny. Everything plots fine until you scroll left (or zoom out) to the extreme left-hand, i.e. the first bar. When I do this the indicator scaling goes AWOL and I just end up with a straight line due to the plot creating huge numbers. Can't see why for the life of me...and I don't see the problem with indicators that are constructed in a similar way. Can anyone replicate my problem? Or better still, fix it! TIA Andy //----------------------------------------------------------// function StochMom(array, periods, smoothpds, smoothpds2) { mid = ( HHV(H,periods) + LLV(L,periods) )/2 ; diff = HHV(H,periods) - LLV(L,periods) ; alpha = 2 / (smoothpds+1); alpha2 = 2 / (smoothpds2+1); X1 = AMA(array-mid, alpha); X2 = AMA(X1, alpha2); X3 = AMA(diff,alpha); X4 = AMA(X3,alpha2)/2; return Min(1,(X2/X4))*100 ; } Param1 = ParamToggle("Price Field","Close|(H+L)/2",0); Price = IIf(Param1==0,C,(H+L)/2); //Stochastics LongK = StochMom(Price,21,10,3); LongD = EMA(LongK,4); ShortK = StochMom(Price,7,3,3); ShortD = EMA(ShortK,3); //Colour Arrays LongColour = IIf(LongK>LongD,colorGreen,colorRed); ShortColour = IIf(ShortK>ShortD,colorBlue,colorOrange); PlotOHLC(LongK,LongK,LongD,LongK,"",LongColour,styleCloud); PlotOHLC(ShortK,ShortK,ShortD,ShortK,"",ShortColour,styleCloud); Plot(50,"",colorGrey50,styleDashed|styleNoLabel); Plot(60,"",colorGrey50,styleDashed|styleNoLabel); Plot(-60,"",colorGrey50,styleDashed|styleNoLabel); Plot(-50,"",colorGrey50,styleDashed|styleNoLabel); //----------------------------------------------------------//
