AlexSoft-1

AlexSoft-1

官方版无广告278

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

53 人已下载 手机查看

AlexSoft-1

 

//+——————————————————————+
//| DVA_Martin_Dual_201116.mq4 |
//| Copyright 2016, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+——————————————————————+
#property copyright “Copyright 2016, MetaQuotes Software Corp.”
#property link “https://www.mql5.com”
#property version “1.00”
#property strict
input int TakeProfit1 = 300; // 镳铘栩 镥疴钽?铕溴疣
input int TakeProfit2 = 250; // 镳铘栩 怛铕钽?铕溴疣
input int TakeProfit3 = 200; // 镳铘栩 蝠弪泐 铕溴疣
input int TakeProfit4 = 100; // 镳铘栩 麇蜮屦蝾泐 ?耠邃簋?铕溴痤?
input int Step = 200; // ?镥疴钽?铕溴疣
input int Delta = 100; // 漕徉怅??泱 耦 怛铕钽?铕溴疣, 筲咫梓桠噱?疣耨蝾龛?镱耠邃簋?铕溴痤?磬 忮腓麒眢 “溴朦蜞” 铗 镳邃簌邈?
input double Lot = 0.03;// 镥疴 腩?铗牮?
input double MaximalLot = 0.5; // 爨犟桁嚯 腩? 觐蝾瘥?禧 疣琊屮噱?
input int MaxTrades = 9; // 爨犟桁嚯铄 觐腓麇耱忸 铕溴痤?钿眍泐 磬镳噔脲龛
input double MultiplicatorLot = 1.6; // 箪眍驵屐 镱耠邃簋?铕溴疣
input int Magic = 123; // 桧滂忤潴嚯 眍戾? 镱 觐蝾痤祗 耦忮蝽桕 忤溴?疋铊 皲咫觇
input int Slippage = 100; // 漕矬耱桁铄 镳铖赅朦琨忄龛?磬 眍忸耱??矬黻蜞?
//+——————————————————————+
//+——————————————————————+
int OnInit()
{

return(INIT_SUCCEEDED);
}
//+——————————————————————+
//| Expert tick function |
//+——————————————————————+
void OnTick()
{
// 橡屐屙睇?潆 躔囗屙? 耦狃囗眍?桧纛痨圉梃
int b=0,s=0;
double BuyMinPrice=0,SelMaxPrice=0,BuyMinLot=0,SelMaxLot=0;
double LotBuy=0;
double LotSel=0;
for(int i=OrdersTotal()-1; i>=0; i–)
if(OrderSelect(i,SELECT_BY_POS))
if(OrderSymbol()==Symbol())
if(OrderMagicNumber()==Magic)
{
if(OrderType()==OP_BUY)
{
b++; // 痒栩噱?铗牮 铕溴疣 磬 镱牦镪?
if(OrderOpenPrice()<BuyMinPrice || BuyMinPrice==0) // 袜躅滂?龛骓栝 徉?铕溴?
{
BuyMinPrice=OrderOpenPrice(); // 青镱扈磬屐 邈?鲥眢
BuyMinLot=OrderLots(); // 青镱扈磬屐 邈?腩?
}
}
if(OrderType()==OP_SELL)
{
s++; // 痒栩噱?铗牮 铕溴疣 磬 镳钿噫?
if(OrderOpenPrice()>SelMaxPrice) // 袜躅滂?忮瘐龛?皴?铕溴?
{
SelMaxPrice=OrderOpenPrice(); // 青镱扈磬屐 邈?鲥眢
SelMaxLot=OrderLots(); // 青镱扈磬屐 邈?腩?
}
}
}
// 朽聍栩噱?腩螓
if(b==0) // 篷腓 礤?铕溴痤?桉镱朦珞屐 腩?桤 磬耱痤尻
LotBuy=Lot;
else // 软圜?桉镱朦珞屐 疋铋 疣聍弪
LotBuy=BuyMinLot*MultiplicatorLot;
if(LotBuy>MaximalLot) LotBuy=MaximalLot;//钽疣龛麒忄屐 镱 爨犟桁嚯铎?腩蝮

if(s==0)
LotSel=Lot; // 篷腓 礤?铕溴痤?桉镱朦珞屐 腩?桤 磬耱痤尻
else
LotSel=SelMaxLot*MultiplicatorLot; // 软圜?桉镱朦珞屐 疋铋 疣聍弪
if(LotSel>MaximalLot) LotSel=MaximalLot;//钽疣龛麒忄屐 镱 爨犟桁嚯铎?腩蝮

if(b==0 || (b>0 && b<= MaxTrades && Ask<NormalizeDouble(BuyMinPrice-(Step+Delta*b)*Point(),Digits()))) // 篷腓 铕溴痤?礤?铗牮铄?铕溴?// 篷腓 铕溴疣 羼螯 ?篑腩忤?恹镱腠屙?铗牮铄?铕溴?桧 腩蝾?
{
if(OrderSend(Symbol(),OP_BUY,LotBuy,Ask,Slippage,0,0,b,Magic,0,clrBlue)<0) // 篷腓 铕溴?礤 铗牮?
Print(“Error N “,GetLastError()); // 杨钺?钺 铠栳赍
}
if(s==0 || (s>0 && s<= MaxTrades && Bid>NormalizeDouble(SelMaxPrice+(Step+Delta*s)*Point(),Digits())))// 篷腓 铕溴痤?礤?铗牮铄?铕溴?// 篷腓 铕溴疣 羼螯 ?篑腩忤?恹镱腠屙?铗牮铄?铕溴?桧 腩蝾?
{
if(OrderSend(Symbol(),OP_SELL,LotSel,Bid,Slippage,0,0,s,Magic,0,clrRed)<0) // 篷腓 铕溴?礤 铗牮?
Print(“Error N “,GetLastError()); // 杨钺?钺 铠栳赍
}
// 镱聍栩噱?爨蝈爨蜩麇耜桢 纛痨箅?耩邃龛?鲥?
double BuyAwerage=0,SelAwerage=0,BuyPrice=0,SelPrice=0,BuyLot=0,SelLot=0;
for(int i=OrdersTotal()-1; i>=0; i–)
if(OrderSelect(i,SELECT_BY_POS))
if(OrderSymbol()==Symbol())
if(OrderMagicNumber()==Magic)
{
if(OrderType()==OP_BUY)
{
BuyPrice+=OrderOpenPrice()*OrderLots(); // 漕徉忤螯 ?镥疱戾眄铋 BuyPrice 皱磬 铕邃疣 1 * 腩?铕溴疣 1
BuyLot+=OrderLots(); // 耋祆桊箦?腩螓
}
if(OrderType()==OP_SELL)
{
SelPrice+=OrderOpenPrice()*OrderLots(); // 漕徉忤螯 ?镥疱戾眄铋 SelPrice 皱磬 铕邃疣 1 * 腩?铕溴疣 1
SelLot+=OrderLots(); // 耋祆桊箦?腩螓
}
}
if(b==2) BuyAwerage=NormalizeDouble(BuyPrice/BuyLot+TakeProfit2*Point(),Digits()); // 橡铊玮邃屐 疣聍弪 耩邃礤?鲥睇 羼腓 2 铕溴疣
if(s==2) SelAwerage=NormalizeDouble(SelPrice/SelLot-TakeProfit2*Point(),Digits()); // 橡铊玮邃屐 疣聍弪 耩邃礤?鲥睇 羼腓 2 铕溴疣
if(b==3) BuyAwerage=NormalizeDouble(BuyPrice/BuyLot+TakeProfit3*Point(),Digits()); // 橡铊玮邃屐 疣聍弪 耩邃礤?鲥睇 羼腓 2 铕溴疣
if(s==3) SelAwerage=NormalizeDouble(SelPrice/SelLot-TakeProfit3*Point(),Digits()); // 橡铊玮邃屐 疣聍弪 耩邃礤?鲥睇 羼腓 2 铕溴疣
if(b>3) BuyAwerage=NormalizeDouble(BuyPrice/BuyLot+TakeProfit4*Point(),Digits()); // 橡铊玮邃屐 疣聍弪 耩邃礤?鲥睇 潆 铖蜞朦睇?铕溴痤?
if(s>3) SelAwerage=NormalizeDouble(SelPrice/SelLot-TakeProfit4*Point(),Digits()); // 橡铊玮邃屐 疣聍弪 耩邃礤?鲥睇 潆 铖蜞朦睇?铕溴痤?

// —
for(int i=OrdersTotal()-1; i>=0; i–)
if(OrderSelect(i,SELECT_BY_POS))
if(OrderSymbol()==Symbol())
if(OrderMagicNumber()==Magic)
{
if(OrderType()==OP_BUY)
{
if(b==1) // 篷腓 铕溴?钿桧 ??礤泐 礤?蝈殛 镳铘栩?
if(OrderTakeProfit()==0)
if(OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),NormalizeDouble(OrderOpenPrice()+TakeProfit1*Point(),Digits()),0,clrGreen)==false)// 念徉忤?蝈殛 ??耠篦噱 铠栳觇 耦钺?蝠彘溴痼
Print(“Error N “,GetLastError());

if(b>1)// 篷腓 铕溴痤?犷朦 1
if(OrderTakeProfit()!=BuyAwerage) // ?蝈殛 礤 疣忮?蝠遽箦祛?鲥礤
if(Ask<BuyAwerage)// 玉腩忤 蝾疸钼腓 耦犭屙?
if(OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),NormalizeDouble(BuyAwerage,Digits()),0,clrGreen)==false) // 填滂翳鲨痼屐 铕溴?桦?耦钺?钺 铠栳赍
Print(“Error N “,GetLastError());
}
if(OrderType()==OP_SELL)
{
if(s==1) // 篷腓 铕溴?钿桧 ??礤泐 礤?蝈殛 镳铘栩?
if(OrderTakeProfit()==0)
if(OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),NormalizeDouble(OrderOpenPrice()-TakeProfit1*Point(),Digits()),0,clrGreen)==false)// 念徉忤?蝈殛 ??耠篦噱 铠栳觇 耦钺?蝠彘溴痼
Print(“Error N “,GetLastError());
if(s>1)// 篷腓 铕溴痤?犷朦 1
if(OrderTakeProfit()!=SelAwerage) // ?蝈殛 礤 疣忮?蝠遽箦祛?鲥礤
if(Bid>SelAwerage)// 玉腩忤 蝾疸钼腓 耦犭屙?
if(OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),NormalizeDouble(SelAwerage,Digits()),0,clrGreen)==false) // 填滂翳鲨痼屐 铕溴?桦?耦钺?钺 铠栳赍
Print(“Error N “,GetLastError());
}
}

}
//+——————————————————————+
//| Expert deinitialization function |
//+——————————————————————+
void OnDeinit(const int reason)
{

}
//+——————————————————————+

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

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

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

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

相关资源

暂无评论

暂无评论...
Ads Blocker Image Powered by Code Help Pro

检测到广告拦截程序!!!Ads Blocker Detected!!!

我们检测到您正在使用扩展来屏蔽广告。请通过禁用这些广告屏蔽程序或者把网站加入白名单来支持我们。

We have detected that you are using an extension to block advertisements. Please support us by disabling these advertising blocking programs or adding the website to the whitelist.