Gold

Gold最新版

官方版无广告194

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

32 人已下载 手机查看

//+——————————————————————+
//| Gold.mq4 |
//| Copyright 2016, AM2 |
//| http://www.forexsystems.biz |
//+——————————————————————+
#property copyright “Copyright 2016, AM2”
#property link “http://www.forexsystems.biz”
#property version “1.00”
#property strict

//— Inputs
extern double Lots = 0.1; // 腩?
extern double KLot = 2; // 箪眍驽龛?腩蜞
extern double MaxLot = 5; // 爨犟桁嚯 腩?
extern double Depo = 20000; // 筲咫梓屙眍?溴镱
extern double Sup = 1000; // 镱滗屦骊?龛琨
extern double Res = 1500; // 耦镳铗桠脲龛?忮瘐?
extern int StopLoss = 5000; // 腩顸
extern int TakeProfit = 5000; // 琰
extern int Slip = 30; // 疱赈铗
extern int Count = 100; // 爨犟桁嚯铄 觐腓麇耱忸 镱?
extern int Magic = 12; // 爨汨?

datetime t=0;
double Price=0;
//+——————————————————————+
//| Expert initialization function |
//+——————————————————————+
int OnInit()
{
//—

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

}
//+——————————————————————+
//| Check for open order conditions |
//+——————————————————————+
void PutOrder(int type,double price)
{
int r=0;
color clr=Green;
double sl=0,tp=0;

if(type==1 || type==3 || type==5)
{
clr=Red;
if(StopLoss>0) sl=NormalizeDouble(price+StopLoss*Point,Digits);
if(TakeProfit>0) tp=NormalizeDouble(price-TakeProfit*Point,Digits);
}

if(type==0 || type==2 || type==4)
{
clr=Blue;
if(StopLoss>0) sl=NormalizeDouble(price-StopLoss*Point,Digits);
if(TakeProfit>0) tp=NormalizeDouble(price+TakeProfit*Point,Digits);
}

r=OrderSend(NULL,type,Lots,NormalizeDouble(price,Digits),Slip,sl,tp,””,Magic,0,clr);
return;
}
//+——————————————————————+
//| |
//+——————————————————————+
int CountTrades()
{
int count=0;
for(int i=OrdersTotal()-1;i>=0;i–)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderType()<2) count++;
}
}
}
return(count);
}
//+——————————————————————+
//| |
//+——————————————————————+
int Last()
{
int result=0;
if(OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderProfit()>0)
{
result=1;//tp
}
}
}
return(result);
}
//+——————————————————————+
//| |
//+——————————————————————+
void CloseAll()
{
bool cl;
for(int i=OrdersTotal()-1;i>=0;i–)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderType()==OP_BUY) cl=OrderClose(OrderTicket(),OrderLots(),Bid,Slip,Blue);
if(OrderType()==OP_SELL) cl=OrderClose(OrderTicket(),OrderLots(),Ask,Slip,Red);
}
}
}
return;
}
//+——————————————————————+
//| OnTick function |
//+——————————————————————+
void OnTick()
{
if(AccountEquity()>Depo)
{
CloseAll();
return;
}

if(CountTrades()<Count)
{
if(Bid>Sup && Bid<Res)
{
if(CountTrades()<1)
{
PutOrder(1,Bid);
PutOrder(0,Ask);
Price=Bid;
}

if(Last()==1 && (Bid>Price+TakeProfit*Point || Bid<Price-TakeProfit*Point))
{
PutOrder(1,Bid);
PutOrder(0,Ask);
Price=Bid;
}
}
}

Comment(“\n Equity: “,DoubleToStr(AccountEquity(),Digits));
}
//+——————————————————————+

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

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.