You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
1, add bool flag after trading criteria triggered
2, check bool flag before placing order
3, after placing order bool flag should be reset
4, reset the flag in init() tooThanks man
MQL Guide needed =^_^=
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 White
extern int Fast.MA.Period = 5;
extern int Slow.MA.Period = 34;
extern int Signal.period = 5;
//---- buffers
double Buffer1[],
Buffer2[],
b2[],
b3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
// two additional buffers used for counting
IndicatorBuffers(4);
IndicatorShortName("MA3_54");
SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,3);
SetIndexArrow(0,242); // down 226 234 242
SetIndexBuffer(0,b2);
SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,3);
SetIndexArrow(1,241); //UP 225 233 241
SetIndexBuffer(1,b3);
// These buffers are not plotted, just used to determine arrows
SetIndexBuffer (2,Buffer1);
SetIndexBuffer (3,Buffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i, counted_bars=IndicatorCounted();
double MA5,MA34;
int limit=Bars-counted_bars;
Print(" print limit = ", limit);
if(counted_bars>0) limit++;
// Main line
for(i=0; i<limit; i++)
{
MA5=iMA(NULL,0,Fast.MA.Period,0,MODE_SMA,PRICE_MEDIAN,i);
MA34=iMA(NULL,0,Slow.MA.Period,0,MODE_SMA,PRICE_MEDIAN,i);
Buffer1=MA5-MA34;
}
// Signal line
for(i=0; i<limit; i++)
{
Buffer2=iMAOnArray(Buffer1,Bars,Signal.period,0,MODE_LWMA,i);
}
// Arrows
for(i=0; i<limit; i++)
{
if(Buffer1 > Buffer2 && Buffer1 < Buffer2)
b2 = High+10*Point;
if(Buffer1 Buffer2)
b3 = Low-10*Point;
}
//----
return(0);
}
Can you teach me how to create EA based on this indis ? when the arrow appear on the screen and that's the time EA auto enter position, can it be done ? please guide me as i'm keen in learning =^_^=
Good Reference
#property indicator_chart_window
#property indicator_buffers 2
............guide me as i'm keen in learning =^_^=See this guide really good material MQL4 Tutorial
The indis looks like this
Here is the above mentioned arrow signal, need someone to guide me on the EA coding
Thanks anyone out there =^_^=
Can anyone help me code this into a simple EA ?
Hi guys, can anyone help me code this indis into EA ? Only a simple EA that enter position when the arrows appear on the screen, very much appreciated if could help me on a simple EA. =^_^= thanks
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 White
extern int Fast.MA.Period = 5;
extern int Slow.MA.Period = 34;
extern int Signal.period = 5;
//---- buffers
double Buffer1[],
Buffer2[],
b2[],
b3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
// two additional buffers used for counting
IndicatorBuffers(4);
IndicatorShortName("Elliott Wave Oscillator");
SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,3);
SetIndexArrow(0,242); // down 226 234 242
SetIndexBuffer(0,b2);
SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,3);
SetIndexArrow(1,241); //UP 225 233 241
SetIndexBuffer(1,b3);
//
SetIndexBuffer (2,Buffer1);
SetIndexBuffer (3,Buffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i, counted_bars=IndicatorCounted();
double MA5,MA34;
int limit=Bars-counted_bars;
Print(" print limit = ", limit);
if(counted_bars>0) limit++;
// Main line
for(i=0; i<limit; i++)
{
MA5=iMA(NULL,0,Fast.MA.Period,0,MODE_SMA,PRICE_MEDIAN,i);
MA34=iMA(NULL,0,Slow.MA.Period,0,MODE_SMA,PRICE_MEDIAN,i);
Buffer1=MA5-MA34;
}
// Signal line
for(i=0; i<limit; i++)
{
Buffer2=iMAOnArray(Buffer1,Bars,Signal.period,0,MODE_LWMA,i);
}
// Arrows
for(i=0; i<limit; i++)
{
if(Buffer1 > Buffer2 && Buffer1 < Buffer2)
b2 = High+10*Point;
if(Buffer1 Buffer2)
b3 = Low-10*Point;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Multi-Order code?
Does anyone have good code for trading multiple orders when running up against the maxlot barrier?
IE Broker only allows lots of 5, and you want to trade 10, so the function will trade 2 x 5 lot orders instead.
I'm looking for more than just a simple loop here. The problem is that a simple loop will not always fully complete, and you could be left with only a partial order open.
How to take out OrderModify error 1
Hi,
I cannot avoid the OrderModify error 1 : always show up even trying controlling that the data before to modify is different ! I have tried doublenormalize as well...not working...
This is the code:
if (Bid-OrderOpenPrice() >= VPoint*BreakEvenAtProfit)
{
if (OrderStopLoss() != OrderOpenPrice() + BreakEvenShift*VPoint)
{
Vresult = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+ BreakEvenShift*VPoint,OrderTakeProfit(),0,Green);
Any suggestions ?
Thanks.
Hi guys, can anyone help me code this indis into EA ? Only a simple EA that enter position //+------------+
These aero show on 2 MovingAverage corssing i.e. 5-34, you could find many EAs "MA's Cross EA" search and hopefully you will finde one
How do i set Alert Frequency?
I am new to mq4 and i am trying to creat a display on screen when there is a crossover for MACD. Below is my code but the alerts keep poping up every few minutes.
How can i code it to display alerts only once every hour? Or one alert per bar?
int start()
{
string MACD1="";
color colt9;
double MACDM_S10 = iCustom(NULL, PERIOD_H1, "MACD", 8,17,9, MODE_MAIN, 0);
double MACDS_S10 = iCustom(NULL, PERIOD_H1, "MACD", 8,17,9, MODE_SIGNAL,0);
double MACDM_S11 = iCustom(NULL, PERIOD_H1, "MACD", 8,17,9, MODE_MAIN, 1);
double MACDS_S11 = iCustom(NULL, PERIOD_H1, "MACD", 8,17,9, MODE_SIGNAL,1);
if ((MACDM_S11 < MACDS_S11 && MACDM_S10 < MACDS_S10)) { MACD1="IN UPTREND"; colt9=LimeGreen; }
if ((MACDM_S11 > MACDS_S11 && MACDM_S10 > MACDS_S10)) { MACD1="IN DOWNTREND"; colt9=Red; }
if ((MACDM_S11 > MACDS_S11 && MACDM_S10 < MACDS_S10)) { MACD1="NEW UP CROSSING"; colt9=LimeGreen; }
if ((MACDM_S11 MACDS_S10)) { MACD1="NEW DOWN CROSSING"; colt9=Red; }
string MACD2="";
color colt14;
double MACDM_L10 = iCustom(NULL, PERIOD_H1, "MACD", 12,26,9, MODE_MAIN, 0);
double MACDS_L10 = iCustom(NULL, PERIOD_H1, "MACD", 12,26,9, MODE_SIGNAL,0);
double MACDM_L11 = iCustom(NULL, PERIOD_H1, "MACD", 12,26,9, MODE_MAIN, 1);
double MACDS_L11 = iCustom(NULL, PERIOD_H1, "MACD", 12,26,9, MODE_SIGNAL,1);
if ((MACDM_L11 < MACDS_L11 && MACDM_L10 < MACDS_L10)) { MACD2="IN UPTREND"; colt14=LimeGreen; }
if ((MACDM_L11 > MACDS_L11 && MACDM_L10 > MACDS_L10)) { MACD2="IN DOWNTREND"; colt14=Red; }
if ((MACDM_L11 > MACDS_L11 && MACDM_L10 < MACDS_L10)) { MACD2="NEW UP CROSSING"; colt14=LimeGreen; }
if ((MACDM_L11 MACDS_L10)) { MACD2="NEW DOWN CROSSING"; colt14=Red; }
if(MACD1=="NEW UP CROSSING"&&MACD2=="IN UPTREND")
Alert(Symbol()," - ","H1:"," MACD MAIN UPTREND MOVEMENT"," at ", Bid, " - ",TimeToStr(CurTime(),TIME_SECONDS));
if(MACD1=="NEW DOWN CROSSING"&&MACD2=="IN DOWNTREND")
Alert(Symbol()," - ","H1:"," MACD MAIN DOWNTREND MOVEMENT"," at ", Bid, " - ",TimeToStr(CurTime(),TIME_SECONDS));
if(MACD2=="NEW UP CROSSING"&&MACD1=="IN UPTREND")
Alert(Symbol()," - ","H1:"," MACD, MAIN TREND CHANGE TO UPTREND"," at ", Bid, " - ",TimeToStr(CurTime(),TIME_SECONDS));
if(MACD2=="NEW DOWN CROSSING"&&MACD1=="IN DOWNTREND")
Alert(Symbol()," - ","H1:"," MACD, MAIN TREND CHANGE TO DOWNTREND"," at ", Bid, " - ",TimeToStr(CurTime(),TIME_SECONDS));
return(0);
}
in what pairs?