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

 

mql4의 코드에 대해

현재 차트에 높은 가격과 낮은 가격을 넣고 싶습니다.

하지만 MQL4로 내 표시기에 코드를 작성하는 방법을 모르겠습니다.

정말 감사합니다!

 

손절매를 이동하는 코드?

안녕하세요 여러분,

현재 자동 거래를 위해 EA를 코딩하고 있으며 완료를 향해 가고 있지만 공개 거래에서 손절매를 이동하는 방법을 알 수 없습니다. 나는 여기에 내 코드를 게시하고 있습니다. 누군가 내가 무엇을 잘못하고 있는지 지적 할 수 있다면 크게 감사하겠습니다.

이것은 LONG 위치를 여는 코드의 일부입니다.

{

if(//long entry criteria met)

{

if (priorbartime == Time[0])

return(0);

priorbartime = Time[0];

Alert("Long Signal");

ObjectCreate(arrowlong, OBJ_ARROW, 0, Time[0], Open[0], 0, 0, 0, 0);

ObjectSet(arrowlong, OBJPROP_ARROWCODE, 233);

ObjectSet(arrowlong, OBJPROP_COLOR, Aqua);

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,0,Ask-StopLoss*Point,Ask+TakeProfit*Point,"am crossing",16677,0,Green); // HDB CHANGED Close TO Ask and SlipPage to 0

if(ticket>0)

{

if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());

}

else Print("Error opening BUY order : ",GetLastError());

return(0);

}

}

[/PHP]

then once the trade is open I want to manage it by moving stop to -5 when the trade is +15, and by moving stop to b/e when trade is +20. this is the code i have come up with so far but it doesnt seem to be working:

[PHP]

total=OrdersTotal();

if(total>0)

{

for(cnt=0;cnt<total;cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_BUY && OrderSymbol()==Symbol())

{

if(Bid-OrderOpenPrice()==Point*15)

{

OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Point*5,OrderTakeProfit(),0,Blue);

return(0);

}

if(Bid-OrderOpenPrice()==Point*20)

{

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

return(0);

}

}

}

}

언급했듯이 이것은 모두 LONG 포지션에 대한 것입니다.

도움을 주셔서 감사합니다!

divergence_trader

 

많은 사람들이 이미 여러 번 그것에 대해 질문했습니다.

그래서 읽어보세요:

- 이 게시물 ,

- 이것

- 이 Codersguru 스레드 .

 

newdigital에게 감사드립니다. SBFX, metaquote 및 여기에서 많은 스레드를 살펴보았지만 내가 찾던 것을 찾지 못했습니다. 바라건대 이것들이 도움이 될 것입니다!

 

이 시도:

total=OrdersTotal();

if(total>0){

for(cnt=0;cnt<total;cnt++){

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_BUY && OrderSymbol()==Symbol()){

if(Bid-OrderOpenPrice()>=Point*15 && Bid-OrderOpenPrice()<Point*20 && OrderStopLoss()< OrderOpenPrice()-5*Point){

OrderModify(OrderTicket(),OrderOpenPrice()-Point*5,OrderTakeProfit(),Blue);

}

if(Bid-OrderOpenPrice()>=Point*20 && OrderStopLoss()< OrderOpenPrice()){

OrderModify(OrderTicket(),OrderOpenPrice(),OrderTakeProfit(),Blue);

}

}

}

}
 

이것들처럼

 

MA 레벨 코드

안녕

MA 수준의 코드를 작성하려고 하지만 작동하지 않습니다...

누구든지 나에게 어떻게 할 수 있는지 말해 줄 수 있습니다 plz.

감사해요

파일:
levels.png  20 kb
 
mas:
안녕

MA 수준의 코드를 작성하려고 하지만 작동하지 않습니다...

누구든지 나에게 어떻게 할 수 있는지 말해 줄 수 있습니다 plz.

감사해요

Vegas Currancy Daily 표시기를 가이드로 사용할 수 있습니다. 첨부를 참조하십시오.

케리스

파일:
 
Nicholishen:
이 시도:

Nicholishen에게 감사합니다. 코드가 완벽하게 작동합니다. 지금까지 라이브 시장에서 테스트할 기회를 얻지 못했지만 모두 잘 작동합니다. 다시 한번 감사합니다!

 

기능요청: 거래 실패 후 로트 크기를 두 배로 늘리는 EA 코드.

마지막 거래가 손실로 마감되면(martingale 시스템) EA에 로트 크기를 늘리고 마지막 거래가 이익으로 마감되면 일반 로트 크기를 사용하도록 지시하는 방법이 있는지 알고 싶습니다. 마이크로 랏을 사용할 수 있어야 합니다. 이 작업을 수행할 수 있는 방법이 있습니까?