| Coding Forum Collaborate, receive help, or discuss coding related issues. |
![]() | | Tweet | |
| | #9 | ||
![]() | Re: HowTo Determine then Barnumber of a Pivot | ||
| |
|
| | #10 | ||
![]() | Re: HowTo Determine then Barnumber of a Pivot It first determines how many bars ago the swing occured, then subtracts that from the current bar number to determine the bar number of the swing. The bottom of the program simply prints the number on the chart. Inputs: SwingStrength(5); Variables: SwingHiBarsAgo(0), SwingLoBarsAgo(0), SwingHiBarNum(0), SwingLoBarNum(0); SwingHiBarsAgo = SwingHighBar(1, high, SwingStrength, SwingStrength+1) ; if SwingHiBarsAgo <> -1 then begin SwingHiBarNum = CurrentBar - SwingHiBarsAgo ; //You can add code here to store the bar number in an array, or do whatever other calculations you need end ; SwingLoBarsAgo = SwingLowBar(1, Low, SwingStrength, SwingStrength+1) ; if SwingLoBarsAgo <> -1 then begin SwingLoBarNum = CurrentBar - SwingLoBarsAgo ; //You can add code here to store the bar number in an array, or do whatever other calculations you need end ; Variables: TextSwingHi(0), TextSwingLo(0); if SwingHiBarsAgo <> -1 then begin TextSwingHi = Text_New(date[SwingHiBarsAgo], time[SwingHiBarsAgo], High[SwingHiBarsAgo], NumToStr(SwingHiBarNum,0) ) ; Text_SetStyle(TextSwingHi , 2, 1) ; end ; if SwingLoBarsAgo <> -1 then begin TextSwingLo = Text_New(date[SwingLoBarsAgo], time[SwingLoBarsAgo], Low[SwingLoBarsAgo], NumToStr(SwingLoBarNum, 0)) ; Text_SetStyle(TextSwingLo , 2, 0) ; end ; | ||
| |
|
| The Following User Says Thank You to TraderWill For This Useful Post: | ||
aaa (06-26-2010) | ||
![]() |
| Tags |
| zigzag |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |