코딩하는 방법? - 페이지 167

 
 

여전히 이 표시기에 가청 경고를 추가하려고 합니다. 작동하지 않는 코드를 누군가 확인할 수 있습니까?

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

//|

//|

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

#property copyright "niva"

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 White

#property indicator_color2 Red

extern bool Email_Enabled = false;

extern bool Alert_Enabled = true;

//---- input parameters

int CountBars=10000;

//---- buffers

double uptrend[];

double downtrend[];

bool AlertSent,EmailSent;

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

//| Custom indicator initialization function |

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

int init()

{

//---- indicator line

IndicatorBuffers(2);

SetIndexStyle(0,DRAW_ARROW);

SetIndexArrow(0,217);

SetIndexStyle(1,DRAW_ARROW);

SetIndexArrow(1,218);

SetIndexBuffer(0,val1);

SetIndexBuffer(1,val2);

//----

return(0);

}

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

//| AltrTrend_Signal_v2_2 |

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

int start()

{

if (CountBars>=Bars) CountBars=Bars;

int i,shift,counted_bars=IndicatorCounted();

int uptrend, downtrend;

for (shift = CountBars; shift>=0; shift--)

{

if(High[shift-1]>High[shift]&&Low[shift-1]>Low[shift]&&uptrend!=3){

uptrend = uptrend+1;

downtrend=0;

}else if(High[shift-1]<High[shift]&&Low[shift-1]<Low[shift]&&downtrend!=3){

downtrend=downtrend+1;

uptrend=0;

}

else{

uptrend=0;

downtrend=0;

}

if (uptrend==3)

{

val1[shift]=Low[shift];

}

if (downtrend==3)

{

val2[shift]=High[shift];

}

}

return(0);

}

//----

if (Alert_Enabled && (uptrend[0] != 0 || uptrend[0] !=0) && !AlertSent)

{

Alert(Symbol() + "HiLow+3");

AlertSent=true;

}

if (Email_Enabled && (downtrend[0] != 0 || downtrend[0] !=0) && !EmailSent)

{

SendMail(Symbol() + "HiLow+3","HiLow+3 indicator triggered");

EmailSent=true;

}

if(downtrend[0] == 0 && uptrend[0] == 0 )

{

EmailSent=false;

AlertSent=false;

}

return(0);

}

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

감사해요

mrwobbles:
코드의 어딘가에 대괄호가 불균형합니다. 어딘가에 } 및 a )가 코드에서 누락된 것처럼 들립니다. 얼마나 많은 것이 누락되었는지 알려야 하는 열린 대괄호와 닫힌 대괄호의 수(열림의 경우 +1, 닫힘의 경우 -1)를 살펴보고 계산해야 합니다(예: +2 수는 두 개의 오른쪽 대괄호 '}'를 의미하거나 그 반대). 들여쓰기를 제대로 했다면 오른쪽 }을 어디에 넣어야 하는지 알 수 있을 것입니다. 즐거운 사냥

나는 그럭저럭 일부 설정을 변경할 수 있었고 마침내 거의 거기에 있다고 믿습니다! 이제 다음 코딩 후에 다음과 같이 표시됩니다.

'shortSL' - 변수가 정의되지 않았습니다.

'longSL' - 변수가 정의되지 않음

다음과 같이 보입니다.

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

//| 살가도.mq4 |

//| salgadoguilherme@hotmail.com |

//| |

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

#재산권 ""

#속성링크 "salgadoguilherme@hotmail.com"

extern bool trade=true;

extern int bartocount=50;

외부 이중 로트 = 0.01;

extern int 손절매 = 40;

외부 정수 TakeProfit = 10;

extern int 미끄러짐 = 3;

extern int magicnumber=816;

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

//| 전문가 초기화 기능 |

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

정수 초기화()

{

//----

//----

리턴(0);

}

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

//| 전문가 초기화 해제 기능 |

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

정수 초기화()

{

//----

//----

리턴(0);

}

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

//| 전문가 시작 기능 |

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

정수 시작()

{

//----

if(거래==참)

{

//M15

이중 M15_resistance=iCustom(NULL,PERIOD_M15,"!LinRegrBuf","true",barstocount,2,0);

이중 M15_resistance_p=iCustom(NULL,PERIOD_M15,"!LinRegrBuf","true",barstocount,2,barstocount-1);

이중 M15_line=iCustom(NULL,PERIOD_M15,"!LinRegrBuf","true",barstocount,0,0);

이중 M15_support=iCustom(NULL,PERIOD_M15,"!LinRegrBuf","true",barstocount,1,0);

이중 기울기M15=((M15_resistance-M15_resistance_p)/barstocount)/점;

//Alert(DoubleToStr(slopeM15,2);

논평(

"\n","M15 경사 | ",slopeM15,

//짧은 항목

if(slopeM15<0 && IsTradeAllowed()==true)

{

부울 shortopen=거짓;

int ord_cnt1=주문 총계();

for (int start1=0;start1<ord_cnt1;start1++)

{

주문선택(start1, SELECT_BY_POS, MODE_TRADES);

if(OrderMagicNumber()==magicnumber && OrderType()==OP_SELL)

{shortopen=참;}

}

if(shortopen==거짓)

{

이중 M15High=iHigh(Symbol(),PERIOD_M15,0);

if(M15High>=M15_resistance)

int shortticket=OrderSend(Symbol(),OP_SELL,lots,Bid,slippage,Bid+shortSL,M15_line,DoubleToStr(slopeM15,2);

if(단축키<0)

{

//긴 항목

if(slopeM15>0 && IsTradeAllowed()==true)

{

bool longopen=거짓;

int ord_cnt=OrdersTotal();

for (int start=0;start<ord_cnt;start++)

{

주문 선택(시작, SELECT_BY_POS, MODE_TRADES);

if(OrderMagicNumber()==magicnumber && OrderType()==OP_BUY)

{longopen=참;}

}

if(longopen==거짓)

{

이중 M15Low=iLow(Symbol(),PERIOD_M15,0);

if(M15낮음<=M15_support)

int longticket=OrderSend(Symbol(),OP_BUY,lots,Ask,slippage,Ask-longSL,M15_line,DoubleToStr(slopeM15,2);

if(롱티켓<0)

{

//----

리턴(0);

}

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

 

캔들형 인디

안녕,

첨부된 차트와 같은 캔들형 지표를 코딩하는 방법에 대한 MQL 튜토리얼이 절실히 필요합니다. 이 포럼 내부 또는 외부에 있는 링크만 있으면 됩니다. 정말 고마워.

피리 부는 사람.

파일:
ma_candles.gif  15 kb
 

누군가 다음을 코딩하는 방법을 말해 줄 수 있습니까?

단기 MA가 장기 MA를 넘은 이후 의 막대 수를 계산합니다.

고맙습니다!

 

종료 후 거래를 재개하는 EA 코드.

안녕,

중단된 후 거래 관리를 재개할 수 있고 다시 돌아올 수 있는 EA용 샘플 코드가 있습니까?

감사해요,

제이포렉스

 

코딩하는 방법?

darvasboxes:
누군가 다음을 코딩하는 방법을 말해 줄 수 있습니까?

단기 MA가 장기 MA를 넘은 이후의 막대 수를 계산합니다.

고맙습니다!

네!

교차한 이후 막대를 세십시오.

정수 나;

bool shortGreater = (iMA(NULL,0,8,8,MODE_SMMA,PRICE_MEDIAN,0) > iMA(NULL,0,24,8,MODE_SMMA,PRICE_MEDIAN,0));

부울 sgLast;

for(i=0;i<iBars(NULL,0);i++) {

sgLast = shortGreater;

shortGreater = (iMA(NULL,0,8,8,MODE_SMMA,PRICE_MEDIAN,i) > iMA(NULL,0,24,8,MODE_SMMA,PRICE_MEDIAN,i));

if(shortGreater !== sgLast) {

부서지다;

}

}

변수 i는 교차한 이후의 막대 수를 포함합니다.

도움이 되셨다면 저에게 현금을 보내주십시오. 감사합니다.

 

여기 있습니다.

Guilhermesalgado:
나는 그럭저럭 일부 설정을 변경할 수 있었고 마침내 거의 거기에 있다고 믿습니다! 이제 다음 코딩 후에 다음과 같이 표시됩니다.

'shortSL' - 변수가 정의되지 않음

'longSL' - 변수가 정의되지 않았습니다.

여기 있습니다. 하신거 가져가서 수정했습니다. 당신의 논리가 나쁘고 불완전해 보이며 아마도 당신이 원하는 대로 되지 않을 것입니다.

하지만 당신은 간다.

- 채즈머니

PS $170는 프로그램에 대해 매우 저렴합니다. 나는 5자리 숫자에 대해 1년에 한두 번 맞춤형 투자 소프트웨어를 작성합니다. 이러한 종류의 작업을 수행하는 프로그래머는 주의해야 합니다. 모든 것을 확인하여 케이스를 놓치지 않도록 해야 합니다. 버그는 무작위 거래자만큼 좋습니다.

도움이 되셨다면 저에게 현금을 보내주십시오. 나는 그 생각에 감사한다.

파일:
 

표준 ZigZag의 코드

안녕

이 코드는 표준 "ZigZag.mq4"에서 가져온 것입니다.

"if (counted_bars==0 && downloadhistory) // 다운로드 기록"

counted_bars==0 : 값이 0과 같은지 확인 합니다........ 괜찮습니다.

downloadhistory : 조건체크가 안되는데 왜??? 이것을 지워주세요

감사해요.

 

2개의 주문을 열고 2개의 주문을 닫습니다..일관되게.

저는 오랫동안 EA가 매수 또는 매도를 위해 항상 2개의 주문을 열도록 하려고 노력하고 있습니다. 하나는 TP이고 다른 하나는 NONE입니다. 2개의 주문을 연 후 반대 방향으로 거래할 시간이 될 때까지 더 이상 열지 마십시오.

어떤 이유로, 나는 계정 기록을보고 1 주문, 3 주문, 4 주문, 2 주문을보고 쓰레기처럼 실행되고 있습니다.

여기 있는 코딩 마스터가 나에게 정보를 제공할 수 있습니까?

감사합니다!!!!!!!!!!!!!!!!

오픈 오더

-------

BuyTicket1 = 거짓;

BuyTicket2 = 거짓;

동안 (!BuyTicket1) {

BuyTicket1 = OrderSend(Symbol(), OP_BUY, lot, Ask, Slippage, StopLoss, Ask + TakeProfit * 포인트, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue);

절전(Pause betweenOrders * 1000);}

//if (BuyTicket1 && SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " 첫 번째 구매 열기");

수면(1000);

동안 (!BuyTicket2) {

BuyTicket2 = OrderSend(Symbol(), OP_BUY, lot, Ask, Slippage, StopLoss, 0, "2nd Buy(#" + MagicNumber + ")", MagicNumber, 0, BlueViolet);

절전(Pause betweenOrders * 1000);}

----------

마감 주문

----------

if(OrdersTotal() > 0) {

주문 선택(0, SELECT_BY_POS, MODE_TRADES);

if(주문 유형() == OP_SELL){

(int j = OrdertotalCloseSell-1; j >= 0; j --) {

PositionClosedSell = 거짓;

AttemptsTriedCloseSell = 0;

주문 선택(j, SELECT_BY_POS, MODE_TRADES);

동안 (!PositionClosedSell && AttemptsTriedCloseSell < CloseposnAttempts) {

AttemptsTriedCloseSell = AttemptsTriedCloseSell + 1;

OrderCloseSell = OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, MediumSeaGreen);

절전(주문 사이 일시 중지 * 1000);

if( OrderCloseSell == True ) { // 포지션 마감 성공.