MQL4 ve MQL5 ile ilgili herhangi bir acemi sorusu, algoritmalar ve kodlar hakkında yardım ve tartışma - sayfa 745

 

Göstergedeki, test edilmeyen ve geri kalan tüm ters seviye bantlarını gizlemek ve yalnızca test edilmiş olanları bırakmak, yani extern bool zone_show_weak = true; ve aşağıda if (zone_strength[i] == ZONE_WEAK && zone_show_weak == false) ve diğerleri gizlenemez. Belki birisi kodu anlar ve düzeltir veya yukarıda anlattığım seviyeleri kaldırır. Gösterge kodu:

#property telif hakkı "Telif hakkı © 2017 Andrew Sumner"

#özellik bağlantısı ""

#özellik göstergesi_chart_window

#özellik göstergesi_tamponları 4

#özellik göstergesi_renk1 Kırmızı

#özellik göstergesi_renk2 Kırmızı

#özellik göstergesi_renk3 DodgerBlue

#özellik göstergesi_renk4 DodgerBlue


harici int GeriLimit = 300; //Geri geri

harici int Zaman Çerçevesi = 0;

extern string TimeString = "0=Mevcut, 60=H1, 240=H4, 1440=Gün, 10080=Hafta, 43200=Ay";


dış renk color_support_weak = OrtaAkuamarin; //destek - zayıf DarkSlateGray desteği

dış renk color_support_untested = SeaGreen; // işaretlenmemiş

extern color color_support_verified = Yeşil;

dış renk color_support_proven = LimeGreen;

extern color color_support_turncoat = Zeytin Ezmesi;

dış renk color_resist_weak = Sienna;

dış renk color_resist_untested = Orkide;

extern color color_resist_verified = Kızıl;

dış renk color_resist_proven = Kırmızı;

dış renk color_resist_turncoat = DarkOrange;


extern bool zone_show_weak = doğru;

harici çift bölge_fuzzfactor = 0.2;

extern bool zone_solid = yanlış; // true ise false, tam bant bölgeleri olmayacak, ancak genişlik genişliği olan bir dikdörtgenle çerçevelenecektir

extern int zone_linewidth = 2;

harici int zone_style = 0;

extern bool zone_show_info = doğru;

extern int zone_label_shift = 22; // etiketlerin yatay ofseti, ancak yalnızca göstergeyi çıkardıktan sonra

extern bool zone_show_alerts = false;

extern bool zone_alert_popups = true;

extern bool zone_alert_sounds = true;

extern bool send_email = yanlış;

extern int zone_alert_waitseconds = 300;

extern bool zone_merge = true;

extern bool zone_extend = true;


extern bool fraktals_show = yanlış;

harici çift fraktal_fast_factor = 3.0;

harici çift fraktal_slow_factor = 6.0;

extern bool SetGlobals = true;


çift FastDnPts[], FastUpPts[];

çift SlowDnPts[], SlowUpPts[];


double 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


#define UP_POINT 1

#define DN_POINT -1


int time_offset = 0;


int init()

{

Gösterge Tamponları(4);


SetIndexBuffer(0, SlowDnPts);

SetIndexBuffer(1, SlowUpPts);

SetIndexBuffer(2, FastDnPts);

SetIndexBuffer(3, FastUpPts);


if (fraktallar_göster == doğru)

{

SetIndexStyle(0, DRAW_OK, 0, 3);

SetIndexStyle(1, DRAW_OK, 0, 3);

SetIndexStyle(2, DRAW_OK, 0, 1);

SetIndexStyle(3, DRAW_OK, 0, 1);

SetIndexArrow(0, 218);

SetIndexArrow(1, 217);

SetIndexArrow(2, 218);

SetIndexArrow(3, 217);

}

başka

{

SetIndexStyle(0, DRAW_NONE);

SetIndexStyle(1, DRAW_NONE);

SetIndexStyle(2, DRAW_NONE);

SetIndexStyle(3, DRAW_NONE);

}


if (Zaman Çerçevesi != 1 && Zaman Çerçevesi != 5 && Zaman Çerçevesi != 15 &&

Zaman Çerçevesi != 60 && Zaman Çerçevesi != 240 && Zaman Çerçevesi != 1440 &&

Zaman Çerçevesi != 10080 && Zaman Çerçevesi != 43200)

zaman çerçevesi = 0;


if(Zaman Çerçevesi < Dönem())

zaman çerçevesi = dönem();


dönüş(0);

}


int tanım()

{

SilZones();

DeleteGlobalVars();

dönüş(0);

}


int başlangıç()

{

if (NewBar() == doğru)

{

int old_zone_count = zone_count;


Hızlı Fraktallar();

SlowFractals();

SilZones();

FindZones();

DrawZones();

if (zone_count < old_zone_count)

DeleteOldGlobalVars(old_zone_count);

}


if (zone_show_info == doğru)

{

için (int i=0; i<zone_count; i++)

{

dize lbl;

if (zone_strength[i] == ZONE_PROVEN)

lbl=""; // Kanıtlanmış

else if (zone_strength[i] == ZONE_VERIFIED)

lbl=""; // Kontrol

else if (zone_strength[i] == ZONE_UNTESTED)

lbl=""; // test DEĞİL

else if (zone_strength[i] == ZONE_TURNCOAT)

lbl=""; // Ters çevirme

başka

lbl=""; // Güçsüz


if (zone_type[i] == ZONE_SUPPORT)

lbl = lbl + "altında"; //Destek olmak

başka

lbl = lbl + "sop"; //Rezistans


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

{

if (zone_hits[i] == 1)

lbl = lbl + ",T=" + zone_hits[i]; //Test Sayısı

başka

lbl = lbl + ",T=" + zone_hits[i]; //Test Sayısı

}


int ayar_hpos;

int wbpc = WindowBarsPerChart();

int k;

k = Dönem() * 60 + (20 + StringLen(lbl));

eğer (wbpc < 80)

ayar_hpos = Zaman[0] + k * 4;

başka ise (wbpc < 125)

ayar_hpos = Zaman[0] + k * 8;

başka ise (wbpc < 250)

ayar_hpos = Zaman[0] + k * 15;

başka ise (wbpc < 480)

ayar_hpos = Zaman[0] + k * 29;

başka ise (wbpc < 950)

ayar_hpos = Zaman[0] + k * 58;

başka

ayar_hpos = Zaman[0] + k * 115;


int shift = k * zone_label_shift;

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


// Seviye açıklamalarının metni

string s = "SSSR#"+i+"LBL";

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

ObjectSet(ler, OBJPROP_TIME1, Adjust_hpos + shift);

ObjectSet(ler, OBJPROP_PRICE1, vpos);

ObjectSetText(s, StringRightPad(lbl, 36, " "), 11, "Courier New",clrWhite); //Siyah

}

}


Kontrol Uyarıları();


dönüş(0);

}


geçersiz Kontrol Uyarıları()

{

statik int son uyarı = 0;


if (zone_show_alerts == yanlış)

dönüş;


if (Zaman[0] - son uyarı > zone_alert_waitseconds)

if (CheckEntryAlerts() == doğru)

lastalert = Zaman[0];

}


bool CheckEntryAlerts()

{

// girişleri kontrol et

için (int i=0; i<zone_count; i++)

{

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

{

if (zone_show_alerts == doğru)

{

if (zone_alert_popups == doğru)

{

if (zone_type[i] == ZONE_SUPPORT)

Alert(Symbol() + TimeFrameToString(TimeFrame) + ": Destek Bölgesi Girildi"); //Tanıtılan destek bölgesi

başka

Alert(Symbol() + TimeFrameToString(TimeFrame) + ": Direnç Bölgesi Girildi"); //Girilen direnç bölgesi

}


if (zone_alert_sounds == doğru)

PlaySound("alert.wav");

}

if (send_email == doğru)

{

dizi dizini = "";

string msg = StringConcatenate(Symbol(), "-", TimeFrameToString(TimeFrame), " at ", TimeToStr(Time[0], TIME_DATE|TIME_SANİYE),

" ", yön, "Bölge Girildi");

if (zone_type[i] == ZONE_SUPPORT)

{

dir = "Destek";

SendMail("SS_SupRes_v04c uyarısı", msj);

}

başka

{

dir="direnç";

SendMail("SS_SupRes_v04c uyarısı", msj);

}

}

dönüş(doğru);

}

}


dönüş(yanlış);

}


geçersiz DeleteGlobalVars()

{

if(SetGlobals==yanlış)

dönüş;


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

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


int eski_sayısı = bölge_sayısı;

bölge_sayısı = 0;

DeleteOldGlobalVars(old_count);

}


geçersiz DeleteOldGlobalVars(int old_count)

{

if(SetGlobals==yanlış)

dönüş;


için (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);

}

}


geçersiz FindZones()

{

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

çift hival, loval;

bool döndü = false, hasturned = false;


double temp_hi[1000], temp_lo[1000];

int temp_start[1000], temp_hits[1000], temp_strength[1000], temp_count = 0;

bool temp_turn[1000], temp_merge[1000];

int birleştirme1[1000], birleştirme2[1000], birleştirme_sayısı = 0;


// bölgeler arasında en eskiden en küçüğe doğru döngü yapın (son 5 çubuğu yok sayın),

// bugüne kadar hayatta kalanları bulmak...

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

{

double atr = iATR(NULL, TimeFrame, 7, shift);

çift fu = atr/2 * zone_fuzzfactor;

bool zayıftır;

bool touchOk = yanlış;

bool isBust = yanlış;

double close = iClose(NULL, TimeFrame, shift);

double high = iHigh(NULL, TimeFrame, shift);

double low = iLow(NULL, TimeFrame, shift);

çift hi_i;

çift lo_i;


if (FastUpPts[shift] > 0,001)

{

// yüksek nokta zikzak

isWeak = doğru;

if (SlowUpPts[shift] > 0,001)

isWeak = yanlış;


hival=yüksek;

if (zone_extend == doğru)

hival += fu;


loval = MathMax(MathMin(yakın, yüksek-fu), yüksek-fu*2);

dönüş=yanlış;

hızlı döndü=yanlış;

isbust=yanlış;


veriyolu = 0;

test sayısı = 0;


(i=shift-1; i>=0; i--) için

{

hi_i = iYüksek(NULL, TimeFrame, ben);

lo_i = iLow(NULL, TimeFrame, ben);


if ((döndü == false && FastUpPts[i] >= loval && FastUpPts[i] <= hival) ||

(döndü == true && FastDnPts[i] <= hival && FastDnPts[i] >= loval))

{

// Potansiyel dokunuş, sondan beri 10'dan fazla mum olduğundan emin ol

touchOk = doğru;

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

{

if ((döndü == false && FastUpPts[j] >= loval && FastUpPts[j] <= hival) ||

(döndü == true && FastDnPts[j] <= hival && FastDnPts[j] >= loval))

{

touchOk = yanlış;

kırmak;

}

}


if (touchOk == doğru)

{

// bir dokunuşumuz var. Bir kez kırıldıysa, bustcount'u kaldırın

// bu seviyenin hala geçerli olduğunu ve sadece taraf değiştirildiğini bildiğimiz için

veriyolu = 0;

test sayısı++;

}

}


if ((döndü == yanlış && hi_i > hival) ||

(döndü == doğru && lo_i < loval))

{

// bu seviye en az bir kez kırıldı

göğüs sayımı++;


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

{

// iki veya daha fazla

isBust = doğru;

kırmak;

}


if (döndü == doğru)

dönüş=yanlış;

else if (döndü == yanlış)

dönüş=doğru;


döndü = doğru;


// önceki isabetleri unut

test sayısı = 0;

}

}


if(isBust==yanlış)

{

// seviye hala geçerli, listemize ekleyin

temp_hi[temp_count] = hival;

temp_lo[temp_count] = yerel;

temp_turn[temp_count] = döndü;

temp_hits[temp_count] = testcount;

temp_start[temp_count] = vardiya;

temp_merge[temp_count] = yanlış;

if (test sayısı > 3)

temp_strength[temp_count] = ZONE_PROVEN;

else if (test sayısı > 0)

temp_strength[temp_count] = ZONE_VERIFIED;

else if (hızlandı == doğru)

temp_strength[temp_count] = ZONE_TURNCOAT;

else if (isWeak == false)

temp_strength[temp_count] = ZONE_UNTESTED;

başka

temp_strength[temp_count] = ZONE_WEAK;


temp_count++;

}

}

else if (FastDnPts[shift] > 0,001)

{

// düşük zikzak noktası

isWeak = doğru;

if (SlowDnPts[shift] > 0,001)

isWeak = yanlış;


loval = düşük;

if (zone_extend == doğru)

loval = fu;


hival = MathMin(MathMax(yakın, düşük+fu), düşük+fu*2);

dönüş=yanlış;

hızlı döndü=yanlış;


veriyolu = 0;

test sayısı = 0;

isbust=yanlış;


(i=shift-1; i>=0; i--) için

{

hi_i = iYüksek(NULL, TimeFrame, ben);

lo_i = iLow(NULL, TimeFrame, ben);


if ((döndü == true && FastUpPts[i] >= loval && FastUpPts[i] <= hival) ||

(döndü == false && FastDnPts[i] <= hival && FastDnPts[i] >= loval))

{

// Potansiyel dokunuş, sondan beri 10'dan fazla mum olduğundan emin ol

touchOk = doğru;

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

{

if ((döndü == true && FastUpPts[j] >= loval && FastUpPts[j] <= hival) ||

(döndü == false && FastDnPts[j] <= hival && FastDnPts[j] >= loval))

{

touchOk = yanlış;

kırmak;

}

}


if (touchOk == doğru)

{

// bir dokunuşumuz var. Bir kez kırıldıysa, bustcount'u kaldırın

// bu seviyenin hala geçerli olduğunu ve sadece taraf değiştirildiğini bildiğimiz için

veriyolu = 0;

test sayısı++;

}

}


if ((döndü == doğru && hi_i > hival) ||

(döndü == yanlış && lo_i < loval))

{

// bu seviye en az bir kez kırıldı

göğüs sayımı++;


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

{

// iki veya daha fazla

isBust = doğru;

kırmak;

}


if (döndü == doğru)

dönüş=yanlış;

else if (döndü == yanlış)

dönüş=doğru;


döndü = doğru;


// önceki isabetleri unut

test sayısı = 0;

}

}


if(isBust==yanlış)

{

// seviye hala geçerli, listemize ekleyin

temp_hi[temp_count] = hival;

temp_lo[temp_count] = yerel;

temp_turn[temp_count] = döndü;

temp_hits[temp_count] = testcount;

temp_start[temp_count] = vardiya;

temp_merge[temp_count] = yanlış;


if (test sayısı > 3)

temp_strength[temp_count] = ZONE_PROVEN;

else if (test sayısı > 0)

temp_strength[temp_count] = ZONE_VERIFIED;

else if (hızlandı == doğru)

temp_strength[temp_count] = ZONE_TURNCOAT;

else if (isWeak == false)

temp_strength[temp_count] = ZONE_UNTESTED;

başka

temp_strength[temp_count] = ZONE_WEAK;


temp_count++;

}

}

}


// örtüşen bölgeleri ara...

if (zone_merge == doğru)

{

birleştirme_sayısı = 1;

int yinelemeler = 0;

while (merge_count > 0 && yinelemeler < 3)

{

birleştirme_sayısı = 0;

yinelemeler++;


için (i = 0; i < temp_count; i++)

temp_merge[i] = yanlış;


için (i = 0; i < temp_count-1; i++)

{

if (temp_hits[i] == -1 || temp_merge[j] == doğru)

devam etmek;


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

{

if (temp_hits[j] == -1 || temp_merge[j] == doğru)

devam etmek;


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]))

{

birleştirme1[birleştirme_sayısı] = ben;

birleştirme2[birleştirme_sayısı] = j;

temp_merge[i] = doğru;

temp_merge[j] = doğru;

birleştirme_sayımı++;

}

}

}


// ... ve onları birleştir ...

(i=0; i<merge_count; i++) için

{

int hedef = birleştirme1[i];

int kaynak = birleştirme2[i];


temp_hi[hedef] = MathMax(temp_hi[hedef], temp_hi[kaynak]);

temp_lo[hedef] = MathMin(temp_lo[hedef], temp_lo[kaynak]);

temp_hits[hedef] += temp_hits[kaynak];

temp_start[hedef] = MathMax(temp_start[hedef], temp_start[kaynak]);

temp_strength[hedef] = MathMax(temp_strength[hedef], temp_strength[kaynak]);

if (temp_hits[hedef] > 3)

temp_strength[hedef] = ZONE_PROVEN;


if (temp_hits[hedef] == 0 && temp_turn[hedef] == yanlış)

{

temp_hits[hedef] = 1;

if (temp_strength[hedef] < ZONE_VERIFIED)

temp_strength[hedef] = ZONE_VERIFIED;

}


if (temp_turn[hedef] == yanlış || temp_turn[kaynak] == yanlış)

temp_turn[hedef] = yanlış;

if (temp_turn[hedef] == doğru)

temp_hits[hedef] = 0;


temp_hits[kaynak] = -1;

}

}

}


// listenin geri kalanını resmi bölgelerimize kopyalayın

bölge_sayısı = 0;

(i=0; i<temp_count; i++) için

{

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] < Kapat[4])

zone_type[zone_count] = ZONE_SUPPORT;

else if (zone_lo[zone_count] > Kapat[4])

zone_type[zone_count] = ZONE_RESIST;

başka

{

(j=5; j<1000; j++) için

{

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

{

zone_type[zone_count] = ZONE_RESIST;

kırmak;

}

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

{

zone_type[zone_count] = ZONE_SUPPORT;

kırmak;

}

}


eğer (j == 1000)

zone_type[zone_count] = ZONE_SUPPORT;

}


bölge_sayısı++;

}

}

}


geçersiz DrawZones()

{

if(SetGlobals==true)

{

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

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

}


için (int i=0; i<zone_count; i++)

{

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

devam etmek;


string s = "SSSR#"+i+" Kuvvet=";

if (zone_strength[i] == ZONE_PROVEN)

s = s + "Kanıtlanmış, Test Sayımı=" + zone_hits[i];

else if (zone_strength[i] == ZONE_VERIFIED)

s = s + "Doğrulandı, Test Sayısı=" + zone_hits[i];

else if (zone_strength[i] == ZONE_UNTESTED)

s = s + "Denenmemiş";

else if (zone_strength[i] == ZONE_TURNCOAT)

s = s + "Döner";

başka

s = s + "zayıf";


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

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

ObjectSet(ler, OBJPROP_TIME2, TimeCurrent());

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

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

ObjectSet(ler, OBJPROP_BACK, zone_solid);

ObjectSet(ler, OBJPROP_WIDTH, zone_linewidth);

ObjectSet(ler, OBJPROP_STYLE, zone_style);


if (zone_type[i] == ZONE_SUPPORT)

{

// destek bölgesi

if (zone_strength[i] == ZONE_TURNCOAT)

ObjectSet(ler, OBJPROP_COLOR, color_support_turncoat);

else if (zone_strength[i] == ZONE_PROVEN)

ObjectSet(ler, OBJPROP_COLOR, color_support_proven);

else if (zone_strength[i] == ZONE_VERIFIED)

ObjectSet(ler, OBJPROP_COLOR, color_support_verified);

else if (zone_strength[i] == ZONE_UNTESTED)

ObjectSet(ler, OBJPROP_COLOR, color_support_untested);

başka

ObjectSet(ler, OBJPROP_COLOR, color_support_weak);

}

başka

{

// direnç bölgesi

if (zone_strength[i] == ZONE_TURNCOAT)

ObjectSet(ler, OBJPROP_COLOR, color_resist_turncoat);

else if (zone_strength[i] == ZONE_PROVEN)

ObjectSet(ler, OBJPROP_COLOR, color_resist_proven);

else if (zone_strength[i] == ZONE_VERIFIED)

ObjectSet(ler, OBJPROP_COLOR, color_resist_verified);

else if (zone_strength[i] == ZONE_UNTESTED)

ObjectSet(ler, OBJPROP_COLOR, color_resist_untested);

başka

ObjectSet(ler, 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 Fraktal(int M, int P, int shift)

{

if (Zaman Çerçevesi > P)

P = zaman aralığı;

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

if(üst karakter<p)

dönüş(yanlış);


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

dönüş(yanlış);

için (int i=1; i<=P; i++)

{

eğer (M == UP_POINT)

{

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

dönüş(yanlış);

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

dönüş(yanlış);

}

eğer (M == DN_POINT)

{

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

dönüş(yanlış);

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

dönüş(yanlış);

}

}

dönüş(doğru);

}


void FastFractals()

{

int-shift;

int limit = MathMin(Bars-1, BackLimit);

int P = Zaman Çerçevesi * fraktal_hızlı_faktör;


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

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


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

{

if (Fractal(UP_POINT, P, shift) == doğru)

FastUpPts[shift] = iHigh(NULL, TimeFrame, shift);

başka

FastUpPts[shift] = 0.0;


if (Fractal(DN_POINT, P, shift) == true)

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

başka

FastDnPts[shift] = 0.0;

}

}


void SlowFractals()

{

int-shift;

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

int P = Zaman Çerçevesi * fraktal_yavaş_faktör;


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

SlowDnPts[0] = 0.0; SlowDnPts[1] = 0.0;


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

{

if (Fractal(UP_POINT, P, shift) == doğru)

SlowUpPts[shift] = iHigh(NULL, TimeFrame, shift);

başka

SlowUpPts[shift] = 0.0;


if (Fractal(DN_POINT, P, shift) == true)

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

başka

SlowDnPts[shift] = 0.0;

}

}


bool NewBar()

{

statik tarihsaat LastTime = 0;

if (iTime(NULL, TimeFrame, 0) != LastTime)

{

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

dönüş(doğru);

}

başka

dönüş (yanlış);

}


geçersiz DeleteZones()

{

niyet = 5;

int i;


while (i < NesnelerToplam())

{

string nesneAdı = NesneAdı(i);

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

{

ben++;

devam etmek;

}

ObjectDelete(objName);

}

}


string TimeFrameToString(int tf) // TRO'dan kod

{

dize tfs;


anahtar(tf)

{

PERIOD_M1 durumu:

tfs="M1";

kırmak;

PERIOD_M5 durumu:

tfs="M5";

kırmak;

durum PERIOD_M15:

tfs="M15" ;

kırmak;

durum PERIOD_M30:

tfs="M30";

kırmak;

PERIOD_H1 durumu:

tfs="H1";

kırmak;

PERIOD_H4 durumu:

tfs="H4";

kırmak;

PERIOD_D1 durumu:

tfs="D1";

kırmak;

PERIOD_W1 durumu:

tfs="W1";

kırmak;

PERIOD_MN1 durumu:

tfs="MN";

}


dönüş(tfs);

}


string StringRepeat(string str, int n = 1)

{

string outstr = "";

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

dönüş (çıktı);

}


string StringRightPad(string str, int n=1, string str2=" ")

{

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


 

MT5'e geçiyorum. Bir kelime ile yardım. MT5'te kodda nasıl yazıyor, yanlış olan ne?

 //+------------------------------------------------------------------+
//|                                                          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);
  }
//+------------------------------------------------------------------+

SORU: Neden arabelleğe herhangi bir çöp düşüyor?

Lego yapıcısı aşamasındayken, yani. Modülü kopyalıyorum ve ampirik olarak MT%'nin özelliklerine sürüyorum. Tabii ki belgeler.

 
kopeyka2 :

MT5'e geçiyorum. Bir kelime ile yardım. MT5'te kodda nasıl yazıyor, yanlış olan ne?

SORU: Neden arabelleğe herhangi bir çöp düşüyor?

mt5 zaman serisinde tam tersi
MT4'tekiyle aynı şeye ihtiyacınız varsa, o zaman ArraySetAsSeries var

 
kopeyka2 :

MT5'e geçiyorum. Bir kelime ile yardım. MT5'te kodda nasıl yazıyor, yanlış olan ne?

SORU: Neden arabelleğe herhangi bir çöp düşüyor?

Lego yapıcısı aşamasındayken, yani. Modülü kopyalıyorum ve ampirik olarak MT%'nin özelliklerine sürüyorum. Tabii ki belgeler.

 //+------------------------------------------------------------------+
//|                                                          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 :

Cevap için teşekkürler.

MT5'te kontrol ettim... Bir nevi şanssızlık... Puanlar grafiğe göre dağılmış, nasıl belli değil, tarihin derinliklerinde bir yerde.. MT5'in neyi, neden sevmediği belli değil? Görev basit!

MT4 İÇİNDE

. MT4&#39;TE GÖRÜNÜŞÜ BUDUR


VE MT5'TE. Tabii ki tek bir tamponda. Ancak sorun şu ki, gösterge puanları yakalıyor, ancak bunları değil ve orada değil ... (((


Bir kez daha lütfen söyle. MT5'i kodda neyi yanlış belirttim????

MT5'te bir şey anladım. Ve tamponlar... bir gizem

 
kopeyka2 :

Cevap için teşekkürler.

MT5'te kontrol ettim... Bir nevi şanssızlık... Puanlar grafiğe göre dağılmış, nasıl belli değil, tarihin derinliklerinde bir yerde.. MT5'in neyi, neden sevmediği belli değil? Görev basit!

MT4 İÇİNDE

.


VE MT5'TE. Tabii ki tek bir tamponda. Ancak sorun şu ki, gösterge puanları yakalıyor, ancak bunları değil ve orada değil ... (((


Bir kez daha lütfen söyle. MT5'i kodda neyi yanlış belirttim????

MT5'te bir şey anladım. Ve tamponlar... bir gizem

Bilmece yok. Numaralandırma mql4'ten farklıdır ve gösterge arabellekleri otomatik olarak sıfıra ayarlanmaz. "Çöpü" temizlemek için, programcının kendisi, değerleri içermemeleri gerekiyorsa, dizinlerin temizliğine dikkat etmelidir.

 
Alexey Viktorov :

Bilmece yok. Numaralandırma mql4'ten farklıdır ve gösterge arabellekleri otomatik olarak sıfıra ayarlanmaz. "Çöpü" temizlemek için programcının kendisi, değerleri içermiyorsa dizinlerin temizliğine dikkat etmelidir.

Soru, işaretlerin (puanların) NEDEN herhangi bir yere yerleştirildiğidir? Algoritmayı kodda tanımladım!!!! Mum gövdesinde MA durumu. Bu küçük mü?

 
kopeyka2 :

Soru, işaretlerin (puanların) NEDEN herhangi bir yere yerleştirildiğidir? Algoritmayı kodda tanımladım!!!! Mum gövdesinde MA durumu. Bu küçük mü?

Bak

kopeyka2 :
MT5'e geçiyorum. Bir kelime ile yardım.


Artyom bir kelimeyle yardımcı olmak yerine tam kodu verdi. Herkesin buna kendi yaklaşımı vardır. Hazır kod vermemeye çalışıyorum ama yine de bazen olmuyor.

kopeyka2 :

Cevap için teşekkürler.

MT5'te kontrol ettim... Bir çeşit şanssızlık...


Ancak tamamen farklı zamanları karşılaştırmak için grafikler. Puanların gösterilmesinin doğruluğunu veya yanlışlığını yargılamak nasıl mümkün olabilir???

Bu nedenle yardım kelimesi .

gösterge arabellekleri otomatik olarak sıfıra ayarlanmaz. "Çöpü" temizlemek için, programcının kendisi, değerleri içermemeleri gerekiyorsa, dizinlerin temizliğine dikkat etmelidir.

Başka bir yardım sözü: MT5'te OnInit ve OnDeinit'i yetersiz bir yürütme dizisi yaptılar, bu nedenle de sorunlar olabilir. Ancak bu bazı özel durumlarda geçerlidir ve göstergenin yeniden hesaplanması HER ZAMAN tutarlı olmalıdır. Tüm çubuklar için ve döngünün her yinelemesinde prev_calculated == 0 yeniden hesaplama şartıyla, arabellekte değer olmaması gerekiyorsa, bu dizi dizinini PLOT_EMPTY_VALUE ayarına bağlı olarak EMPTY_VALUE veya 0 değeriyle doldurun
 
Alexey Viktorov :

Bak

Artyom bir kelimeyle yardımcı olmak yerine tam kodu verdi. Herkesin buna kendi yaklaşımı vardır. Hazır kod vermemeye çalışıyorum ama yine de bazen olmuyor.

Ancak tamamen farklı zamanları karşılaştırmak için grafikler. Puanların gösterilmesinin doğruluğunu veya yanlışlığını yargılamak nasıl mümkün olabilir???

Bu nedenle yardım kelimesi .

Başka bir yardım sözü: MT5'te OnInit ve OnDeinit'i yetersiz bir yürütme dizisi yaptılar, bu nedenle de sorunlar olabilir. Ancak bu bazı özel durumlarda geçerlidir ve göstergenin yeniden hesaplanması HER ZAMAN tutarlı olmalıdır. Tüm çubuklar için ve döngünün her yinelemesinde prev_calculated == 0 yeniden hesaplama şartıyla, arabellekte değer olmaması gerekiyorsa, bu dizi dizinini PLOT_EMPTY_VALUE ayarına bağlı olarak EMPTY_VALUE veya 0 değeriyle doldurun

halleluya!!!!! open[i] ve close[i], iOpen(NULL,PERIOD_H1,i) olarak değiştirildi



 
kopeyka2 :

halleluya!!!!! open[i] ve close[i], iOpen(NULL,PERIOD_H1,i) olarak değiştirildi



Fark ne? Gösterge H1 üzerindeyse, yalnızca erişim hızında - sizinki daha yavaştır. Örneğimde, muhtemelen açık ve kapalı dizileri seri indekslemeye ayarlamanız gerektiğini kaçırdınız. Peki, sende olmayan rengi vurguladım. Verinin başlangıcından sonuna kadar - limitten 0'a kadar bir döngünüz var ve dizileri indekslemediniz - ileri geri çizilen şey buydu.