/*[[ Name := parabolic SAR for Moving Average Author := Rol (mail: machaon@inbox.lv) Link := http://www.metaquotes.net/ Separate Window := No First Color := Blue First Draw Type := Symbol First Symbol := 217 Use Second Data := Yes Second Color := Red Second Draw Type := Line Second Symbol := 218 ]]*/ Variable : sum(0),cnt(0),MAValue(0),shift(0),first(0),sar(0),ekstrems(0),virziens(0),maxstep(0.2),AF(0),step(0.02),MAPeriod(5); first=Bars-MAPeriod; /* If you want to modify parabolic SAR, then you can change step and maxstep value - arguments meanings are similar as in metatrader's parabolic SAR. If you want to modify Moving Average, then you can change MAPeriod value. I made this indicator, because sometimes Parabolic Sar takes into account very sharp lows or highs, in my case the parabolic sar is calculated from moving average, therofore the factor of very sharp moves is significantly reduced. If you find the strategy, where we can use this indicator, please let me know, also do not forget to post about it in Yahoo forum MetaTrader_Experts_and_Indicators. Sorry for grammar mistakes:) */ SetLoopCount(0); // loop from first bar to current bar (with shift=0) For shift=Bars-1 Downto 0 Begin if shift=first or shiftopen[first] or close[first]=open[first]then { sar=MAValue; ekstrems=high[first]; virziens=1; }; if close[first]ekstrems then { ekstrems=MAValue; if AFsar then { virziens=1; AF=step; sar=ekstrems; ekstrems=MAValue; SetIndexValue(shift, sar); }; }; }; End;