//+------------------------------------------------------------------+
//| boujie.mq4 |
//| Copyright 2015, Hamza Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, Hamza Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
input string s1 = "--------------Trend--------------";
extern int TMperiod = 200;
extern int TMshift = 0;
extern int TMmethod = 0;
extern int TMapplied = 0;
input string s2 = "---------Money Management--------------";
input int TP_1 = 50 ;
input int TP_2 = 150;
input int SL = 100 ;
input double lots = 0.1 ;
input int Magic = 11111 ;
double t ;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE);
if ( ticksize == 0.00001 || 0.001 )
t = ticksize * 10;
else
t = ticksize ;
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
if(Close[1]>High[2]){
if(orderscnt()==0)
bool Buy1 = OrderSend(NULL,OP_BUY,lots,Ask,3,Ask-(SL*t),Ask+(TP_1*t),"",Magic,0,Blue);
if(orderscnt()<=1)
bool Buy2 = OrderSend(NULL,OP_BUY,lots,Ask,3,Ask-(SL*t),Ask+(TP_2*t),"",Magic,0,Blue);
}
if(Close[1]<Low[2]){
if(orderscnt()==0)
bool Sell1 = OrderSend(Symbol(),OP_SELL,lots,Bid,30,Bid+(SL*t),Bid-(TP_1*t),"",Magic,0,Red);
if(orderscnt()<=1)
bool Sell2 = OrderSend(Symbol(),OP_SELL,lots,Bid,30,Bid+(SL*t),Bid-(TP_2*t),"",Magic,0,Red);
}
}
//+------------------------------------------------------------------+
int orderscnt(){
int cnt=0;
for(int i =0;i<=OrdersTotal();i++){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==Magic){
cnt++;
}
}
}
return(cnt);
}
//+------------------------------------------------------------------+
//| boujie.mq4 |
//| Copyright 2015, Hamza Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, Hamza Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
input string s1 = "--------------Trend--------------";
extern int TMperiod = 200;
extern int TMshift = 0;
extern int TMmethod = 0;
extern int TMapplied = 0;
input string s2 = "---------Money Management--------------";
input int TP_1 = 50 ;
input int TP_2 = 150;
input int SL = 100 ;
input double lots = 0.1 ;
input int Magic = 11111 ;
double t ;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE);
if ( ticksize == 0.00001 || 0.001 )
t = ticksize * 10;
else
t = ticksize ;
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
if(Close[1]>High[2]){
if(orderscnt()==0)
bool Buy1 = OrderSend(NULL,OP_BUY,lots,Ask,3,Ask-(SL*t),Ask+(TP_1*t),"",Magic,0,Blue);
if(orderscnt()<=1)
bool Buy2 = OrderSend(NULL,OP_BUY,lots,Ask,3,Ask-(SL*t),Ask+(TP_2*t),"",Magic,0,Blue);
}
if(Close[1]<Low[2]){
if(orderscnt()==0)
bool Sell1 = OrderSend(Symbol(),OP_SELL,lots,Bid,30,Bid+(SL*t),Bid-(TP_1*t),"",Magic,0,Red);
if(orderscnt()<=1)
bool Sell2 = OrderSend(Symbol(),OP_SELL,lots,Bid,30,Bid+(SL*t),Bid-(TP_2*t),"",Magic,0,Red);
}
}
//+------------------------------------------------------------------+
int orderscnt(){
int cnt=0;
for(int i =0;i<=OrdersTotal();i++){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==Magic){
cnt++;
}
}
}
return(cnt);
} if(Close[1]>High[2]){
if(orderscnt()==0) if(time&&Close[1]<Low[2]&&orderscnt()==0){
المواضيع المتشابهه | ||||
| الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
| أستاذ سمير عودة لطلب حل مشكلة إكسبرت أو برمجة إكسبرت جديد | BRUFEN | منتدى المؤشرات و الاكسبرتات | 6 | 09 - 01 - 2014 02:03 PM |
| قطاع الانشاءات البحرية بماريدايف يفوز بعقدين بقيمة اجمالية 31 مليون دولار | ahmedaolb | منتدى البورصة المصرية | 0 | 11 - 06 - 2012 12:37 PM |
| مشكلة كبيرة جداً وغريبة -- أرجو دخول الجميع للأهمية | Marvey | استراحة بورصات | 24 | 19 - 08 - 2011 07:22 AM |