外汇论坛 外兔财经

开启左侧

我想请教 关于MT4 的问题

[复制链接]
发表于 2007-3-9 08:27 | 显示全部楼层 |阅读模式
https://www.y2cn.com
MT4 有价格警报
我想问一下 有什么 KDJ 和 均线的 指标警报
多谢 多谢
发表于 2007-3-19 21:46 | 显示全部楼层
发表于 2007-4-8 01:50 | 显示全部楼层
不知道怎么传档案上了 你自己复制code 进 indicators



//+------------------------------------------------------------------+
//| MACD_signal.mq4 |
//| tom112 |
//| tom112@mail.wplus.net |
//+------------------------------------------------------------------+
#property copyright "tom112"
#property link "tom112@mail.wplus.net"
//---- input parameters
extern double TakeProfit = 0;
extern double Lots = 0.1;
extern double TrailingStop = 0;
extern int Pfast=7;
extern int Pslow=36;
extern int Psignal=7;
extern double LEVEL=0.001;
double Points;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
Points = MarketInfo (Symbol(), MODE_POINT);
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
double MacdCurrent=0, MacdPrevious=0, SignalCurrent=0;
double SignalPrevious=0, MaCurrent=0, MaPrevious=0;
int cnt=0, total;
int i1, pp, shift;
double Tv[2][500] ;
double Range, rr, Delta, Delta1, val3;
// 镥疴梓睇?镳钼屦觇 溧眄
// 忄骓?箐铖蝾忮痂螯? 黩?耧屦?疣犷蜞弪 磬 眍痨嚯铎 沭圄桕??
// 镱朦珙忄蝈朦 镳噔桦?恹耱噔桦 忭屮龛?镥疱戾眄 (Lots, StopLoss,
// TakeProfit, TrailingStop)
// ?磬?耠篦噱 镳钼屦�屐 蝾朦觐 TakeProfit
if(Bars<100)
{
Print("bars less than 100");
return(0); // 磬 沭圄桕?戾礤?100 徉痤?
}
if(TakeProfit<10)
{
Print("TakeProfit less than 10");
return(0); // 镳钼屦�屐 TakeProfit
}
Range = iATR(NULL,0,200,1);
rr = Range*LEVEL;
Delta=iMACD(NULL,0,Pfast,Pslow,Psignal,PRICE_CLOSE,MODE_MAIN,0)-
iMACD(NULL, 0 ,Pfast,Pslow,Psignal,PRICE_CLOSE,MODE_SIGNAL,0);
Delta1=iMACD(NULL,0,Pfast,Pslow,Psignal,PRICE_CLOSE,MODE_MAIN,1)-
iMACD(NULL, 0 ,Pfast,Pslow,Psignal,PRICE_CLOSE,MODE_SIGNAL,1);
// 蝈镥瘘 磬漕 铒疱溴腓螯? - ?赅觐?耦耱?龛?蝾疸钼 蝈痨桧嚯?
// 镳钼屦桁, 羼螯 腓 疣礤?铗牮 镱玷鲨?桦?铕溴瘥?
if(OrdersTotal()<1)
{
// 礤?龛 钿眍泐 铗牮钽?铕溴疣
// 磬 怦�觇?耠篦嚅 镳钼屦桁, 羼腓 ?磬?疋钺钿睇?溴睃汨 磬 聍弪?
// 珥圜屙桢 1000 忡�蝾 潆� 镳桁屦? 钺眍 祛骓?铗牮?1 腩?
if(AccountFreeMargin()<(1000*Lots))
{
Print("We have no money");
return(0); // 溴礤?礤?- 恹躅滂?
}
// 镳钼屦桁, 礤 耠桫觐?腓 鬣耱?稃蜞屐? 铗牮�?
// 羼腓 镱耠邃龛?疣?蝾疸钼嚯?戾礤?麇?5 扈眢?5*60=300 皴?
// 磬玎? 蝾 恹躅滂?
// If((CurTime-LastTradeTime)<300) return(0);
// 镳钼屦�屐 磬 忸珈铈眍耱?怦蜞螯 ?潆桧眢?镱玷鲨?(BUY)
if( Delta>rr && Delta1<rr )
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Points,"macd signal",16384,0,Red); // 桉镱腠�屐
if(GetLastError()==0)Print("Order opened : ",OrderOpenPrice());
return(0); // 恹躅滂? 蜞?赅?怦?疣忭?镱耠?耦忮瘌屙? 蝾疸钼铋 铒屦圉梃
// 磬耱箫桦 10-蜩 皴牦礓睇?蜞殪囿?磬 耦忮瘌屙桢 蝾疸钼 铒屦圉栝
}
// 镳钼屦�屐 磬 忸珈铈眍耱?怦蜞螯 ?觐痤蜿簋 镱玷鲨?(SELL)
if( Delta < -rr && Delta1 > -rr )
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Points,"macd sample",16384,0,Red); // 桉镱腠�屐
if(GetLastError()==0)Print("Order opened : ",OrderOpenPrice());
return(0); // 恹躅滂?
}
// 玟羼?禧 玎忮瘌桦?镳钼屦牦 磬 忸珈铈眍耱?铗牮? 眍恹?镱玷鲨?
// 眍恹?镱玷鲨?铗牮?礤 猁腓 ?镳铖蝾 恹躅滂?镱 Exit, 蜞?赅?
// 怦?疣忭?囗嚯桤桊钼囹?礤麇泐
return(0);
}
// 镥疱躅滂??忄骓铋 鬣耱?耧屦蜞 - 觐眚痤膻 铗牮 镱玷鲨?
// '忄骓?镳噔桦?忸轵??瘥眍? 眍 恹轵?- 妁?忄骓邋...'
total=OrdersTotal();
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && // ?铗牮? 镱玷鲨�? OP_BUY 桦?OP_SELL
OrderSymbol()==Symbol()) // 桧耱痼戾眚 耦怙噤噱?
{
if(OrderType()==OP_BUY) // 铗牮?潆桧磬� 镱玷鲨�
{
// 镳钼屦桁, 祛驽?箧?镱疣 玎牮囹�?
if(Delta<0)
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // 玎牮噱?镱玷鲨?
return(0); // 恹躅滂?
}
// 镳钼屦桁 - 祛驽?祛骓?眢骓?箧?蝠彘腓磴 耱铒 耱噔栩?
if(TrailingStop>0) // 镱朦珙忄蝈朦 恹耱噔桦 ?磬耱痤殛圊 蝠彘腓磴耱铒
{ // 珥圜栩 禧 桎屐 邈?镳钼屦�螯
if(Bid-OrderOpenPrice()>Points*TrailingStop)
{
if(OrderStopLoss()<Bid-Points*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Points*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
else // 桧圜??觐痤蜿? 镱玷鲨�
{
// 镳钼屦桁, 祛驽?箧?镱疣 玎牮囹�?
if(Delta > 0)
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // 玎牮噱?镱玷鲨?
return(0); // 恹躅滂?
}
// 镳钼屦桁 - 祛驽?祛骓?眢骓?箧?蝠彘腓磴 耱铒 耱噔栩?
if(TrailingStop>0) // 镱朦珙忄蝈朦 恹耱噔桦 ?磬耱痤殛圊 蝠彘腓磴耱铒
{ // 珥圜栩 禧 桎屐 邈?镳钼屦�螯
if((OrderOpenPrice()-Ask)>(Points*TrailingStop))
{
if(OrderStopLoss()==0.0 ||
OrderStopLoss()>(Ask+Points*TrailingStop))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Points*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
}
}
return(0);
}
// the end.
//+------------------------------------------------------------------+
高抛低收 依呀依呀哟

本版积分规则

QQ|手机版 Mobile Version|Archiver|关于我们 About Us|联系我们 Contact Us|Y2外汇论坛 外兔财经

GMT+8, 2025-5-21 13:52 , Processed in 0.036169 second(s), 23 queries .

Powered by Discuz! X7.2

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表