Coding help - page 6

 

need help in EA codeing

hi i am new to MQL 4 after learning how to write an EA , i just write an EA but did not know where the problem is . can any master coder help me?

i am making an EA base on heiken ashi . when the indicator change from red to blue i will enter a long trade at the 2nd candle with 400PT 100SL

when it change to blue to red i will enter a trade at 2nd candle with 400PT / 100SL only 1 trade can be enter at a time

so far i have an function defintion unexpected error i think and i do not know what wrong with it i wish you pro can help me point out my mistake in my EA and help me correct it

thank

 

//---- input parameters

extern double profittarget=400.0;

extern double stoploss=100.0;

extern double Lots=0.1;

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1 Red

#property indicator_color2 Blue

#property indicator_color3 Red

#property indicator_color4 Blue

#property indicator_width1 1

#property indicator_width2 1

#property indicator_width3 3

#property indicator_width4 3

//----

extern color color1 = Red;

extern color color2 = Blue;

extern color color3 = Red;

extern color color4 = Blue;

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

double ExtMapBuffer3[];

double ExtMapBuffer4[];

//----

int ExtCountedBars=0;

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, color1);

SetIndexBuffer(0, ExtMapBuffer1);

SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, color2);

SetIndexBuffer(1, ExtMapBuffer2);

SetIndexStyle(2,DRAW_HISTOGRAM, 0, 3, color3);

SetIndexBuffer(2, ExtMapBuffer3);

SetIndexStyle(3,DRAW_HISTOGRAM, 0, 3, color4);

SetIndexBuffer(3, ExtMapBuffer4);

//----

SetIndexDrawBegin(0,10);

SetIndexDrawBegin(1,10);

SetIndexDrawBegin(2,10);

SetIndexDrawBegin(3,10);

//---- indicator buffers mapping

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexBuffer(2,ExtMapBuffer3);

SetIndexBuffer(3,ExtMapBuffer4);

//---- initialization done

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int changing (double haOpen,double haClose,double haLow,double haHigh)

{

static int last_direction = 0;

static int current_direction = 0;

{if (haOpen[1] haLow[1]) = 1;

if (haOpen[1] > haClose[1] && haHigh[1] < haLow[1]) = 2;

if(current_direction != last_direction)

{

last_direction = current_direction;

return (last_direction);

}

else

{

return (0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

//----

int ticket;

if (ExtCountedBars>0) ExtCountedBars--;

int pos=Bars-ExtCountedBars-1;

while(pos>=0)

haOpen=(ExtMapBuffer3[pos+1]+ExtMapBuffer4[pos+1])/2;

haClose=(Open[pos]+High[pos]+Low[pos]+Close[pos])/4;

haHigh=MathMax(High[pos], MathMax(haOpen, haClose));

haLow=MathMin(Low[pos], MathMin(haOpen, haClose));

if (haOpen<haClose)

{

ExtMapBuffer1[pos]=haLow;

ExtMapBuffer2[pos]=haHigh;

}

else

{

ExtMapBuffer1[pos]=haHigh;

ExtMapBuffer2[pos]=haLow;

}

ExtMapBuffer3[pos]=haOpen;

ExtMapBuffer4[pos]=haClose;

pos--;

//Entry Sign

bool GoLong = false, GoShort = false;

int ticket;

if (haOpen[2] haLow[2])= 1 GoLong =true;

{

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask+profittarget*Point;

}

if (haOpen[2] > haClose[2] && haHigh[2] < haLow[2])= 2 GoShort=true;

{

ticket=OrderSend(Symbol(),OP_SELL,Lots,Ask+profittarget*Point;

}

// buy sl Comment

(OrderType() ==OP_BUY)

if stoploss=100.0;

OrderClose(OrderTicket(),OrderLots(),Bid,);

// close position

return(0)

}

//----

}

//+----------------------------------------------------------------+

 

ea

I can help you program an EA. Time is limited please let me know your requirments

 

Help please.

I was wondering if anyone could turn one of my indicators into an EA for me since I currently don't have the time to enter in every trade it signals.... If you can help please message me....

Thank You

Preston.

 

Help with make CT indicator for MT4

Hi guys

I have one idea for Counter Trend indicator for MT4. But I don't know how to code it.

Is here someone who can help me with programing this indicator?

 

ea

I can possibly do this for you, there may be a few conflictions but have done something similar few months back.

Play2020:
Help please.

I was wondering if anyone could turn one of my indicators into an EA for me since I currently don't have the time to enter in every trade it signals.... If you can help please message me....

Thank You

Preston.
 

Ea

Be careful with counter trends they can really confuse trades if not done properly.

dancostar:
Hi guys

I have one idea for Counter Trend indicator for MT4. But I don't know how to code it.

Is here someone who can help me with programing this indicator?
 
Expert EA:
Be careful with counter trends they can really confuse trades if not done properly.

Hi Expert EA

I know but I have one deadly good CT system but it is hard to watch all pairs therefore I am looking for help to do indicator it will be much much better.

my overall result of the CT are about 80% winrate!!!

 

Ea

What lot sizes do you trade, how many trades a week, what pair?

dancostar:
Hi Expert EA

I know but I have one deadly good CT system but it is hard to watch all pairs therefore I am looking for help to do indicator it will be much much better.

my overall result of the CT are about 80% winrate!!!
 
Expert EA:
What lot sizes do you trade, how many trades a week, what pair?

I trade Live micro and on demo mini

I am trading overall 11 pairs and this is the problem I can't catch all CT because it is too much but when I see some I take it only one bad think about CT is RR it is only 1:1 max 1:1.5 but the winrate is big like I say previous.

and how many trades per week? sometimes one sometimes four-six. When I see CT I take it but I want code some indicator for help me to be more accurate