BreakEvenExpert_v1

BreakEvenExpert_v1最新版

更新日期:2022-03-13分类标签: 语言:中文平台:没限制

30 人已下载 手机查看

BreakEvenExpert_v1
//+——————————————————————+
//| BreakEvenExpert_v1.mq4 |
//| Copyright ?2006, Forex-TSD.com |
//| Written by IgorAD,igorad2003@yahoo.co.uk |
//| http://finance.groups.yahoo.com/group/TrendLaboratory |
//+——————————————————————+
#property copyright “Copyright ?2006, Forex-TSD.com ”
#property link “http://www.forex-tsd.com/”

//—- input parameters

extern double BreakEven = 30; // Profit Lock in pips

int digit=0;

//+——————————————————————+
//| expert initialization function |
//+——————————————————————+
int init()
{

//—-
return(0);
}

// —- Trailing Stops
void TrailStops()
{
int total=OrdersTotal();
for (int cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS);
int mode=OrderType();
if ( OrderSymbol()==Symbol() )
{
if ( mode==OP_BUY )
{
if ( Bid-OrderOpenPrice()>Point*BreakEven )
{
double BuyStop = OrderOpenPrice();
OrderModify(OrderTicket(),OrderOpenPrice(),
NormalizeDouble(BuyStop, digit),
OrderTakeProfit(),0,LightGreen);
return(0);
}
}
if ( mode==OP_SELL )
{
if ( OrderOpenPrice()-Ask>Point*BreakEven )
{
double SellStop = OrderOpenPrice();
OrderModify(OrderTicket(),OrderOpenPrice(),
NormalizeDouble(SellStop, digit),
OrderTakeProfit(),0,Yellow);
return(0);
}
}
}
}
}

// —- Scan Trades
int ScanTrades()
{
int total = OrdersTotal();
int numords = 0;

for(int cnt=0; cnt<total; cnt++)
{
OrderSelect(cnt, SELECT_BY_POS);
if(OrderSymbol() == Symbol() && OrderType()<=OP_SELL)
numords++;
}
return(numords);
}

//+——————————————————————+
//| expert deinitialization function |
//+——————————————————————+
int deinit()
{
//—-

//—-
return(0);
}
//+——————————————————————+
//| expert start function |
//+——————————————————————+
int start()
{
digit = MarketInfo(Symbol(),MODE_DIGITS);

if (ScanTrades()<1) return(0);
else
if (BreakEven>0) TrailStops();

return(0);
}//int start
//+——————————————————————+

 

 

 

如果你对文件有了解,请帮助投票!

If you are familiar with the file, please help vote!

平均评分 0 / 5. 投票数: 0

到目前为止还没有投票!成为第一位投票人。

相关资源

暂无评论

暂无评论...