يا ريت مساعده فى الاكسبيرت ده
بيدخل صفقه واحده بس مع وجود فرص لكذا عمله
ريسك لم تفعل وبرضو مش عارف ليه
يا ريت مساعده
كود:#property copyright "Karim Mosua Copyright 2014"
#property link "[email protected]"
#property version "1.00"
#property strict
extern double Lot=1.0;
extern bool UseMM = true;
extern int Risk = 50;
extern int TakeProfit=0;
extern int StopLoss=100;
extern int MagicNumber=778;
int NextOrderType ;
double Buys,Buyt,Sells,Sellt;
int P,digits;
datetime tim;
datetime time0;
int t;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
t=1; if(Digits==5||Digits==3||Digits==2){t=10;}
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
Comment("[email protected]" );
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
double Buy_1=iMA(Symbol(),0,5,2,MODE_SMA,PRICE_TYPICAL,1);
// double Sell_1=iMA(Symbol(),0,5,2,MODE_SMA,PRICE_TYPICAL,2);
double Buy_3=iCustom(Symbol(),0,"Synergy_APB",3,1);
double Sell_3=iCustom(Symbol(),0,"Synergy_APB",2,1);
double Buy_4=iCustom(Symbol(),0,"TDI Red Green)",4,1);
double Sell_4=iCustom(Symbol(),0,"TDI Red Green)",5,1);
double Buy_42=iCustom(Symbol(),0,"TDI Red Green)",4,2);
double Sell_42=iCustom(Symbol(),0,"TDI Red Green)",5,2);
if(Close[1]>Buy_1 &&Buy_42<Sell_42 && Buy_4>Sell_4 && time0!=Time[0] ){
if(OrdersTotal()==0){
if(StopLoss==0)Buys = 0;
else Buys = Ask-(StopLoss*Point*t);
if(TakeProfit==0)Buyt = 0;
else Buyt = Ask+(TakeProfit*Point*t);
if(GlobalVariableGet("NextOrderType")!=1)
{
OrderSend(Symbol(),OP_BUY,Lot,Ask,3*t,Buys,Buyt,"Karim.Mosua",MagicNumber,0,clrBlue);
GlobalVariableSet("NextOrderType",1);
time0=Time[0];
}
}
}
if(Close[1]<Buy_1 &&Buy_42>Sell_42 && Buy_4<Sell_4 && time0!=Time[0]){
if(OrdersTotal()==0){
if(StopLoss==0)Sells = 0;
else Sells = Bid+(StopLoss*Point*t);
if(TakeProfit==0)Sellt = 0;
else Sellt = Bid-(TakeProfit*Point*t);
if(GlobalVariableGet("NextOrderType")!=-1)
{
OrderSend(Symbol(),OP_SELL,Lot,Bid,3*t,Sells,Sellt,"Karim.Mosua",MagicNumber,0,clrRed);
GlobalVariableSet("NextOrderType",-1);
time0=Time[0];
}
}
}
}
//+------------------------------------------------------------------+
double lots()
{
double xLot=MathCeil(AccountFreeMargin()*Risk/1000)/100;
if(xLot<MarketInfo(Symbol(),MODE_MINLOT))
Lot=MarketInfo(Symbol(),MODE_MINLOT);
if(xLot>MarketInfo(Symbol(),MODE_MAXLOT))
Lot=MarketInfo(Symbol(),MODE_MAXLOT);
if(UseMM==true)xLot=lots();
return(xLot);
}