- Joined
- 17 October 2016
- Posts
- 1
- Reactions
- 0
I have written a code which can display the n-th day high, n-th day low, i.e. that day high [day 0] compared with previous day high day by day until the day 0 high is lower than the n-th day high, and return this is n-th day high.
Day 0, 1, 2, 3 ,4, 5, 6, 7
High 5, 4.9, 4.8, 4.9, 5.1, 5.01
n-th n/a,1,2,3,(5 < 5.1), stop
so it returns, 3th day high.
I can do it and show it in interpretation window, but I don't know how to make it become usable in EXplorer/Scan. But the below code is not array. I do not know how to make it, which I have been studying very hard for long time.
Day 0, 1, 2, 3 ,4, 5, 6, 7
High 5, 4.9, 4.8, 4.9, 5.1, 5.01
n-th n/a,1,2,3,(5 < 5.1), stop
so it returns, 3th day high.
I can do it and show it in interpretation window, but I don't know how to make it become usable in EXplorer/Scan. But the below code is not array. I do not know how to make it, which I have been studying very hard for long time.
Code:
bar = StrToNum(NumToStr (BarIndex()));
for (i = bar; i > 0; i--){
if (H[bar] < H[bar - 1]){
i=1;
}
else if (H[bar] <= H[i - 1]){
printf("\n\nIt is" + NumToStr(bar-i+1) + "day(s) high since ");
printf(DateTimeToStr(EndValue( Ref( DateTime(), i - BarCount)) ) );
printf(" day high " +H[i-1] + ". ");
i=0;
}
}
for (i = bar; i > 0; i--){
if (L[bar] > L[bar - 1]){
i=1;
}
else if (L[bar] >= L[i - 1]){
printf("\n\nIt is" + NumToStr(bar-i+1) + "day(s) low since ");
printf(DateTimeToStr(EndValue( Ref( DateTime(), i - BarCount)) ) );
printf(" day low " +L[i-1] + ". ");
i=0;
}
}