코딩 도움말 - 페이지 513

 
mladen:
그것을 시도하십시오 (이제 내 터미널에 원하는 만큼의 양초가 표시됨) : candlebreaker_1.mq4

지금은 잘 작동하고 있습니다.

문안 인사.

 

안녕하세요 여러분, 제 mt4가 차트에 더 이상 표시되지 않는 문제가 있습니다. ma, rsi, wpr 촛불은 며칠 전에 mt 플랫폼을 다시 설치했을 때 발생했습니다. 누구든지 도울 수 있습니까?

 
tfi_markets:
안녕하세요 프로코더 여러분,

저는 현재 Autotrend Forecaster 표시기로 작업하고 있습니다.

아래 코드를 작성했지만 EA는 거래를 시작하지 않습니다.

누군가 친절하게 봐주시겠습니까?

미리 감사합니다!

MT4는 저널에 경고만 표시합니다.

파일:
journal.jpg  74 kb
 
tfi_markets:
MT4는 저널에 경고만 표시합니다.

그렇다면 문제는 EA에 작성된 귀하의 조건에 있습니다.

조건이 true로 평가되는지 확인

 

안녕하세요 코더 여러분,

경고 기능에 대해 세 번째로 물어보는 것 같아서 정말 부끄럽습니다.

히스토그램 색상이 색상에서 변경될 때 경고를 받고 싶습니다.

평소와 마찬가지로 표시기 버퍼를 서로 비교하고 있습니다. 하지만 이번에는 작동하지 않습니다.

버퍼가 완벽하게 작동하고 내 비교 기능도 정확합니다(내 눈에는).

그래서 나는 그것이 작은 것이어야한다고 생각합니다. 누군가가 저를 도울 수 있기를 바랍니다.

미리 감사드립니다.

#property indicator_separate_window#property indicator_buffers 5

#property indicator_color1 clrGreen

#property indicator_width1 4

#property indicator_color2 clrRed

#property indicator_width2 4

#property indicator_color3 Teal

#property indicator_color4 Teal

#property indicator_color5 Black

#property indicator_minimum 0

#property indicator_maximum 0.1

extern int Amplitude = 2;

extern bool alertsOn = true;

extern bool alertsMessage = true;

extern bool alertsSound = true;

extern bool alertsNotify = true;

extern bool alertsEmail = true;

extern string soundfile = "alert2.wav";

bool nexttrend;

double minh, maxl, up[], down[], trend[], atrlo[], atrhi[];

int init () {

SetIndexBuffer(0, up);

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexLabel(0, "up");

SetIndexBuffer(1, down);

SetIndexStyle(1,DRAW_HISTOGRAM);

SetIndexLabel(1, "down");

SetIndexBuffer (2, atrlo);

SetIndexStyle (2, DRAW_NONE);

SetIndexBuffer (3, atrhi);

SetIndexStyle (3, DRAW_NONE);

SetIndexBuffer (4, trend);

//---

SetIndexEmptyValue (0, 0.0);

SetIndexEmptyValue (1, 0.0);

SetIndexEmptyValue (4, 0.0);

nexttrend = 0;

minh = High;

maxl = Low;

return (0);

}

int start () {

double atr, ll, hh, lma, hma;

int workbar = 1;

int c = IndicatorCounted ();

if (c < 0) {

return (- 1);

}

for (int i = Bars - 1 - c; i >= workbar; i --) {

ll = iLow (Symbol (), Period (),

iLowest (Symbol (), Period (), MODE_LOW, Amplitude, i));

hh = iHigh (Symbol (), Period (),

iHighest (Symbol (), Period (), MODE_HIGH, Amplitude, i));

lma = iMA (NULL, 0, Amplitude, 0, MODE_SMA, PRICE_LOW, i);

hma = iMA (NULL, 0, Amplitude, 0, MODE_SMA, PRICE_HIGH, i);

trend = trend;

atr = iATR (Symbol (), 0, 100, i) / 2;

if (nexttrend == 1) {

maxl = MathMax (ll, maxl);

if (hma < maxl && Close < Low) {

trend = 1;

nexttrend = 0;

minh = hh;

}

}

if (nexttrend == 0) {

minh = MathMin (hh, minh);

if (lma > minh && Close > High) {

trend = 0;

nexttrend = 1;

maxl = ll;

}

}

if (trend == 0.0) { //-------------------------------------------------------------------------------------------

if (trend != 0.0) {

up = down;

up = up;

} else {

up = MathMax (maxl, up);

}

atrhi = up + atr;

atrlo = up - atr;

down = 0.0;

} else {

if (trend != 1.0) {

down = up;//-------------------------------------------------------------------------------------------

down = down;

} else {

down = MathMin (minh, down);

}

atrhi = down + atr;

atrlo = down - atr;

up = 0.0; //-------------------------------------------------------------------------------------------

}

if(alertsOn){

if((up[2]!=EMPTY_VALUE) && (down[2]!=EMPTY_VALUE) &&(up[1]!=EMPTY_VALUE)&&(down[1]==EMPTY_VALUE))lcheckalert();

if((up[2]!=EMPTY_VALUE) && (down[2]==EMPTY_VALUE) &&(up[1]!=EMPTY_VALUE)&&(down[1]!=EMPTY_VALUE))scheckalert();

}

}

return (0);

}

void lcheckalert()

{

static datetime candletime=0;

if(candletime!=Time[0])

{

string lmessage = "ZOXY is green on, this means a buy signal! Pair:"+_Symbol +" Price: "+Ask;

if (alertsMessage) Alert(lmessage);

if (alertsNotify) SendNotification(lmessage);

if (alertsEmail) SendMail(StringConcatenate(Symbol()," Buy signal "),lmessage);

if (alertsSound) PlaySound("alert2.wav");

candletime=Time[0];

}

}

void scheckalert()

{

static datetime candletime=0;

if(candletime!=Time[0])

{

string smessage = "ZOXY is Red, this means a sell signal! Pair: "+_Symbol +" Price: "+Bid;

if (alertsMessage) Alert(smessage);

if (alertsNotify) SendNotification(smessage);

if (alertsEmail) SendMail(StringConcatenate(Symbol()," Sell signal "),smessage);

if (alertsSound) PlaySound("alert2.wav");

candletime=Time[0];

}

}

zoxy.mq4

파일:
zoxy.mq4  5 kb
 
mladen:
그런 다음 문제는 EA에 작성된 조건에 있습니다. 조건이 true로 평가되는지 확인하십시오.

안녕 믈라덴

당신의 제안에 감사드립니다. 조건을 true/false로 "강제"하기 위해 코드를 약간 다시 작성했습니다. 지금은 팔지만 사지 않습니다. 아래 코드를 참조하세요.

if(openedOrders<=0)

{

// AutoTrendForecaster

이중 AutoTrendup=iCustom(Symbol(),0,"AutoTrendForecaster",TMperiod,Intensity,SL_distance_pips,0,bar);

이중 AutoTrendup_prev=iCustom(Symbol(),0,"AutoTrendForecaster",TMperiod,Intensity,SL_distance_pips,0,bar+1);

이중 AutoTrenddown=iCustom(Symbol(),0,"AutoTrendForecaster",TMperiod,Intensity,SL_distance_pips,1,bar);

이중 AutoTrenddown_prev=iCustom(Symbol(),0,"AutoTrendForecaster",TMperiod,Intensity,SL_distance_pips,1,bar+1);

//+----------------------------------------------- -------------------+

//| 구입

//+----------------------------------------------- -------------------+

부울 구매 조건 = 거짓;

if(AutoTrendup>0 && AutoTrendup!=EMPTY_VALUE)

{

구매 조건 = true;

}

if (구매 조건)

{

오픈바이();

리턴(0);

}

//+----------------------------------------------- -------------------+

//| 팔다

//+----------------------------------------------- -------------------+

부울 판매 조건 = 거짓;

if (AutoTrenddown>0 && AutoTrenddown!=EMPTY_VALUE)

{

판매 조건 = true;

}

if (판매 조건)

{

오픈셀();

리턴(0);

}

}

미리 감사합니다!

파일:
buysell.jpg  65 kb
 
xtractalpha:
안녕하세요 코더 여러분,

경고 기능에 대해 세 번째로 물어보는 것 같아서 정말 부끄럽습니다.

히스토그램 색상이 색상에서 변경될 때 경고를 받고 싶습니다.

평소와 마찬가지로 표시기 버퍼를 서로 비교하고 있습니다. 하지만 이번에는 작동하지 않습니다.

버퍼가 완벽하게 작동하고 내 비교 기능도 정확합니다(내 눈에는).

그래서 나는 그것이 작은 것이어야한다고 생각합니다. 누군가가 저를 도울 수 있기를 바랍니다.

미리 감사드립니다.

#property indicator_separate_window#property indicator_buffers 5

#property indicator_color1 clrGreen

#property indicator_width1 4

#property indicator_color2 clrRed

#property indicator_width2 4

#property indicator_color3 Teal

#property indicator_color4 Teal

#property indicator_color5 Black

#property indicator_minimum 0

#property indicator_maximum 0.1

extern int Amplitude = 2;

extern bool alertsOn = true;

extern bool alertsMessage = true;

extern bool alertsSound = true;

extern bool alertsNotify = true;

extern bool alertsEmail = true;

extern string soundfile = "alert2.wav";

bool nexttrend;

double minh, maxl, up[], down[], trend[], atrlo[], atrhi[];

int init () {

SetIndexBuffer(0, up);

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexLabel(0, "up");

SetIndexBuffer(1, down);

SetIndexStyle(1,DRAW_HISTOGRAM);

SetIndexLabel(1, "down");

SetIndexBuffer (2, atrlo);

SetIndexStyle (2, DRAW_NONE);

SetIndexBuffer (3, atrhi);

SetIndexStyle (3, DRAW_NONE);

SetIndexBuffer (4, trend);

//---

SetIndexEmptyValue (0, 0.0);

SetIndexEmptyValue (1, 0.0);

SetIndexEmptyValue (4, 0.0);

nexttrend = 0;

minh = High;

maxl = Low;

return (0);

}

int start () {

double atr, ll, hh, lma, hma;

int workbar = 1;

int c = IndicatorCounted ();

if (c < 0) {

return (- 1);

}

for (int i = Bars - 1 - c; i >= workbar; i --) {

ll = iLow (Symbol (), Period (),

iLowest (Symbol (), Period (), MODE_LOW, Amplitude, i));

hh = iHigh (Symbol (), Period (),

iHighest (Symbol (), Period (), MODE_HIGH, Amplitude, i));

lma = iMA (NULL, 0, Amplitude, 0, MODE_SMA, PRICE_LOW, i);

hma = iMA (NULL, 0, Amplitude, 0, MODE_SMA, PRICE_HIGH, i);

trend = trend;

atr = iATR (Symbol (), 0, 100, i) / 2;

if (nexttrend == 1) {

maxl = MathMax (ll, maxl);

if (hma < maxl && Close < Low) {

trend = 1;

nexttrend = 0;

minh = hh;

}

}

if (nexttrend == 0) {

minh = MathMin (hh, minh);

if (lma > minh && Close > High) {

trend = 0;

nexttrend = 1;

maxl = ll;

}

}

if (trend == 0.0) { //-------------------------------------------------------------------------------------------

if (trend != 0.0) {

up = down;

up = up;

} else {

up = MathMax (maxl, up);

}

atrhi = up + atr;

atrlo = up - atr;

down = 0.0;

} else {

if (trend != 1.0) {

down = up;//-------------------------------------------------------------------------------------------

down = down;

} else {

down = MathMin (minh, down);

}

atrhi = down + atr;

atrlo = down - atr;

up = 0.0; //-------------------------------------------------------------------------------------------

}

if(alertsOn){

if((up[2]!=EMPTY_VALUE) && (down[2]!=EMPTY_VALUE) &&(up[1]!=EMPTY_VALUE)&&(down[1]==EMPTY_VALUE))lcheckalert();

if((up[2]!=EMPTY_VALUE) && (down[2]==EMPTY_VALUE) &&(up[1]!=EMPTY_VALUE)&&(down[1]!=EMPTY_VALUE))scheckalert();

}

}

return (0);

}

void lcheckalert()

{

static datetime candletime=0;

if(candletime!=Time[0])

{

string lmessage = "ZOXY is green on, this means a buy signal! Pair:"+_Symbol +" Price: "+Ask;

if (alertsMessage) Alert(lmessage);

if (alertsNotify) SendNotification(lmessage);

if (alertsEmail) SendMail(StringConcatenate(Symbol()," Buy signal "),lmessage);

if (alertsSound) PlaySound("alert2.wav");

candletime=Time[0];

}

}

void scheckalert()

{

static datetime candletime=0;

if(candletime!=Time[0])

{

string smessage = "ZOXY is Red, this means a sell signal! Pair: "+_Symbol +" Price: "+Bid;

if (alertsMessage) Alert(smessage);

if (alertsNotify) SendNotification(smessage);

if (alertsEmail) SendMail(StringConcatenate(Symbol()," Sell signal "),smessage);

if (alertsSound) PlaySound("alert2.wav");

candletime=Time[0];

}

}

zoxy.mq4

xtractalpha

SetIndexEmptyValue()에 관계없이 EMPTY_VALUE는 == 0이 아니라 2147483647입니다. 또한 해당 코드에서 먼저 정리해야 하는 다시 그리기 문제가 있습니다.

 

누군가가 이 표시기를 수정하여 차트에 경고(이미 있음) 화살표를 표시하고 첫 번째 촛불에서만 ema 위/아래에서 마감되는 것을 경고해야 합니다.

candle_close_cross_ma_alert1.mq4

 
triip:
누군가가 이 표시기를 수정하여 차트에 경고(이미 있음) 화살표를 표시하고 첫 번째 촛불에서만 ema 위/아래에서 마감되는 것을 경고해야 합니다. candle_close_cross_ma_alert1.mq4

여행

이것을 확인하십시오 : https://www.mql5.com/en/forum/general

빠른 ma 기간을 1로 설정하면 가격이 이동 평균(슬로 마)을 교차하는 것과 동일합니다.

 

당신의 도움 없이는 고칠 수 없었습니다.

(ps. 코드가 작동 중입니다).

좋은 하루 되세요!