الاول =(اذا تحقق الشرط افتح طلب شراء + 4 طلبات شراء معلقة )
الثاني=(اذا تم اخذ التك بروفت لاي طلب اغلق باقي الطلبات)
[PHP]//+------------------------------------------------------------------+
//| v_v.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//================================//
extern int magic = 8945;
extern int slipage = 3;
//--------------------------------//
extern int MA_Shift = 0;
extern int MA_Period = 25;
//--------------------------------//
extern int Step =50;
extern double Lots = 0.01;
//--------------------------------//
extern double StopLoss = 50;
extern double TakeProfit = 50;
//================================//
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
double ma_h,ma_l;
//------------------- --------------------//
ma_h=iMA(NULL,0,MA_Period,MA_Shift,MODE_SMMA,PRICE _HIGH,0);
ma_l=iMA(NULL,0,MA_Period,MA_Shift,MODE_SMMA,PRICE _LOW,0);
//================================================== ===========//
if( Bid>( ma_h+(Step*Point) ) && OrdersTotal()==0 )
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,slipage,Bid+St opLoss*Point,Bid-TakeProfit*Point,"thank",magic,0,Green);//&&
//OrderSend(Symbol(),OP_SELLLIMIT,Lots*2,Bid+50pip,s lipage,Bid+StopLoss*Point*2,Bid,"thank",magic,0,Gr een);//&&
//OrderSend(Symbol(),OP_SELLLIMIT,Lots*4,Bid+100pip, slipage,Bid+StopLoss*Point*3,Bid+TakeProfit*Point, "thank",magic,0,Green);//&&
//OrderSend(Symbol(),OP_SELLLIMIT,Lots*8,Bid+150pip, slipage,Bid+StopLoss*Point*4,Bid+TakeProfit*Point* 2,"thank",magic,0,Green);//&&
//OrderSend(Symbol(),OP_SELLLIMIT,Lots*16,Bid+200pip ,slipage,Bid+StopLoss*Point*5,Bid-TakeProfit*Point*3,"thank",magic,0,Green);//&&
}
//---------------------------------------------------------//
//if(اذا تم اخذ التك بروفيت للطلب الاول او الثاني او اي طلب اغلق باقي الطلبات)
//-------------------------------------------------------------//
if( Ask<( ma_l-(Step*Point) )&& OrdersTotal()==0 )
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,slipage,Ask-StopLoss*Point,Ask+TakeProfit*Point,"thank",magic, 0,Red);
}
//الذي اظفناه فوق للبيع نظيفه هنا للشراء
//================================================== ===========//
} [/PHP]