Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //0 - текущее положение бара
- //1 - предыдущий положение старта/финиша
- int Bar_Position = 0;
- int Last_Position;
- const int MinDistance = 20;
- for(int i = 0; i < Bars; i++) {
- quick_ma = iMA(NULL, 0, MA_Period_Quick, 0, MA_Method_Quick, PRICE_CLOSE, i);
- slow_ma = iMA(NULL, 0, MA_Period_Slow, 0, MA_Method_Slow, PRICE_CLOSE, i);
- Last_Position = quick_ma > slow_ma ? 0 : 1;
- if(quick_ma > slow_ma) {
- if(Last_Position == 1) {
- if(Bar_Position > MinDistance) {
- if(min_price != 9999999)
- {
- BufferL[Number_Bar] = min_price - Dig * indent * Point;
- min_price = 9999999;
- Number_Bar = 0;
- }
- Bar_Position = 0;
- }
- } else {
- Last_Position = 0;
- }
- if(High[i] > max_price)
- {
- max_price = High[i];
- Number_Bar = i;
- }
- } else {
- if(Last_Position == 0) {
- if(Bar_Position > MinDistance) {
- if(max_price != 0)
- {
- BufferH[Number_Bar] = max_price + Dig * indent * Point;
- max_price = 0;
- Number_Bar = 0;
- }
- Bar_Position = 0;
- }
- } else {
- Last_Position = 1;
- }
- if(Low[i] < min_price)
- {
- min_price = Low[i];
- Number_Bar = i;
- }
- }
- Bar_Position++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement