//+------------------------------------------------------------------+//| MACD Sample.mq4 |//| Copyright 2005-2014, MetaQuotes Software Corp. |//| http://www.mql4.com |//+------------------------------------------------------------------+#property copyright"2005-2014, MetaQuotes Software Corp."#property link" http://www.mql4.com "inputdouble TakeProfit = 3160 ;
inputdouble Lots = 0.5 ;
inputdouble TrailingStop = 1040 ;
inputint OpenLevel = 22 ;
inputint CloseLevel= 77 ;
inputintPeriod = 85 ;
inputint Period1 = 57 ;
int LastBars= 0 ;
externint Magic = 110725 ;
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+voidOnTick ( void )
{
int cnt,ticket,total;
//---// initial data checks// it is important to make sure that the expert works with a normal// chart and the user did not make any mistakes setting external // variables (Lots, StopLoss, TakeProfit, // TrailingStop) in our case, we check TakeProfit// on a chart of less than 100 bars//---//--- Trade only if new bar has arrivedif (LastBars!= Bars ) LastBars= Bars ;
elsereturn ( 0 );
if ( Bars < 100 )
{
Print ( "bars less than 100" );
return ;
}
if (TakeProfit< 10 )
{
Print ( "TakeProfit less than 10" );
return ;
}
//--- to simplify the coding and speed up access data are put into internal variables
total= OrdersTotal ();
if (total< 1 )
{
//--- no opened orders identifiedif (AccountFreeMargin()<( 1000 *Lots))
{
Print ( "We have no money. Free Margin = " ,AccountFreeMargin());
return ;
}
//--- check for long position (BUY) possibilityif ( iRSI ( NULL , 0 ,OpenLevel, PRICE_LOW , Period )> iRSI ( NULL , 0 ,CloseLevel, PRICE_HIGH ,Period1))
{
ticket= OrderSend ( Symbol (),OP_BUY,Lots,Ask, 3 ,Bid-TakeProfit* Point ,Bid+TakeProfit* Point , "USDCADH4" ,Magic, 0 ,Green);
if (ticket> 0 )
{
if ( OrderSelect (ticket,SELECT_BY_TICKET,MODE_TRADES))
Print ( "BUY order opened : " ,OrderOpenPrice());
}
elsePrint ( "Error opening BUY order : " , GetLastError ());
return ;
}
//--- check for short position (SELL) possibilityif ( iRSI ( NULL , 0 ,OpenLevel, PRICE_LOW ,Period1)< iRSI ( NULL , 0 ,CloseLevel, PRICE_HIGH , Period ))
{
ticket= OrderSend ( Symbol (),OP_SELL,Lots,Bid, 3 ,Ask+TakeProfit* Point ,Ask-TakeProfit* Point , "USDCADH4" ,Magic, 0 ,Red);
if (ticket> 0 )
{
if ( OrderSelect (ticket,SELECT_BY_TICKET,MODE_TRADES))
Print ( "SELL order opened : " ,OrderOpenPrice());
}
elsePrint ( "Error opening SELL order : " , GetLastError ());
}
//--- exit from the "no opened orders" blockreturn ;
}
//--- it is important to enter the market correctly, but it is more important to exit it correctly... for (cnt= 0 ;cnt<total;cnt++)
{
if (! OrderSelect (cnt,SELECT_BY_POS,MODE_TRADES))
continue ;
if (OrderType()<=OP_SELL && // check for opened position
OrderSymbol()== Symbol ()) // check for symbol
{
//--- long position is openedif (OrderType()==OP_BUY)
{
//--- should it be closed?if ( iRSI ( NULL , 0 ,OpenLevel, PRICE_LOW ,Period1)< iRSI ( NULL , 0 ,CloseLevel, PRICE_HIGH , Period ))
{
//--- close order and exitif (!OrderClose(OrderTicket(),OrderLots(),Bid, 3 ,Violet))
Print ( "OrderClose error " , GetLastError ());
return ;
}
//--- check for trailing stopif (TrailingStop> 0 )
{
if (Bid-OrderOpenPrice()> Point *TrailingStop)
{
if (OrderStopLoss()<Bid- Point *TrailingStop)
{
//--- modify order and exitif (!OrderModify(OrderTicket(),OrderOpenPrice(),Bid- Point *TrailingStop,OrderTakeProfit(), 0 ,Green))
Print ( "OrderModify error " , GetLastError ());
return ;
}
}
}
}
else// go to short position
{
//--- should it be closed?if ( iRSI ( NULL , 0 ,OpenLevel, PRICE_LOW , Period )> iRSI ( NULL , 0 ,CloseLevel, PRICE_HIGH ,Period1))
{
//--- close order and exitif (!OrderClose(OrderTicket(),OrderLots(),Ask, 3 ,Violet))
Print ( "OrderClose error " , GetLastError ());
return ;
}
//--- check for trailing stopif (TrailingStop> 0 )
{
if ((OrderOpenPrice()-Ask)>( Point *TrailingStop))
{
if ((OrderStopLoss()>(Ask+ Point *TrailingStop)) || (OrderStopLoss()== 0 ))
{
//--- modify order and exitif (!OrderModify(OrderTicket(),OrderOpenPrice(),Ask+ Point *TrailingStop,OrderTakeProfit(), 0 ,Red))
Print ( "OrderModify error " , GetLastError ());
return ;
}
}
}
}
}
}
//---
}
//+------------------------------------------------------------------+
if (! OrderSelect (cnt,SELECT_BY_POS,MODE_TRADES))
continue ;
if (OrderType()<=OP_SELL && // check for opened position
OrderSymbol()== Symbol ()&& OrderMagicNumber()==Magic) // check for symbol
그런 다음 그는 수동으로 거래를 열 때 다른 사람의 거래를 닫지 않지만 수동으로 열린 거래가 있는 경우 자신의 거래도 전혀 열지 않습니다.
요청은 어제 보냈고 하루가 지나고 침묵
1. 가까운 ATM에 가서 카드를 넣고 핀코드를 입력하고...
2. 가까운 은행에 가셔서 눈팅하시고 상황에 따라...
3. 시장에 가십시오. 기계를 사세요. 은행에 가십시오. 자금 인출 (자신의 것이 아니라 모든 것을 인출 할 수 있습니다 ...) ...
4. MMM에서 철수해야 하는 경우 탱크도 도움이 되지 않습니다!
그러나 진지하게, 당신은하지 않습니다!
좋은 오후입니다. 도와주세요.
좋은 오후입니다. 도와주세요.
상단에 옵션이 적힌 상태에서 어드바이저는 수동으로 열린 거래를 닫고,
그리고 이렇게 쓴다면
그런 다음 그는 수동으로 거래를 열 때 다른 사람의 거래를 닫지 않지만 수동으로 열린 거래가 있는 경우 자신의 거래도 전혀 열지 않습니다.
상단에 옵션이 적힌 상태에서 어드바이저는 수동으로 열린 거래를 닫고,
그리고 이렇게 쓴다면
그런 다음 그는 수동으로 거래를 열 때 다른 사람의 거래를 닫지 않지만 수동으로 열린 거래가 있는 경우 자신의 거래도 전혀 열지 않습니다.
열 때 여전히 마법에 대한 선택이 필요합니다.
그리고 그게 뭐야? 열면 표시됩니다. 사실은 여러 명의 어드바이저를 사용할 때 문제가 없다는 것입니다.문제는 계정에 트랜잭션을 수동으로 열 때만 문제입니다.
수동으로 개설한 거래가 계정에 표시되자마자 고문은 즉시 작동을 멈춥니다.
코드에서 이 total=OrdersTotal();을 제거하자마자;
if(총<1)
고문은 즉시 켜지 만 많은 거래를 엽니 다.
그리고 그게 뭐야? 열면 표시됩니다. 사실은 여러 명의 어드바이저를 사용할 때 문제가 없다는 것입니다.문제는 계정에 트랜잭션을 수동으로 열 때만 문제입니다.
수동으로 개설한 거래가 계정에 표시되자마자 고문은 즉시 작동을 멈춥니다.
코드에서 이 total=OrdersTotal();을 제거하자마자;
if(총<1)
고문은 즉시 켜지 만 많은 거래를 엽니 다.
이것이 내가 말하는 것입니다.OrdersTotal()은 모든 주문이며 고문의 주문이 필요합니다.
이것이 내가 말하는 것입니다.OrdersTotal()은 모든 주문이며 고문의 주문이 필요합니다.
이것은 대신
총계=주문총계();
if(total<1) 아니면 그대로 두시겠습니까?