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

 

이것은 잘못되었습니다: if(totalOrders==0 && Magic==OrderMagicNumber() &&

OrderSelect(i-1, SELECT_BY_POS,MODE_HISTORY)==true)

OrderSelect() 전에 OrderMagicNumber()를 호출하기 때문에 아마도 이전 호출을 참조할 것입니다.

 
EBK:
아, 제 의견을 잘못 표현해서 죄송합니다.

나는 주식이 가치 이하인 경우 EA 거래(또는 EA 거래의 일부)를 중지할 무언가를 코딩하고 싶지만(할 수 없습니다).

도와주셔서 감사합니다. Roger09, 하지만 차트에 자기 자본을 표시할 필요가 없습니다.

이 EA를 시도

CloseAllBuySell - MQL4 코드 베이스

아이디어를 사용하고 다음과 같은 코드를 만드십시오.

if (AccountEquity()<YourValue) closeallorders();

 

누군가 샘플 이동 평균 EA에 EMA 후행 중지를 추가해 주시겠습니까?

EMA 후행이 1로 설정됨

그런 다음 항목을 다음으로 변경하십시오.

매수=열기[1]>ma && 닫기[1]>ma;

판매=개방[1]<ma && 닫기[1]<ma;

이것은 아주 좋은 간단한 스캘퍼를 만들어야 합니다.

건배

베노

파일:
 
 

프로그램 시작 부분에 추가

extern int pips=2;//(또는 핍 수)

그런 다음 교체

if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice()))

sl = OrderOpenPrice() ;

if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))

sl = OrderOpenPrice() ;[/CODE]

to

[CODE]if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice()))

sl = OrderOpenPrice() +pips*Point;

if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))

sl = OrderOpenPrice() -pips*Point;
 

누군가 이 표시기가 새 화살표를 그릴 때 경고를 표시하도록 도와줄 수 있습니까?

감사해요!

파일:
hilow3.mq4  2 kb
 

아니, 수정

extern int pips=2;

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

//| 스크립트 프로그램 시작 기능 |

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

정수 시작()

{

//----

문자열 curr = Symbol();

int ot = 주문 합계();

int ord[200], ordType[200], ordTicket[200]; 이중 ordLots[200];

문자열 ordComments[200];

정수 ix=0;

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

{

int o = 주문 선택(i, SELECT_BY_POS);

if (OrderSymbol() == Symbol())

if ((OrderType() == OP_BUY) || (OrderType() == OP_SELL))

{

이중 sl = 0;

if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice()))

sl = OrderOpenPrice() +핍*포인트;

if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))

sl = OrderOpenPrice() -핍*포인트;

if (sl != 0+10)

OrderModify(OrderTicket(), OrderOpenPrice(), sl, OrderTakeProfit(), 0);

}

}

//----

반환(0);

 

이제 코드는 다음과 같습니다.

extern int pips=10;//

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

//| 스크립트 프로그램 시작 기능 |

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

정수 시작()

{

//----

문자열 curr = Symbol();

int ot = 주문 합계();

int ord[200], ordType[200], ordTicket[200]; 이중 ordLots[200];

문자열 ordComments[200];

정수 ix=0;

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

{

int o = 주문 선택(i, SELECT_BY_POS);

if (OrderSymbol() == Symbol())

if ((OrderType() == OP_BUY) || (OrderType() == OP_SELL))

{

이중 sl = 0;

if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice()))

sl = OrderOpenPrice() +핍*포인트;

if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))

sl = OrderOpenPrice() -핍*포인트;

만약 (sl != 0)

OrderModify(OrderTicket(), OrderOpenPrice(), sl, OrderTakeProfit(), 0);

}

}

//----

리턴(0);

}

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

 

안녕하세요 Roger09,

이 코드에 도움을 주셔서 감사합니다. 내 스크립트 코드는 이제 다음과 같습니다.

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

//| 스크립트 프로그램 시작 기능 |

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

정수 시작()

{

//----

extern int pips=2;//

문자열 curr = Symbol();

int ot = 주문 합계();

int ord[200], ordType[200], ordTicket[200]; 이중 ordLots[200];

문자열 ordComments[200];

정수 ix=0;

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

{

int o = 주문 선택(i, SELECT_BY_POS);

if (OrderSymbol() == Symbol())

if ((OrderType() == OP_BUY) || (OrderType() == OP_SELL))

{

이중 sl = 0;

if ((OrderType() == OP_BUY) && (OrderStopLoss() < OrderOpenPrice()))

sl = OrderOpenPrice() +핍*포인트;

if ((OrderType() == OP_SELL) && (OrderStopLoss() > OrderOpenPrice()))

sl = OrderOpenPrice() -핍*포인트;

만약 (sl != 0)

OrderModify(OrderTicket(), OrderOpenPrice(), sl, OrderTakeProfit(), 0);

}

}

//----

반환(0);

내가 제대로 알고 있는지 알려주실 수 있습니까? 나는 여기에서 눈이 멀었으므로 나와 함께 참아라.

 

실제로는 작동하겠지만 이 코드는 좋지 않습니다. 불행히도 나는 당신의 주요 목표를 모르고 다른 것을 추천할 수 없습니다.