MQL4 및 MQL5에 대한 초보자 질문, 알고리즘 및 코드에 대한 도움말 및 토론 - 페이지 745

 

표시기에서 테스트되지 않은 모든 반전 레벨 밴드와 나머지를 숨기고 테스트된 밴드만 남겨둘 수 있습니까? extern bool zone_show_weak = true; 코드 아래 if (zone_strength[i] == ZONE_WEAK && zone_show_weak == false) 및 기타는 숨길 수 없습니다. 누군가가 코드를 이해하고 수정하거나 위에서 설명한 수준을 제거할 수 있습니다. 표시기 코드:

#property copyright "Copyright © 2017 Andrew Sumner"

#속성 링크 ""

#속성 표시기_차트_창

#속성 표시기_버퍼 4

#property indicator_color1 빨간색

#property indicator_color2 빨간색

#property indicator_color3 다저블루

#property indicator_color4 다저블루


외부 int BackLimit = 300; //뒤로 - 뒤로

외부 정수 TimeFrame = 0;

외부 문자열 TimeString = "0=현재, 60=H1, 240=H4, 1440=일, 10080=주, 43200=월";


extern color color_support_weak = MediumAquamarine; //support - 약한 DarkSlateGray 지원

extern color color_support_untested = SeaGreen; // 체크 해제

외부 색상 color_support_verified = 녹색;

extern color color_support_proven = LimeGreen;

extern color color_support_turncoat = 올리브 드랍;

extern color color_resist_weak = 시에나;

extern color color_resist_untested = 난초;

extern color color_resist_verified = 크림슨;

외부 색상 color_resist_proven = 빨간색;

extern color color_resist_turncoat = DarkOrange;


extern bool zone_show_weak = true;

외부 이중 영역_fuzzfactor = 0.2;

extern 부울 zone_solid = 거짓; // false이면 true, 전체 밴드 영역이 없지만 너비 너비의 직사각형으로 프레임됩니다.

외부 int zone_linewidth = 2;

외부 정수 영역 스타일 = 0;

extern bool zone_show_info = true;

외부 정수 zone_label_shift = 22; // 레이블의 수평 오프셋이지만 표시기를 제거한 후에만

extern 부울 zone_show_alerts = 거짓;

extern bool zone_alert_popups = true;

extern bool zone_alert_sounds = true;

외부 부울 send_email = 거짓;

extern int zone_alert_waitseconds = 300;

extern bool zone_merge = true;

extern 부울 zone_extend = true;


extern 부울 fractals_show = 거짓;

외부 이중 fractal_fast_factor = 3.0;

외부 이중 fractal_slow_factor = 6.0;

extern bool SetGlobals = true;


이중 FastDnPts[], FastUpPts[];

이중 SlowDnPts[], SlowUpPts[];


이중 zone_hi[1000], zone_lo[1000];

int zone_start[1000], zone_hits[1000], zone_type[1000], zone_strength[1000], zone_count = 0;

boolzone_turn[1000];


#define ZONE_SUPPORT 1

#define ZONE_RESIST 2


#define ZONE_WEAK 0

#define ZONE_TURNCOAT 1

#define ZONE_UNTESTED 2

#define ZONE_VERIFIED 3

#define ZONE_PROVEN 4


#정의 UP_POINT 1

#DN_POINT 정의 -1


int time_offset = 0;


정수 초기화()

{

표시기버퍼(4);


SetIndexBuffer(0, SlowDnPts);

SetIndexBuffer(1, SlowUpPts);

SetIndexBuffer(2, FastDnPts);

SetIndexBuffer(3, FastUpPts);


if (fractals_show == true)

{

SetIndexStyle(0, DRAW_ARROW, 0, 3);

SetIndexStyle(1, DRAW_ARROW, 0, 3);

SetIndexStyle(2, DRAW_ARROW, 0, 1);

SetIndexStyle(3, DRAW_ARROW, 0, 1);

SetIndexArrow(0, 218);

SetIndexArrow(1, 217);

SetIndexArrow(2, 218);

SetIndexArrow(3, 217);

}

또 다른

{

SetIndexStyle(0, DRAW_NONE);

SetIndexStyle(1, DRAW_NONE);

SetIndexStyle(2, DRAW_NONE);

SetIndexStyle(3, DRAW_NONE);

}


if (시간 프레임 != 1 && 시간 프레임 != 5 && 시간 프레임 != 15 &&

타임프레임 != 60 && 타임프레임 != 240 && 타임프레임 != 1440 &&

타임프레임 != 10080 && 타임프레임 != 43200)

시간 프레임 = 0;


if(TimeFrame < 기간())

기간 = 기간();


리턴(0);

}


정수 초기화()

{

삭제 영역();

삭제GlobalVars();

리턴(0);

}


정수 시작()

{

if (NewBar() == true)

{

int old_zone_count = zone_count;


빠른 도형();

느린프랙탈();

삭제 영역();

영역 찾기();

그리기 영역();

if (zone_count < old_zone_count)

DeleteOldGlobalVars(old_zone_count);

}


if (zone_show_info == true)

{

for (int i=0; i<zone_count; i++)

{

문자열 lbl;

if (zone_strength[i] == ZONE_PROVEN)

lbl=""; // 입증됨

else if (zone_strength[i] == ZONE_VERIFIED)

lbl=""; // 체크

else if (zone_strength[i] == ZONE_UNTESTED)

lbl=""; // 테스트하지 않음

else if (zone_strength[i] == ZONE_TURNCOAT)

lbl=""; // 반전

또 다른

lbl=""; // 약한


if (zone_type[i] == ZONE_SUPPORT)

lbl = lbl + "아래"; //지원하다

또 다른

lbl = lbl + "소프"; //저항


if (zone_hits[i] > 0 && zone_strength[i] > ZONE_UNTESTED)

{

if (zone_hits[i] == 1)

lbl = lbl + ",T=" + zone_hits[i]; //테스트 횟수

또 다른

lbl = lbl + ",T=" + zone_hits[i]; //테스트 횟수

}


정수 조정_hpos;

int wbpc = WindowBarsPerChart();

정수 k;

k = 기간() * 60 + (20 + StringLen(lbl));

if (wbpc < 80)

adjust_hpos = 시간[0] + k * 4;

그렇지 않으면 (wbpc < 125)

adjust_hpos = 시간[0] + k * 8;

그렇지 않으면 (wbpc < 250)

adjust_hpos = 시간[0] + k * 15;

그렇지 않으면 (wbpc < 480)

adjust_hpos = 시간[0] + k * 29;

그렇지 않으면 (wbpc < 950)

adjust_hpos = 시간[0] + k * 58;

또 다른

adjust_hpos = 시간[0] + k * 115;


int shift = k * zone_label_shift;

이중 vpos = zone_hi[i] - (zone_hi[i] - zone_lo[i]) / 2;


// 레벨 설명 텍스트

문자열 s = "SSSR#"+i+"LBL";

ObjectCreate(s, OBJ_TEXT, 0, 0, 0);

ObjectSet(s, OBJPROP_TIME1, adjust_hpos + shift);

개체 집합(들, OBJPROP_PRICE1, vpos);

ObjectSetText(s, StringRightPad(lbl, 36, " "), 11, "Courier New",clrWhite); //검은색

}

}


CheckAlerts();


리턴(0);

}


무효 CheckAlerts()

{

정적 int lastalert = 0;


if (zone_show_alerts == false)

반품;


if (시간[0] - lastalert > zone_alert_waitseconds)

if (CheckEntryAlerts() == true)

lastalert = 시간[0];

}


bool CheckEntryAlerts()

{

// 레코드 확인

for (int i=0; i<zone_count; i++)

{

if (닫기[0] >= zone_lo[i] && 닫기[0] < zone_hi[i])

{

if (zone_show_alerts == true)

{

if (zone_alert_popups == true)

{

if (zone_type[i] == ZONE_SUPPORT)

Alert(Symbol() + TimeFrameToString(TimeFrame) + ": 지원 영역이 입력됨"); //지원 영역 도입

또 다른

Alert(Symbol() + TimeFrameToString(TimeFrame) + ": 저항 구역 진입"); //저항 영역 도입

}


if (zone_alert_sounds == true)

PlaySound("alert.wav");

}

if (send_email == true)

{

문자열 디렉토리 = "";

문자열 msg = StringConcatenate(Symbol(), "-", TimeFrameToString(TimeFrame), " at ", TimeToStr(시간[0], TIME_DATE|TIME_SECONDS),

" ", dir, "영역이 입력됨");

if (zone_type[i] == ZONE_SUPPORT)

{

디렉토리 = "지원";

SendMail("SS_SupRes_v04c 경고", msg);

}

또 다른

{

dir="저항";

SendMail("SS_SupRes_v04c 경고", msg);

}

}

반환(참);

}

}


반환(거짓);

}


무효 DeleteGlobalVars()

{

if(SetGlobals==거짓)

반품;


GlobalVariableDel("SSSR_Count_"+Symbol()+TimeFrame);

GlobalVariableDel("SSSR_Updated_"+Symbol()+TimeFrame);


int old_count = zone_count;

zone_count = 0;

삭제OldGlobalVars(old_count);

}


무효 DeleteOldGlobalVars(int old_count)

{

if(SetGlobals==거짓)

반품;


for (int i=zone_count; i<old_count; i++)

{

GlobalVariableDel("SSSR_HI_"+Symbol()+TimeFrame+i);

GlobalVariableDel("SSSR_LO_"+Symbol()+TimeFrame+i);

GlobalVariableDel("SSSR_HITS_"+Symbol()+TimeFrame+i);

GlobalVariableDel("SSSR_STRENGTH_"+Symbol()+TimeFrame+i);

GlobalVariableDel("SSSR_AGE_"+Symbol()+TimeFrame+i);

}

}


무효 FindZones()

{

int i, j, shift, bustcount=0, testcount = 0;

이중 hival, loval;

bool 설정 = false, hasturned = false;


이중 temp_hi[1000], temp_lo[1000];

정수 temp_start[1000], temp_hits[1000], temp_strength[1000], temp_count = 0;

부울 temp_turn[1000], temp_merge[1000];

정수 병합1[1000], 병합2[1000], 병합 횟수 = 0;


// 가장 오래된 영역에서 가장 작은 영역으로 순환합니다(마지막 5개 막대 무시).

// 현재까지 살아남은 사람들을 찾는 중...

for (shift=MathMin(iBars(NULL, TimeFrame)-1, BackLimit); shift>5; shift--)

{

이중 atr = iATR(NULL, TimeFrame, 7, shift);

이중 fu = atr/2 * zone_fuzzfactor;

부울 isWeak;

부울 터치 확인 = 거짓;

부울 isBust = 거짓;

이중 닫기 = iClose(NULL, TimeFrame, shift);

이중 높음 = iHigh(NULL, TimeFrame, 시프트);

더블 로우 = iLow(NULL, TimeFrame, shift);

더블 hi_i;

이중 lo_i;


if (FastUpPts[shift] > 0.001)

{

// 하이 포인트 지그재그

isWeak = 참;

if (SlowUpPts[shift] > 0.001)

isWeak = 거짓;


hival=높음;

if (zone_extend == true)

hival += 푸;


loval = MathMax(MathMin(close, high-fu), high-fu*2);

차례=거짓;

급하다=거짓;

isbust=거짓;


버스 수 = 0;

테스트 카운트 = 0;


(i=shift-1, i>=0, i--)

{

hi_i = iHigh(NULL, 타임프레임, i);

lo_i = iLow(NULL, 타임프레임, i);


if ((설정 == false && FastUpPts[i] >= 사랑 && FastUpPts[i] <= hival) ||

(전환 == true && FastDnPts[i] <= hival && FastDnPts[i] >= loval))

{

// 잠재적인 터치, 지난 번 이후로 10개 이상의 촛불인지 확인하십시오.

터치 확인 = 참;

(j=i+1; j<i+11; j++)

{

if ((전환 == false && FastUpPts[j] >= 사랑 && FastUpPts[j] <= hival) ||

(전환 == true && FastDnPts[j] <= hival && FastDnPts[j] >= loval))

{

터치 확인 = 거짓;

부서지다;

}

}


if (touchOk == true)

{

// 터치가 있습니다. 한 번 터졌다면 buscount를 제거하십시오.

// 이 레벨이 여전히 유효하고 면을 전환했다는 것을 알고 있기 때문에

버스 수 = 0;

테스트 카운트++;

}

}


if ((전환 == false && hi_i > hival) ||

(전환 == true && lo_i < loval))

{

// 이 레벨은 적어도 한 번 이상 파괴되었습니다.

흉상 카운트 ++;


if (bustcount > 1 || isWeak == true)

{

// 둘 이상

isBust = 사실;

부서지다;

}


if (== 참으로 바뀌었다)

차례=거짓;

else if (== 거짓으로 변함)

차례=참;


급하다 = 사실;


// 이전 히트를 잊음

테스트 카운트 = 0;

}

}


if(isBust==거짓)

{

// 레벨은 여전히 유효합니다. 목록에 추가

temp_hi[temp_count] = hival;

temp_lo[temp_count] = 사랑;

temp_turn[temp_count] = 서둘러;

temp_hits[temp_count] = 테스트 카운트;

temp_start[temp_count] = 시프트;

temp_merge[temp_count] = 거짓;

if (테스트 수 > 3)

temp_strength[temp_count] = ZONE_PROVEN;

그렇지 않으면 (테스트 수 > 0)

temp_strength[temp_count] = ZONE_VERIFIED;

그렇지 않으면 (서두른 == true)

temp_strength[temp_count] = ZONE_TURNCOAT;

그렇지 않으면 (isWeak == 거짓)

temp_strength[temp_count] = ZONE_UNTESTED;

또 다른

temp_strength[temp_count] = ZONE_WEAK;


temp_count++;

}

}

else if (FastDnPts[shift] > 0.001)

{

// 낮은 지그재그 포인트

isWeak = 참;

if (SlowDnPts[shift] > 0.001)

isWeak = 거짓;


사랑스러운 = 낮음;

if (zone_extend == true)

사랑 = 푸;


hival = MathMin(MathMax(종가, 낮음+fu), 낮음+fu*2);

차례=거짓;

급하다=거짓;


버스 수 = 0;

테스트 카운트 = 0;

isbust=거짓;


(i=shift-1, i>=0, i--)

{

hi_i = iHigh(NULL, 타임프레임, i);

lo_i = iLow(NULL, 타임프레임, i);


if ((전환 == true && FastUpPts[i] >= 사랑 && FastUpPts[i] <= hival) ||

(전환 == false && FastDnPts[i] <= hival && FastDnPts[i] >= loval))

{

// 잠재적인 터치, 지난 번 이후로 10개 이상의 촛불인지 확인하십시오.

터치 확인 = 참;

(j=i+1; j<i+11; j++)

{

if ((설정 == true && FastUpPts[j] >= 사랑 && FastUpPts[j] <= hival) ||

(전환 == false && FastDnPts[j] <= hival && FastDnPts[j] >= loval))

{

터치 확인 = 거짓;

부서지다;

}

}


if (touchOk == true)

{

// 터치가 있습니다. 한 번 터졌다면 buscount를 제거하십시오.

// 이 레벨이 여전히 유효하고 면을 전환했다는 것을 알고 있기 때문에

버스 수 = 0;

테스트 카운트++;

}

}


if ((전환 == true && hi_i > hival) ||

(전환 == false && lo_i < loval))

{

// 이 레벨은 적어도 한 번 이상 파괴되었습니다.

흉상 카운트 ++;


if (bustcount > 1 || isWeak == true)

{

// 둘 이상

isBust = 사실;

부서지다;

}


if (== 참으로 바뀌었다)

차례=거짓;

else if (== 거짓으로 변함)

차례=참;


급하다 = 사실;


// 이전 히트를 잊음

테스트 카운트 = 0;

}

}


if(isBust==거짓)

{

// 레벨은 여전히 유효합니다. 목록에 추가

temp_hi[temp_count] = hival;

temp_lo[temp_count] = 사랑;

temp_turn[temp_count] = 서둘러;

temp_hits[temp_count] = 테스트 카운트;

temp_start[temp_count] = 시프트;

temp_merge[temp_count] = 거짓;


if (테스트 수 > 3)

temp_strength[temp_count] = ZONE_PROVEN;

그렇지 않으면 (테스트 수 > 0)

temp_strength[temp_count] = ZONE_VERIFIED;

그렇지 않으면 (서두른 == true)

temp_strength[temp_count] = ZONE_TURNCOAT;

그렇지 않으면 (isWeak == 거짓)

temp_strength[temp_count] = ZONE_UNTESTED;

또 다른

temp_strength[temp_count] = ZONE_WEAK;


temp_count++;

}

}

}


// 겹치는 영역을 찾습니다...

if (zone_merge == true)

{

병합 횟수 = 1;

정수 반복 = 0;

동안 (merge_count > 0 && 반복 < 3)

{

병합 횟수 = 0;

반복++;


(i = 0, i < temp_count, i++)

temp_merge[i] = 거짓;


for (i = 0, i < temp_count-1, i++)

{

if (temp_hits[i] == -1 || temp_merge[j] == true)

계속하다;


(j = i+1; j < temp_count; j++)

{

if (temp_hits[j] == -1 || temp_merge[j] == true)

계속하다;


if ((temp_hi[i] >= temp_lo[j] && temp_hi[i] <= temp_hi[j]) ||

(temp_lo[i] <= temp_hi[j] && temp_lo[i] >= temp_lo[j]) ||

(temp_hi[j] >= temp_lo[i] && temp_hi[j] <= temp_hi[i]) ||

(temp_lo[j] <= temp_hi[i] && temp_lo[j] >= temp_lo[i]))

{

병합1[병합_카운트] = 나;

병합2[병합수] = j;

temp_merge[i] = 참;

temp_merge[j] = 참;

merge_count++;

}

}

}


// ... 그리고 그것들을 결합 ...

for (i=0; i<merge_count; i++)

{

int 대상 = 병합1[i];

정수 소스 = merge2[i];


temp_hi[타겟] = MathMax(temp_hi[타겟], temp_hi[소스]);

temp_lo[타겟] = MathMin(temp_lo[타겟], temp_lo[소스]);

temp_hits[대상] += temp_hits[출처];

temp_start[타겟] = MathMax(temp_start[타겟], temp_start[소스]);

temp_strength[대상] = MathMax(temp_strength[대상], temp_strength[소스]);

if (temp_hits[대상] > 3)

temp_strength[대상] = ZONE_PROVEN;


if (temp_hits[대상] == 0 && temp_turn[대상] == 거짓)

{

temp_hits[대상] = 1;

if (temp_strength[대상] < ZONE_VERIFIED)

temp_strength[대상] = ZONE_VERIFIED;

}


if (temp_turn[target] == false || temp_turn[source] == false)

temp_turn[대상] = 거짓;

if (temp_turn[대상] == true)

temp_hits[대상] = 0;


temp_hits[출처] = -1;

}

}

}


// 나머지 목록을 공식 영역에 복사합니다.

zone_count = 0;

for (i=0; i<temp_count; i++)

{

if (temp_hits[i] >= 0 && zone_count < 1000)

{

zone_hi[zone_count] = temp_hi[i];

zone_lo[zone_count] = temp_lo[i];

zone_hits[zone_count] = temp_hits[i];

zone_turn[zone_count] = temp_turn[i];

zone_start[zone_count] = temp_start[i];

zone_strength[zone_count] = temp_strength[i];

if (zone_hi[zone_count] < 닫기[4])

zone_type[zone_count] = ZONE_SUPPORT;

else if (zone_lo[zone_count] > 닫기[4])

zone_type[zone_count] = ZONE_RESIST;

또 다른

{

(j=5; j<1000; j++)

{

if (iClose(NULL, TimeFrame, j) < zone_lo[zone_count])

{

zone_type[zone_count] = ZONE_RESIST;

부서지다;

}

else if (iClose(NULL, TimeFrame, j) > zone_hi[zone_count])

{

zone_type[zone_count] = ZONE_SUPPORT;

부서지다;

}

}


만약 (j == 1000)

zone_type[zone_count] = ZONE_SUPPORT;

}


zone_count++;

}

}

}


무효 DrawZones()

{

if(SetGlobals==true)

{

GlobalVariableSet("SSSR_Count_"+Symbol()+TimeFrame, zone_count);

GlobalVariableSet("SSSR_Updated_"+Symbol()+TimeFrame, TimeCurrent());

}


for (int i=0; i<zone_count; i++)

{

if (zone_strength[i] == ZONE_WEAK && zone_show_weak == false)

계속하다;


문자열 s = "SSSR#"+i+" 강도=";

if (zone_strength[i] == ZONE_PROVEN)

s = s + "검증된, 테스트 횟수=" + zone_hits[i];

else if (zone_strength[i] == ZONE_VERIFIED)

s = s + "검증됨, 테스트 횟수=" + zone_hits[i];

else if (zone_strength[i] == ZONE_UNTESTED)

s = s + "테스트되지 않음";

else if (zone_strength[i] == ZONE_TURNCOAT)

s = s + "턴코트";

또 다른

s = s + "약함";


ObjectCreate(s, OBJ_RECTANGLE , 0, 0, 0, 0, 0);

ObjectSet(s, OBJPROP_TIME1, iTime(NULL, TimeFrame, zone_start[i]));

ObjectSet(들, OBJPROP_TIME2, TimeCurrent());

ObjectSet(들, OBJPROP_PRICE1, zone_hi[i]);

ObjectSet(들, OBJPROP_PRICE2, zone_lo[i]);

ObjectSet(s, OBJPROP_BACK, zone_solid);

ObjectSet(들, OBJPROP_WIDTH, zone_linewidth);

ObjectSet(들, OBJPROP_STYLE, zone_style);


if (zone_type[i] == ZONE_SUPPORT)

{

// 지원 영역

if (zone_strength[i] == ZONE_TURNCOAT)

ObjectSet(들, OBJPROP_COLOR, color_support_turncoat);

그렇지 않으면 (zone_strength[i] == ZONE_PROVEN)

ObjectSet(들, OBJPROP_COLOR, color_support_proven);

else if (zone_strength[i] == ZONE_VERIFIED)

ObjectSet(들, OBJPROP_COLOR, color_support_verified);

else if (zone_strength[i] == ZONE_UNTESTED)

ObjectSet(들, OBJPROP_COLOR, color_support_untested);

또 다른

ObjectSet(들, OBJPROP_COLOR, color_support_weak);

}

또 다른

{

// 저항 영역

if (zone_strength[i] == ZONE_TURNCOAT)

ObjectSet(들, OBJPROP_COLOR, color_resist_turncoat);

그렇지 않으면 (zone_strength[i] == ZONE_PROVEN)

ObjectSet(들, OBJPROP_COLOR, color_resist_proven);

else if (zone_strength[i] == ZONE_VERIFIED)

ObjectSet(들, OBJPROP_COLOR, color_resist_verified);

else if (zone_strength[i] == ZONE_UNTESTED)

ObjectSet(s, OBJPROP_COLOR, color_resist_untested);

또 다른

ObjectSet(들, OBJPROP_COLOR, color_resist_weak);

}




if(SetGlobals==true)

{

GlobalVariableSet("SSSR_HI_"+Symbol()+TimeFrame+i, zone_hi[i]);

GlobalVariableSet("SSSR_LO_"+Symbol()+TimeFrame+i, zone_lo[i]);

GlobalVariableSet("SSSR_HITS_"+Symbol()+TimeFrame+i, zone_hits[i]);

GlobalVariableSet("SSSR_STRENGTH_"+Symbol()+TimeFrame+i, zone_strength[i]);

GlobalVariableSet("SSSR_AGE_"+Symbol()+TimeFrame+i, zone_start[i]);

}

}

}


bool 프랙탈(int M, int P, int shift)

{

if (시간 프레임 > P)

P = 기간;

P = P / TimeFrame*2 + MathCeil(P / TimeFrame / 2);

if(시프트<p)

반환(거짓);


if (shift > iBars(Symbol(), TimeFrame)-P)

반환(거짓);

for (int i=1; i<=P; i++)

{

만약 (M == UP_POINT)

{

if (iHigh(NULL, TimeFrame, shift+i) > iHigh(NULL, TimeFrame, shift))

반환(거짓);

if (iHigh(NULL, TimeFrame, shift-i) >= iHigh(NULL, TimeFrame, shift))

반환(거짓);

}

경우 (M == DN_POINT)

{

if (iLow(NULL, TimeFrame, shift+i) < iLow(NULL, TimeFrame, shift))

반환(거짓);

if (iLow(NULL, TimeFrame, shift-i) <= iLow(NULL, TimeFrame, shift))

반환(거짓);

}

}

반환(참);

}


무효 FastFractals()

{

인트 시프트;

int limit = MathMin(막대-1, BackLimit);

int P = 시간 프레임 * fractal_fast_factor;


FastUpPts[0] = 0.0; FastUpPts[1] = 0.0;

FastDnPts[0] = 0.0; FastDnPts[1] = 0.0;


for (shift=limit; shift>1; shift--)

{

if (프랙탈(UP_POINT, P, shift) == true)

FastUpPts[shift] = iHigh(NULL, 타임프레임, 시프트);

또 다른

FastUpPts[시프트] = 0.0;


if (프랙탈(DN_POINT, P, 시프트) == true)

FastDnPts[shift] = iLow(NULL, 타임프레임, 시프트);

또 다른

FastDnPts[시프트] = 0.0;

}

}


무효 느린 프랙탈()

{

인트 시프트;

int limit = MathMin(iBars(Symbol(), TimeFrame) - 1, BackLimit);

int P = 시간 프레임 * fractal_slow_factor;


SlowUpPts[0] = 0.0; SlowUpPts[1] = 0.0;

느린DnPts[0] = 0.0; SlowDnPts[1] = 0.0;


for (shift=limit; shift>1; shift--)

{

if (프랙탈(UP_POINT, P, shift) == true)

SlowUpPts[shift] = iHigh(NULL, 타임프레임, 시프트);

또 다른

SlowUpPts[시프트] = 0.0;


if (프랙탈(DN_POINT, P, 시프트) == true)

SlowDnPts[shift] = iLow(NULL, TimeFrame, shift);

또 다른

SlowDnPts[시프트] = 0.0;

}

}


bool NewBar()

{

정적 날짜 시간 LastTime = 0;

if (iTime(NULL, TimeFrame, 0) != 마지막 시간)

{

LastTime = iTime(NULL, TimeFrame, 0)+time_offset;

반환(참);

}

또 다른

반환(거짓);

}


무효 DeleteZones()

{

의도 = 5;

정수 나;


동안 (i < ObjectsTotal())

{

문자열 objName = 개체 이름(i);

if (StringSubstr(objName, 0, len) != "SSSR#")

{

나는 ++;

계속하다;

}

개체삭제(obj이름);

}

}


string TimeFrameToString(int tf) // TRO의 코드

{

문자열 tfs;


스위치(tf)

{

사례 PERIOD_M1:

tfs="M1" ;

부서지다;

사례 PERIOD_M5:

tfs="M5" ;

부서지다;

사례 PERIOD_M15:

tfs="M15" ;

부서지다;

케이스 PERIOD_M30:

tfs="M30" ;

부서지다;

사례 PERIOD_H1:

tfs="H1" ;

부서지다;

사례 PERIOD_H4:

tfs="H4" ;

부서지다;

사례 PERIOD_D1:

tfs="D1" ;

부서지다;

사례 PERIOD_W1:

tfs="W1" ;

부서지다;

사례 PERIOD_MN1:

tfs="MN";

}


반환(tfs);

}


string StringRepeat(문자열 str, int n = 1)

{

문자열 outstr = "";

for(int i = 0; i < n; i++) outstr = outstr + str;

반환(outstr);

}


문자열 StringRightPad(문자열 str, int n=1, 문자열 str2=" ")

{

return(str + StringRepeat(str2,n-StringLen(str)));


 

MT5로 갈아타고 있습니다. 한마디로 도와주세요. MT5의 코드에는 어떻게 작성되어 있습니까? 무엇이 잘못되었습니까?

 //+------------------------------------------------------------------+
//|                                                          123.mq5 |
//|                        Copyright 2019, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link        "https://www.mql5.com"
#property version    "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots    1
//+----------------------------------------------+
//|  Параметры отрисовки индикатора 1            |
//+----------------------------------------------+
#property indicator_type1    DRAW_ARROW
#property indicator_color1   Blue
#property indicator_style1    STYLE_DASHDOTDOT
#property indicator_width1    0
#property indicator_label1    "Label 1"
//----
input int MAPeriod= 13 ;
//---=
int handle_ma;
double ExtLineBuffer[];
double BufferPrice[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
   SetIndexBuffer ( 0 ,ExtLineBuffer, INDICATOR_DATA );
   SetIndexBuffer ( 3 ,BufferPrice, INDICATOR_CALCULATIONS );
//---- символы для индикатора
   PlotIndexSetInteger ( 0 , PLOT_ARROW , 108 );
//---- создание метки для отображения в DataWindow
   PlotIndexSetString ( 0 , PLOT_LABEL , "PROBA" );
//----
   IndicatorSetInteger ( INDICATOR_DIGITS , _Digits );
   IndicatorSetString ( INDICATOR_SHORTNAME , " 123" );
//---- массива будет производиться как в таймсериях
   ArraySetAsSeries (ExtLineBuffer, true );
   ArraySetAsSeries (BufferPrice, true );
//--- create MA's handles
   ResetLastError ();
      handle_ma= iMA ( NULL , Period (),MAPeriod, 0 , MODE_SMA , PRICE_CLOSE ); 
   if (handle_ma== INVALID_HANDLE )
     {
       Print ( "The iMA (1) object was not created: Error " , GetLastError ());
       return INIT_FAILED ;
     }
//---
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 | 
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
 {
 Comment ( "" );
 }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
//---
//--- Проверка количества доступных баров
   if (rates_total< 4 ) return 0 ;
//--- Проверка и расчёт количества просчитываемых баров
   int limit=rates_total-prev_calculated;
   if (limit> 1 )
     {
      limit=rates_total- 1 ;
   ArrayInitialize (ExtLineBuffer, EMPTY_VALUE );
   ArrayInitialize (BufferPrice, 0 );
     }
//--- Подготовка данных
   int count=(limit> 1 ? rates_total : 2 ),copied= 0 ;
   copied= CopyBuffer (handle_ma, 0 , 0 ,count,BufferPrice);
   if (copied!=count) return 0 ;
//----   
 for ( int i=limit; i> 0 && ! IsStopped (); i--)
   {
//----------------------------------------- ОСНОВНОЙ МОДУЛЬ КОТОРЫЙ НЕ РАБОТАЕТ ----------------------------
 if ( PERIOD_H1 == Period ())
  {
//--- High signal
 if (BufferPrice[i]>open[i] && BufferPrice[i]<close[i])   
   ExtLineBuffer[i]=high[i];
//--- Low signal
 if (BufferPrice[i]<open[i] && BufferPrice[i]>close[i])
   ExtLineBuffer[i]=low[i];
  } /*
  else
  {
  ExtLineBuffer[i]=0.0;
  ExtLineBuffer[i]=0.0;
  } */
  }    
//--- return value of prev_calculated for next call
   return (rates_total);
  }
//+------------------------------------------------------------------+

질문: 쓰레기가 버퍼에 떨어지는 이유는 무엇입니까?

내가 레고 생성자의 단계에 있는 동안, 즉, 나는 모듈을 복사하고 MT%의 기능을 경험적으로 구동합니다. 물론 문서.

 
kopeyka2 :

MT5로 갈아타고 있습니다. 한마디로 도와주세요. MT5의 코드에는 어떻게 작성되어 있습니까? 무엇이 잘못되었습니까?

질문: 쓰레기가 버퍼에 떨어지는 이유는 무엇입니까?

mt5 시계열에서 반대 방향으로 이동
MT4에서와 동일하게 필요한 경우 ArraySetAsSeries 가 있습니다.

 
kopeyka2 :

MT5로 갈아타고 있습니다. 한마디로 도와주세요. MT5의 코드에는 어떻게 작성되어 있습니까? 무엇이 잘못되었습니까?

질문: 쓰레기가 버퍼에 떨어지는 이유는 무엇입니까?

내가 레고 생성자의 단계에 있는 동안, 즉, 나는 모듈을 복사하고 MT%의 기능을 경험적으로 구동합니다. 물론 문서.

 //+------------------------------------------------------------------+
//|                                                          123.mq5 |
//|                        Copyright 2019, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link        "https://www.mql5.com"
#property version    "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots    1
//+----------------------------------------------+
//|  Параметры отрисовки индикатора 1            |
//+----------------------------------------------+
#property indicator_type1    DRAW_ARROW
#property indicator_color1    clrBlue
#property indicator_width1    1
#property indicator_label1    "Label 1"
//----
input int MAPeriod= 13 ;
//---=
int handle_ma;
double ExtLineBuffer[];
double BufferPrice[];
//---
int     period;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
//---
   period=(MAPeriod< 1 ? 1 : MAPeriod);
//---
   SetIndexBuffer ( 0 ,ExtLineBuffer, INDICATOR_DATA );
   SetIndexBuffer ( 1 ,BufferPrice, INDICATOR_CALCULATIONS );
//---- символы для индикатора
   PlotIndexSetInteger ( 0 , PLOT_ARROW , 108 );
//---- создание метки для отображения в DataWindow
   PlotIndexSetString ( 0 , PLOT_LABEL , "PROBA" );
//----
   IndicatorSetInteger ( INDICATOR_DIGITS , _Digits );
   IndicatorSetString ( INDICATOR_SHORTNAME , " 123" );
//---- массива будет производиться как в таймсериях
   ArraySetAsSeries (ExtLineBuffer, true );
   ArraySetAsSeries (BufferPrice, true );
//--- create MA's handles
   ResetLastError ();
   handle_ma= iMA ( NULL , PERIOD_CURRENT ,period, 0 , MODE_SMA , PRICE_CLOSE );
   if (handle_ma== INVALID_HANDLE )
     {
       Print ( "The iMA (" ,( string )period, ") object was not created: Error " , GetLastError ());
       return INIT_FAILED ;
     }
//---
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 | 
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
  {
   Comment ( "" );
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
//--- 
   ArraySetAsSeries (high, true );
   ArraySetAsSeries (low, true ); 
//--- Проверка количества доступных баров
   if (rates_total< 4 ) return 0 ;
//--- Проверка и расчёт количества просчитываемых баров
   int limit=rates_total-prev_calculated;
   if (limit> 1 )
     {
      limit=rates_total- 1 ;
       ArrayInitialize (ExtLineBuffer, EMPTY_VALUE );
       ArrayInitialize (BufferPrice, 0 );
     }
//--- Подготовка данных
   int count=(limit> 1 ? rates_total : 2 ),copied= 0 ;
   copied= CopyBuffer (handle_ma, 0 , 0 ,count,BufferPrice);
   if (copied!=count) return 0 ;
//----   
   for ( int i=limit; i>= 0 && ! IsStopped (); i--)
     {
       //----------------------------------------- ОСНОВНОЙ МОДУЛЬ КОТОРЫЙ НЕ РАБОТАЕТ ----------------------------
       if ( Period ()== PERIOD_H1 )
        {
         //--- High signal
         if (BufferPrice[i]>open[i] && BufferPrice[i]<close[i])
            ExtLineBuffer[i]=high[i];
         //--- Low signal
         if (BufferPrice[i]<open[i] && BufferPrice[i]>close[i])
            ExtLineBuffer[i]=low[i];
        }
/*
  else
  {
  ExtLineBuffer[i]=0.0;
  ExtLineBuffer[i]=0.0;
  } */
     }
//--- return value of prev_calculated for next call
   return (rates_total);
  }
//+------------------------------------------------------------------+
 
Artyom Trishkin :

답변 해주셔서 감사합니다.

MT5에서 확인해보니... 일종의 불운이네... 차트에 따라 포인트가 흩어져있었고, 어떻게 된건지, 역사 속 어딘가에.. 불명확한 건지, 왜 MT5가 싫어하는 걸까? 작업은 간단합니다!

그래서 MT4에서

. 이것이 MT4에서 보이는 것입니다.


MT5에서도 마찬가지입니다. 물론 하나의 버퍼에서. 그러나 문제는 표시기가 포인트를 포착하지만 포인트가 아닌 포인트를 포착한다는 것입니다 ... (((


다시 한 번 말씀해 주십시오. 코드에서 MT5를 잘못 지정한 이유는 무엇입니까????

나는 MT5에서 무언가를 이해했습니다. 그리고 버퍼... 미스터리

 
kopeyka2 :

답변 해주셔서 감사합니다.

MT5에서 확인해보니... 일종의 불운이네... 차트에 따라 포인트가 흩어져있었고, 어떻게 된건지, 역사 속 어딘가에.. 불명확한 건지, 왜 MT5가 싫어하는 걸까? 작업은 간단합니다!

그래서 MT4에서

.


MT5에서도 마찬가지입니다. 물론 하나의 버퍼에서. 그러나 문제는 표시기가 포인트를 포착하지만 포인트가 아닌 포인트를 포착한다는 것입니다 ... (((


다시 한 번 말씀해 주십시오. 코드에서 MT5를 잘못 지정한 이유는 무엇입니까????

나는 MT5에서 무언가를 이해했습니다. 그리고 버퍼... 미스터리

수수께끼가 없습니다. 번호 매기기는 mql4와 다르며 표시기 버퍼 는 자동으로 0으로 설정되지 않습니다. "쓰레기"를 정리하려면 값이 포함되지 않아야 하는 인덱스의 청결도를 프로그래머가 직접 관리해야 합니다.

 
Alexey Viktorov :

수수께끼가 없습니다. 번호 매기기는 mql4와 다르며 표시기 버퍼 는 자동으로 0으로 설정되지 않습니다. "쓰레기"를 정리하려면 인덱스에 값이 포함되지 않아야 하는 경우 프로그래머 자신이 인덱스의 청결을 관리해야 합니다.

문제는 왜 마크(점)가 아무 곳에나 배치되는 것입니다. 코드에 알고리즘을 정의했습니다!!!! 양초 본체의 MA 상태입니다. 이거 작나요?

 
kopeyka2 :

문제는 왜 마크(점)가 아무 곳에나 배치되는 것입니다. 코드에 알고리즘을 정의했습니다!!!! 양초 본체의 MA 상태입니다. 이거 작나요?

바라보다

코페이카2 :
MT5로 갈아타고 있습니다. 한마디로 도와주세요.


Artyom은 한 마디로 도움을 주는 대신 전체 코드를 제공했습니다. 모든 사람은 이에 대한 자신의 접근 방식을 가지고 있습니다. 기성 코드를 제공하지 않으려고 노력하지만 여전히 때때로 작동하지 않습니다.

코페이카2 :

답변 해주셔서 감사합니다.

MT5에서 확인했는데... 뭔가 불운이...


그러나 완전히 다른 시간을 비교하기 위한 그래프. 포인트 표시의 옳고 그름을 어떻게 판단할 수 있나요???

따라서 단어 도움말 .

표시기 버퍼 는 자동으로 0으로 설정되지 않습니다. "쓰레기"를 정리하려면 값이 포함되지 않아야 하는 인덱스의 청결도를 프로그래머 자신이 관리해야 합니다.

도움의 말: MT5에서는 OnInit 및 OnDeinit의 실행 순서가 부적절하므로 문제가 있을 수 있습니다. 그러나 이것은 일부 특수한 경우에 해당하며 지표의 재계산은 항상 일관되어야 합니다. prev_calculated == 0 모든 막대에 대한 재계산 및 루프의 각 반복에서 버퍼에 값이 없어야 하는 경우 이 배열 인덱스를 PLOT_EMPTY_VALUE 설정에 따라 EMPTY_VALUE 또는 0 값으로 채웁니다.
 
Alexey Viktorov :

바라보다

Artyom은 한 마디로 도움을 주는 대신 전체 코드를 제공했습니다. 모든 사람은 이에 대한 자신의 접근 방식을 가지고 있습니다. 기성품 코드를 제공하지 않으려고 노력하지만 여전히 때때로 작동하지 않습니다.

그러나 완전히 다른 시간을 비교하기 위한 그래프. 포인트 표시의 옳고 그름을 어떻게 판단할 수 있나요???

따라서 단어 help .

도움의 말: MT5에서는 OnInit 및 OnDeinit의 실행 순서가 부적절하므로 문제가 있을 수 있습니다. 그러나 이것은 일부 특수한 경우에 해당하며 지표의 재계산은 항상 일관되어야 합니다. prev_calculated == 0 모든 막대에 대한 재계산 및 루프의 각 반복에서 버퍼에 값이 없어야 하는 경우 이 배열 인덱스를 PLOT_EMPTY_VALUE 설정에 따라 EMPTY_VALUE 또는 0 값으로 채웁니다.

할렐루야!!!!! 열기[i] 및 닫기[i]를 iOpen(NULL,PERIOD_H1,i)으로 변경



 
kopeyka2 :

할렐루야!!!!! 열기[i] 및 닫기[i]를 iOpen(NULL,PERIOD_H1,i)으로 변경



차이점이 뭐야? 표시기가 H1에 있으면 액세스 속도에서만 - 귀하의 속도는 느립니다. 내 예에서 열림 및 닫힘 배열을 직렬 인덱싱으로 설정해야 한다는 사실을 놓쳤을 것입니다. 글쎄, 나는 당신이 가지고 있지 않은 색상을 강조 표시했습니다. 데이터의 시작부터 끝까지의 주기가 있습니다(한도에서 0까지). 그리고배열을 인덱싱 하지 않았습니다. 이것이 앞뒤로 그려진 것입니다.