Am just starting to learn MQL
I have this indicator with the following buffers
How to i create OP Buy on Blue bar and OP_Sell on Red Bar
double Buffer2[];
double Buffer3[];
double Buffer4[];
double trend[];
string indicatorFileName;
bool returnBars;
int timeFrame;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
//
//
int init()
{
IndicatorBuffers(5);
SetIndexBuffer(0,Buffer1); SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexLabel(0,"Blue Bar");
SetIndexBuffer(1,Buffer2); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexLabel(1,"Red Bar");
SetIndexBuffer(2,Buffer3); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(2,WingDings_Symbol); SetIndexLabel(2,"Blue Dot");
SetIndexBuffer(3,Buffer4); SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,WingDings_Symbol); SetIndexLabel(3,"Red Dot");
SetIndexBuffer(4,trend);
indicatorFileName = WindowExpertName();
returnBars = TimeFrame == "returnBars"; if (returnBars) return(0);
timeFrame = stringToTimeFrame(TimeFrame);
//----
return(0);Check these two threads :
https://www.mql5.com/en/forum/173032
https://www.mql5.com/en/forum/173054
a lot explained there
Thanks Mladen , i understand all those.
I have not found much information about iCustom.
I would EA to place buy on Blue bar and Sell on Red bar
This is what i have managed so far...
extern int WingDings_Symbol = 271;
extern bool ArrowsOnFirstBar = true;
extern string LM="---------------- Lot Management";
extern double Lots=0.1;
extern bool MM=false; //money management
extern double Risk=10; //risk in percentage
extern string TSTB="---------------- TP SL TS BE";
bool RealSL_Enabled=false;
int RealSL=5; //stop loss under 15 pîps
bool RealTP_Enabled=false;
int RealTP=10; //take profit under 10 pîps
extern int SL=0; //stop loss
extern int TP=0; //take profit
extern int TS=0; //trailing stop
int TS_Step=1; //trailing step
extern int BE=0; //breakeven
extern string EXT="---------------- Extras";
extern bool Reverse=false;
extern bool Add_Positions=false; //positions cumulated
extern int MaxOrders=100; //maximum number of orders
extern int Magic=0;
int Slip=3;static int TL=0;double MML=0;
// expert start function
int init(){int j=0,limit=1;double BV=0,SV=0;BV=0;SV=0;double mAmpSignalsBUY,mAmpSignalsSELL ;
if(CntO(OP_BUY,Magic)>0)TL=1;if(CntO(OP_SELL,Magic)>0)TL=-1;for(int i=1;i<=limit;i++){
mAmpSignalsBUY = iCustom(Symbol(), 0, "AmpSignals", TimeFrame, Extremes, WingDings_Symbol, ArrowsOnFirstBar,0,0);
mAmpSignalsSELL = iCustom(Symbol(), 0, "AmpSignals", TimeFrame, Extremes, WingDings_Symbol, ArrowsOnFirstBar,1,0);
if(mAmpSignalsBUY >0&&mAmpSignalsSELL<EMPTY_VALUE){if(Reverse)SV=1;else BV=1;break;}
if(mAmpSignalsSELL>0&&mAmpSignalsBUY <EMPTY_VALUE){if(Reverse)BV=1;else SV=1;break;}}Its only opening one order
Thanks Mladen , i understand all those.
I have not found much information about iCustom.
I would EA to place buy on Blue bar and Sell on Red bar
This is what i have managed so far...
extern int WingDings_Symbol = 271;
extern bool ArrowsOnFirstBar = true;
extern string LM="---------------- Lot Management";
extern double Lots=0.1;
extern bool MM=false; //money management
extern double Risk=10; //risk in percentage
extern string TSTB="---------------- TP SL TS BE";
bool RealSL_Enabled=false;
int RealSL=5; //stop loss under 15 pîps
bool RealTP_Enabled=false;
int RealTP=10; //take profit under 10 pîps
extern int SL=0; //stop loss
extern int TP=0; //take profit
extern int TS=0; //trailing stop
int TS_Step=1; //trailing step
extern int BE=0; //breakeven
extern string EXT="---------------- Extras";
extern bool Reverse=false;
extern bool Add_Positions=false; //positions cumulated
extern int MaxOrders=100; //maximum number of orders
extern int Magic=0;
int Slip=3;static int TL=0;double MML=0;
// expert start function
int init(){int j=0,limit=1;double BV=0,SV=0;BV=0;SV=0;double mAmpSignalsBUY,mAmpSignalsSELL ;
if(CntO(OP_BUY,Magic)>0)TL=1;if(CntO(OP_SELL,Magic)>0)TL=-1;for(int i=1;i<=limit;i++){
mAmpSignalsBUY = iCustom(Symbol(), 0, "AmpSignals", TimeFrame, Extremes, WingDings_Symbol, ArrowsOnFirstBar,0,0);
mAmpSignalsSELL = iCustom(Symbol(), 0, "AmpSignals", TimeFrame, Extremes, WingDings_Symbol, ArrowsOnFirstBar,1,0);
if(mAmpSignalsBUY >0&&mAmpSignalsSELL<EMPTY_VALUE){if(Reverse)SV=1;else BV=1;break;}
if(mAmpSignalsSELL>0&&mAmpSignalsBUY <EMPTY_VALUE){if(Reverse)BV=1;else SV=1;break;}}
A lot information on how you can use iCustom() you can find here : https://www.mql5.com/en/forum/173108
Am just starting to learn MQL
I have this indicator with the following buffers
How to i create OP Buy on Blue bar and OP_Sell on Red Bar
double Buffer2[];
double Buffer3[];
double Buffer4[];
double trend[];
string indicatorFileName;
bool returnBars;
int timeFrame;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
//
//
int init()
{
IndicatorBuffers(5);
SetIndexBuffer(0,Buffer1); SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexLabel(0,"Blue Bar");
SetIndexBuffer(1,Buffer2); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexLabel(1,"Red Bar");
SetIndexBuffer(2,Buffer3); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(2,WingDings_Symbol); SetIndexLabel(2,"Blue Dot");
SetIndexBuffer(3,Buffer4); SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,WingDings_Symbol); SetIndexLabel(3,"Red Dot");
SetIndexBuffer(4,trend);
indicatorFileName = WindowExpertName();
returnBars = TimeFrame == "returnBars"; if (returnBars) return(0);
timeFrame = stringToTimeFrame(TimeFrame);
//----
return(0);Why are toy posting completely useless code (that way nobody can help you)?
Thanks Mladen , i understand all those.
I have not found much information about iCustom.
I would EA to place buy on Blue bar and Sell on Red bar
This is what i have managed so far...
extern int WingDings_Symbol = 271;
extern bool ArrowsOnFirstBar = true;
extern string LM="---------------- Lot Management";
extern double Lots=0.1;
extern bool MM=false; //money management
extern double Risk=10; //risk in percentage
extern string TSTB="---------------- TP SL TS BE";
bool RealSL_Enabled=false;
int RealSL=5; //stop loss under 15 pîps
bool RealTP_Enabled=false;
int RealTP=10; //take profit under 10 pîps
extern int SL=0; //stop loss
extern int TP=0; //take profit
extern int TS=0; //trailing stop
int TS_Step=1; //trailing step
extern int BE=0; //breakeven
extern string EXT="---------------- Extras";
extern bool Reverse=false;
extern bool Add_Positions=false; //positions cumulated
extern int MaxOrders=100; //maximum number of orders
extern int Magic=0;
int Slip=3;static int TL=0;double MML=0;
// expert start function
int init(){int j=0,limit=1;double BV=0,SV=0;BV=0;SV=0;double mAmpSignalsBUY,mAmpSignalsSELL ;
if(CntO(OP_BUY,Magic)>0)TL=1;if(CntO(OP_SELL,Magic)>0)TL=-1;for(int i=1;i<=limit;i++){
mAmpSignalsBUY = iCustom(Symbol(), 0, "AmpSignals", TimeFrame, Extremes, WingDings_Symbol, ArrowsOnFirstBar,0,0);
mAmpSignalsSELL = iCustom(Symbol(), 0, "AmpSignals", TimeFrame, Extremes, WingDings_Symbol, ArrowsOnFirstBar,1,0);
if(mAmpSignalsBUY >0&&mAmpSignalsSELL<EMPTY_VALUE){if(Reverse)SV=1;else BV=1;break;}
if(mAmpSignalsSELL>0&&mAmpSignalsBUY <EMPTY_VALUE){if(Reverse)BV=1;else SV=1;break;}}
From that code it is impossible to see what is happening. If you cannot post the whole code, I am afraid that nobody can help you based on only selected lines of code since those lines show nothing relevant

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Am just starting to learn MQL
I have this indicator with the following buffers
How to i create OP Buy on Blue bar and OP_Sell on Red Bar
double Buffer2[];
double Buffer3[];
double Buffer4[];
double trend[];
string indicatorFileName;
bool returnBars;
int timeFrame;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
//
//
int init()
{
IndicatorBuffers(5);
SetIndexBuffer(0,Buffer1); SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexLabel(0,"Blue Bar");
SetIndexBuffer(1,Buffer2); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexLabel(1,"Red Bar");
SetIndexBuffer(2,Buffer3); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(2,WingDings_Symbol); SetIndexLabel(2,"Blue Dot");
SetIndexBuffer(3,Buffer4); SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,WingDings_Symbol); SetIndexLabel(3,"Red Dot");
SetIndexBuffer(4,trend);
indicatorFileName = WindowExpertName();
returnBars = TimeFrame == "returnBars"; if (returnBars) return(0);
timeFrame = stringToTimeFrame(TimeFrame);
//----
return(0);Thank you