int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //Chart width int X_1 = (int)ChartGetInteger(0, CHART_VISIBLE_BARS); int X_0 = 0; for(int i=X_1; i>=X_0; --i) { if(daySeparate) { if(TimeHour(Time[i]) == 0.00) //In here it filter my number list like i sad (100, 90, 80, 70, 60, 50, 40 etc..) { for(int j=i; j>=i; --j) // next i am going to use that number list { } } } } }
This is my code. I hope it filtering numbers one by one. first 100, second 90 etc. In my case i hope it need like array[]. may i correct?
Thushara Dissanayake: i want to access next values inside a loop. As an example
When in doubt, think.i = 100, 90, 80, 70, 60, 50, 40
inside this for loop i want to use,
- get 100 and 90
- get 100 and 80 etc....
Next i want to use it like this,
- get 90 and 80
for(int i=100; i > 0; i -= 10) for(int j=i - 10; j > 0; j -= 10) PrintFormat("i=%i, j=%i", i,j);Was that so hard?
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=90
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=80
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=70
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=60
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=50
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=40
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=30
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=20
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=10
0 11:15:00.882 testscr AUDCAD,M1: i=90, j=80
:
0 11:15:00.882 testscr AUDCAD,M1: i=40, j=10
0 11:15:00.882 testscr AUDCAD,M1: i=30, j=20
0 11:15:00.882 testscr AUDCAD,M1: i=30, j=10
0 11:15:00.882 testscr AUDCAD,M1: i=20, j=10
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=80
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=70
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=60
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=50
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=40
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=30
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=20
0 11:15:00.882 testscr AUDCAD,M1: i=100, j=10
0 11:15:00.882 testscr AUDCAD,M1: i=90, j=80
:
0 11:15:00.882 testscr AUDCAD,M1: i=40, j=10
0 11:15:00.882 testscr AUDCAD,M1: i=30, j=20
0 11:15:00.882 testscr AUDCAD,M1: i=30, j=10
0 11:15:00.882 testscr AUDCAD,M1: i=20, j=10
Thank you for your answer. But the number distance(10) is not a static one like 100, 90, 80 etc...
Actually it generate randomly.
- 105, 91, 87, 50, 44, 37 etc
any idea?
When in doubt, think. You haven't stated a problem. Show us your attempt
(using CODE button) and state
the nature of your problem.
No free help
urgent help.
No free help
urgent help.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi,
i want to access next values inside a loop. As an example
i = 100, 90, 80, 70, 60, 50, 40
inside this for loop i want to use,
Next i want to use it like this,
next
continue this loop until last one.
you can see i am trying to use every numbers in the list(i) with next lowest or available value.
anyone know how to do this?
Thank you.