[MT4-EA]发个自己写的平保脚本
本人自己写的平保脚本,很实用,单子盈利后需要平保了,双击一下脚本就好了。
#property copyright "短线趋势跟踪"
#property link "QQ-1946364477"
#property version "1.00"
#property strict
extern double 平保启动点数=30;
extern double 平保点数=10;
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
平保();
}
//+------------------------------------------------------------------+
void 平保()
{
int cnt, total;
total=OrdersTotal();
for(cnt=total-1;cnt>=0;cnt--)
{
if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))
if(OrderType()==OP_BUY&&OrderSymbol()==Symbol()&&OrderStopLoss()平保启动点数*Point){
bool chenggong= OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+平保点数*Point,OrderTakeProfit(),0,Green);
if (chenggong)Print("单号:"+DoubleToStr(OrderTicket(),0)+"平保成功");
if(chenggong==false)Print("单号:"+DoubleToStr(OrderTicket(),0)+"平保失败:"+DoubleToStr(GetLastError(),0));
}
if(OrderType()==OP_SELL&&OrderSymbol()==Symbol()&&(OrderStopLoss()>OrderOpenPrice()||OrderStopLoss()==0)&&OrderOpenPrice()-Ask>平保启动点数*Point){
bool chenggong=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-平保点数*Point,OrderTakeProfit(),0,Green);
if (chenggong)Print("单号:"+DoubleToStr(OrderTicket(),0)+"平保成功");
if(chenggong==false)Print("单号:"+DoubleToStr(OrderTicket(),0)+"平保失败:"+DoubleToStr(GetLastError(),0));
}
}
}
305_PingBao.ex4305_PingBao.mq4
发表于:2015-09-08 12:03只看该作者
2楼
喔喔喔~~~~不知道怎麼用呢
韬客社区www.talkfx.co
发表于:2015-09-14 15:07只看该作者
3楼
我想要一直獲利~哈哈哈
韬客社区www.talkfx.co
发表于:2015-09-28 09:04只看该作者
4楼
謝謝
韬客社区www.talkfx.co
发表于:2017-04-15 14:36只看该作者
5楼
不错啊看看