/*[[ Name := Periods_Back_High_Low Author := Copyright © 2004, David W Honeywell Link := DavidHon@msn.com Separate Window := No First Color := Cyan First Draw Type := Line First Symbol := 217 Use Second Data := Yes Second Color := Coral Second Draw Type := Line Second Symbol := 218 ]]*/ Inputs : Periods_Begin(18); Variable : shift(0),Periods_High(0),Periods_Low(0); Variable : prevbars(0),is_First(True),CheckSum(0),CheckSumPrev(0); If Bars1 Then is_First=True; prevbars=Bars; //Have any Inputs changed? CheckSum=Periods_Begin; If CheckSum!=CheckSumPrev Then is_First=True; CheckSumPrev=CheckSum; //-------------------------------------------------------------------- If is_First Then { /* This block executes ONLY First Time for each Attachment-To-Chart. If MT is closed or another Profile is selected, the values & parameters for this module are saved, and when MT or this Profile is restarted, it would not be the First Time Attachment-To-Chart. So this block would not execute unless the value of "Bars" has changed. */ SetLoopCount(0); Periods_High= High[Highest(MODE_HIGH,shift+Periods_Begin,Periods_Begin)]; Periods_Low = Low[Lowest(MODE_LOW,shift+Periods_Begin,Periods_Begin)]; For shift=Periods_Begin Downto 0 Begin SetIndexValue(shift,Periods_High); SetIndexValue2(shift,Periods_Low); End; };