رد:مساعدة في برمجة اكسبرت
حضرتك مش واخد بالك من حاجة صغيرة ان الموفينج الي بيدي اشارة دخول غير الي بيدي اشارة خروج معلش هتعب حضرتك معايا شويه بس ياريت تبص علي المؤشر ده الي بحاول ابرمجه وتقولي ايه الغلط الي فيه لانه بيدي اشارات غلط رغم اني مش شايف اني عامل حاجة غلط الفكرة في برمجته انه يدي اشارة لما يطلع فوق موفينج السبع ايام للهايات واشارة خروج لما السعر يبقي اقل من موفينج سبعة للوهات
كود:
//+------------------------------------------------------------------+
//| @Moving Strategy.mq4 |
//| Copyright 2012, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LawnGreen
#property indicator_color2 Red
extern int FastMA_Period = 7;
double CrossUp[];
double CrossDown[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY, 1);
SetIndexArrow(0, 233);
SetIndexBuffer(0, CrossUp);
SetIndexStyle(1, DRAW_ARROW, EMPTY, 1);
SetIndexArrow(1, 234);
SetIndexBuffer(1, CrossDown);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
/* GlobalVariableDel("AlertTime"+Symbol()+Period());
GlobalVariableDel("SignalType"+Symbol()+Period());
// GlobalVariableDel("LastAlert"+Symbol()+Period());*/
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double HIMAnow, lowMAnow, HIMAprevious, lowMAprevious;
int counted_bars=IndicatorCounted();
//----
for(int i=0;i<Bars;i++)
{
HIMAnow =iMA(NULL, 0, FastMA_Period, 0, MODE_SMA, 2, i);
lowMAnow =iMA(NULL, 0, FastMA_Period, 0, MODE_SMA, 3, i);
HIMAprevious =iMA(NULL, 0, FastMA_Period, 0, MODE_SMA, 2, i-1);
lowMAprevious=iMA(NULL, 0, FastMA_Period, 0, MODE_SMA, 3, i-1);
//iMA(NULL, 0, FastMA_Period, 0, FastMA_Mode, FastPriceMode, i);
if ((Close[i] > HIMAnow) && (Close[i-1] < HIMAprevious))
{CrossUp[i] = Low[i]*0.999 ;}
if ((Close[i] < lowMAnow) && (Close[i-1] > lowMAprevious))
{CrossDown[i] = High[i]*1.001 ;}
}
return(0);
}
//+------------------------------------------------------------------+
رد:مساعدة في برمجة اكسبرت
اقتباس:
المشاركة الأصلية كتبت بواسطة super_rio
حضرتك مش واخد بالك من حاجة صغيرة ان الموفينج الي بيدي اشارة دخول غير الي بيدي اشارة خروج معلش هتعب حضرتك معايا شويه بس ياريت تبص علي المؤشر ده الي بحاول ابرمجه وتقولي ايه الغلط الي فيه لانه بيدي اشارات غلط رغم اني مش شايف اني عامل حاجة غلط الفكرة في برمجته انه يدي اشارة لما يطلع فوق موفينج السبع ايام للهايات واشارة خروج لما السعر يبقي اقل من موفينج سبعة للوهات
كود:
//+------------------------------------------------------------------+
//| @Moving Strategy.mq4 |
//| Copyright 2012, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LawnGreen
#property indicator_color2 Red
extern int FastMA_Period = 7;
double CrossUp[];
double CrossDown[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY, 1);
SetIndexArrow(0, 233);
SetIndexBuffer(0, CrossUp);
SetIndexStyle(1, DRAW_ARROW, EMPTY, 1);
SetIndexArrow(1, 234);
SetIndexBuffer(1, CrossDown);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
/* GlobalVariableDel("AlertTime"+Symbol()+Period());
GlobalVariableDel("SignalType"+Symbol()+Period());
// GlobalVariableDel("LastAlert"+Symbol()+Period());*/
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double HIMAnow, lowMAnow, HIMAprevious, lowMAprevious;
int counted_bars=IndicatorCounted();
//----
for(int i=0;i<Bars;i++)
{
HIMAnow =iMA(NULL, 0, FastMA_Period, 0, MODE_SMA, 2, i);
lowMAnow =iMA(NULL, 0, FastMA_Period, 0, MODE_SMA, 3, i);
HIMAprevious =iMA(NULL, 0, FastMA_Period, 0, MODE_SMA, 2, i-1);
lowMAprevious=iMA(NULL, 0, FastMA_Period, 0, MODE_SMA, 3, i-1);
//iMA(NULL, 0, FastMA_Period, 0, FastMA_Mode, FastPriceMode, i);
if ((Close[i] > HIMAnow) && (Close[i-1] < HIMAprevious))
{CrossUp[i] = Low[i]*0.999 ;}
if ((Close[i] < lowMAnow) && (Close[i-1] > lowMAprevious))
{CrossDown[i] = High[i]*1.001 ;}
}
return(0);
}
//+------------------------------------------------------------------+
تفضل أخي العزيز هذا الكود المعدل لمؤشرك حسب مافهمت طلبك
حيث يقوم المؤشر بالنظر لآخر سبع شموع وتخزين الهايات واللوهات في مصفوفتين فاذا كان السعر اكبر من أعظم قيمة في مصفوفة الهايات وضع السهم الاخضر واذا كان السعر اصغر من ادنى قيمة في مصفوفة اللوهات وضع السهم الاحمر:
كود PHP:
//+------------------------------------------------------------------+
//| @Moving Strategy.mq4 |
//| Copyright 2012, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LawnGreen
#property indicator_color2 Red
extern int FastMA_Period = 7;
double CrossUp[],Up[7];
double CrossDown[],Down[7];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY, 1);
SetIndexArrow(0, 233);
SetIndexBuffer(0, CrossUp);
SetIndexStyle(1, DRAW_ARROW, EMPTY, 1);
SetIndexArrow(1, 234);
SetIndexBuffer(1, CrossDown);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
static datetime prevtime=0;
if(prevtime == Time[0]) {return(0);}
prevtime = Time[0];
double HIMAnow, lowMAnow, HIMAprevious, lowMAprevious;
int counted_bars=IndicatorCounted();
//----
for(int i=0;i<7;i++)
{
HIMAnow =iMA(NULL, 0, 7, 0, MODE_SMA, 2, i);
lowMAnow =iMA(NULL, 0, 7, 0, MODE_SMA, 3, i);
Up[i]=HIMAnow;
Down[i]=lowMAnow;
}
if (Close[0] > Up[ArrayMaximum(Up)])
{
CrossUp[0] = Low[0]*0.999 ;
}
if (Close[0] < Down[ArrayMinimum(Down)])
{
CrossDown[0] = High[0]*1.001 ;
}
return(0);
}
//+------------------------------------------------------------------+
رد:مساعدة في برمجة اكسبرت
اقتباس:
المشاركة الأصلية كتبت بواسطة super_rio
فكرة الاكسبرت انه عندما يتخطي السعر موفينج افرج 3 يتم الشراء وعندما يتخطي موفينج افرج 3 للاسفل يتم البيع
كود:
extern string MM_Parameters = "---------- Money Management";
extern double Lots = 1;
extern string S5="---------------- Order Management";
extern int StopLoss=50;
extern int TakeProfit=50;
extern int MagicNumber=2533;
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS Start function |
//+------------------------------------------------------------------+
int start()
{
Comment("Programmed by MR.dollar"+"\n"+"منتدى المتداول العربي "+"\n"+"www.arabictrader.com/vb");
//////////////////////////////////////////////////
double ma1,ma2,ma11,ma22,rsi1,rsi2,ma3,ma33,ma4,ma44;
ma1=iMA(NULL,0,3,0,MODE_EMA,PRICE_HIGH,1);
ma11=iMA(NULL,0,3,0,MODE_EMA,PRICE_HIGH,2);
ma2=iMA(NULL,0,3,0,MODE_EMA,PRICE_LOW,1);
ma22=iMA(NULL,0,3,0,MODE_EMA,PRICE_LOW,2);
////////////////////////////////////////////////////
double SL,TP;
////////////////////////////////
if ( Close[1] > ma1 && Close[2] < ma11 ){
if(StopLoss==0){SL=0;}else{SL=Ask-StopLoss*Point;}
if(TakeProfit==0){TP=0;}else{TP=Ask+TakeProfit*Point;}
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,SL,TP,"MR.dollar EA",MagicNumber,0,Blue);
PlaySound("Alert.wav");
}
/////////////////////
if (Close[1]<ma2 &&Close[2]<ma22 ){
if(StopLoss==0){SL=0;}else{SL=Bid+StopLoss*Point;}
if(TakeProfit==0){TP=0;}else{TP=Bid-TakeProfit*Point;}
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,SL,TP,"MR.dollar EA",MagicNumber,0,Red);
PlaySound("Alert.wav");
}
}
انت ماكتبت مرتبة الشمعة بعد كلوز لازم تحدد المرتبة .