اقتباس:
المشاركة الأصلية كتبت بواسطة Mohamed_Amr
الله ينور اخى سمير
ولى سؤالين ازاى اخلى الاكسبريت عند اغلاق الصفقه يدوى
لايفتح صفقات اخرى الا بتحقق شروط الفتح
ثانيا كيف يمكن اضافه المضاعفات لاى اكسبريت
ثالثا كيف يمكن جعل الاكسبريت عند الوصول الى ربح معين
لايفتح صفقات فى نفس اليوم
واسف على الاطاله
خالص تحياتى
السلام عليكم اخى الكريم
اول سؤال
عند اغلاق الصفقة يدوية
وتوجد اشارة دخول من الاكسبيرت سوف يفتح صفقة اخرى
وان لايوجد اشارة دخول
لن يفتح صفقة
...........................................
السوال الثانى
يوجد اكثر من طريقة فى المضاعفات
هذه طريقة مضاعفات تعزيز
ويتم اضافة هذه السطور فى الدالة استارت
[PHP]for(int m=0;m<OrdersTotal();m++){
OrderSelect(m,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol()&&OrderMagicNumber()== MagicNumber&&OrderType()==OP_BUY){
double openprice=OrderOpenPrice();double lot=OrderLots();
}
}
for(int n=0;n<OrdersTotal();n++){
OrderSelect(n,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol()&&OrderMagicNumber()== MagicNumber&&OrderType()==OP_SELL){
double openprice_sell=OrderOpenPrice();lot=OrderLots();
}
}
if(Multiplication==true){
if(openprice-Ask>=step*pt&&ordestotal1_2(OP_BUY)>=1){
open(OP_BUY,lot*Multiplication_Mode,Ask,TakeProfit ,StopLoss) ;
}
if(Bid-openprice_sell>=step*pt&&ordestotal1_2(OP_SELL)>=1 ){
open(OP_SELL,lot*Multiplication_Mode,Bid,TakeProfi t,StopLoss) ;
}
}
[/PHP]
وهذه طريقة مضاعفات عكس الاتجاه
[PHP]for(int B=0;B<OrdersHistoryTotal();B++){
OrderSelect(B,SELECT_BY_POS,MODE_HISTORY);
if(OrderMagicNumber()==MagicNumber&&OrderSymbol()= =Symbol()&&OrderType()==OP_BUY){
double OrderStop = OrderStopLoss(); double Lots=OrderLots();
}
}
for(int s=0;s<OrdersHistoryTotal();s++){
OrderSelect(s,SELECT_BY_POS,MODE_HISTORY);
if(OrderMagicNumber()==MagicNumber&&OrderSymbol()= =Symbol()&&OrderType()==OP_SELL){
double OrderStops = OrderStopLoss(); double Lotss=OrderLots();
}
}
if(Multiplication==true){
if(pofetH()<0&&typeopen()==OP_BUY&&ordestotal1_2(O P_SELL)==0){
open(OP_SELL,Lots*Multiplication_Mode,OrderStop,Ta keProfit,StopLoss) ;
}
if(pofetH()<0&&typeopen()==OP_SELL&&ordestotal1_2( OP_BUY)==0){
open(OP_BUY,Lotss*Multiplication_Mode,OrderStops,T akeProfit,StopLoss) ;
}
}
[/PHP]
مع وضع دالة فتح الصفقات
خارج دالة int start
[PHP]int open(int ty,double lot,double prc,int pof,int sll)
{
double sl=0,tp=0;
color clr;
bool modi;
string T;double pr;
if(ty==OP_BUY || ty==OP_BUYSTOP || ty==OP_BUYLIMIT)
{
if(sll>0){sl=prc-(sll*pt);}else{sl=0;}
if(pof>0){tp=prc+(pof*pt);}else{tp=0;}
clr=Green;
T="Ask ";
pr=NormalizeDouble(Ask,Digits);
}
if(ty==OP_SELL || ty==OP_SELLSTOP || ty==OP_SELLLIMIT)
{
if(sll>0){sl=prc+(sll*pt);}else{sl=0;}
if(pof>0){tp=prc-(pof*pt);}else{tp=0;}
clr=Red;
T="Bid";
pr=NormalizeDouble(Bid,Digits);
}
int tik=OrderSend(Symbol()
,ty
,lot
,NormalizeDouble(prc,Digits)
,10
,0
,0
,"samir"
,MagicNumber
,0
,clr);
string t;
if(ty==OP_BUY)t="BUY";if(ty==OP_SELL)t="SELL";if(t y==OP_BUYSTOP)t="BUY STOP";if(ty==OP_SELLSTOP)t="SELL STOP";if(ty==OP_BUYLIMIT)t="BUY LIMIT";if(ty==OP_SELLLIMIT)t="SELL LIMIT";
if(tik>0)
{
if(tp>0 || sl>0)modi=OrderModify(tik,prc,NormalizeDouble(sl,D igits),NormalizeDouble(tp,Digits),0,CLR_NONE); else modi=true;
if(!modi){Print("Modify Err#= ",GetLastError()," ",Symbol()," ",Period()," Open Price= ",DoubleToStr(prc,Digits)," SL= ",DoubleToStr(sl,Digits)," Tp= ",DoubleToStr(tp,Digits));}
Print("Order Opened successfully " ,"Type ",t," LotSize ",lot," Price ",DoubleToStr(prc,Digits)," TP ",DoubleToStr(tp,Digits)," SL ",DoubleToStr(sl,Digits));
}
else
{
Print("OrderSend failed with error #",GetLastError(), " Type ",t," LotSize= ",lot," ",T,"Now= ",DoubleToStr(pr,Digits)," Price= ",DoubleToStr(prc,Digits)," TP= ",DoubleToStr(tp,Digits)," SL= ",DoubleToStr(sl,Digits)," Spread= ",MarketInfo(Symbol(),MODE_SPREAD));
}
//////
return(tik);
} [/PHP]
ويجب وضع هذه المتغيرات الخارجية
[PHP]extern string Multiplication_info = "0=1,2,3,4.... 1=1,2,3,5,8.... 2=1,2,4,8,16.... 3=1,3,9,27....";
extern int Multiplication_Mode = 2;
extern int step=10;
extern int MagicNumber=708;[/PHP]
السؤال الثالث
تستطيع بهذه الدالة تجعل الاكسبيرت يفتح صفقة واحدة فقط كل يوم او كل ساعة او كل اربعة ساعات
وتكون هذه الدالة خارج int start
[PHP]int exit_histo_day()
{
int c;
for (int cnt=0; cnt<OrdersHistoryTotal(); cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY) ;
if( OrderMagicNumber()== MagicNumber && OrderOpenTime()>=iTime(Symbol(),PERIOD_H1,0))
{
c++;
}
}
return(c);
}[/PHP]
ويتم وضع هذا الامر فوق امر فتح الصفقات
[PHP] if(exit_histo_day()+ordestotal1_2(OP_BUY)+ordestot al1_2(OP_SELL)==0){[/PHP]
ومعلومة هامة
كل هذه الدوال
من استاذى محمود عامر
تحياتى لك