ต้องการให้ซื้อขายที่ จุดไข่ปลาอันเเรกเพียงอย่างเดียวและต้องการเก็บ 1 จุด เท่านั้น
/+------------------------------------------------------------------+
//| Parabolic And ADX EA.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
extern double Lots=0.1;
extern double SAR_Step=0.02;
extern double SAR_Maximum=0.2;
extern int StoplossPercent=30;
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
double sar=iSAR(Symbol(),0,SAR_Step,SAR_Maximum,0);
double sars=iSAR(Symbol(),0,SAR_Step,SAR_Maximum,1);
//----
if(OrdersTotal()==0 && Close[0]>sar)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,NULL,0,0,Blue);
}
if(OrdersTotal()==0 && Close[0]<sar)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,NULL,0,0,Red);
}
if(OrdersTotal()>0)
{
if(100*AccountEquity()/AccountBalance()<StoplossPercent)
{
OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES);
if(OrderType()==OP_BUY)
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Black);
}
if(OrderType()==OP_SELL)
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,Black);
}
}
OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES);
if(OrderType()==OP_BUY && (Close[0]<sar ))
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NONE);
}
if(OrderType()==OP_SELL && (Close[1]>sar))
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,CLR_NONE);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+