[Archive!] Writing an advisor for free - page 71

 

I ask for help in writing a simple trading robot based on i-Regr indicator. If done well, I guarantee reasonable payment.

If anyone is interested please write to ma.gog@mail.ru

 
Dear Gentlemen Programmers! I am asking for help in writing an EA, since I do not speak MQL yet. If the EA is profitable, I am ready to share my profits with the person who wrote it, or describe your conditions. I think it should be profitable.

The general idea is the following:


1. The expert advisor should place pending stop and limit orders on fractals (buy stop, sell stop, buy limit, sell limit), the expiry time of orders should be set (hours, minutes).

2. Order types should be switchable (either stop and limit orders together; or separately: stop orders only, limit orders only),

3. The distance from the order being placed to the fractal should be set in pips, and for stop orders separately, and for limit orders separately.

4. StopLoss and TakeProfit are fixed, set immediately.


5. You want to have a trailing stop from one pip and disable it.

6. Lot should be fixed. But it's also possible to create a money management.


7. Spread should be taken into account in orders: (buy order + spread, sell order - spread)


For contact: Cashinroman@yandex.ru
 

Can anyone understand this code, why in the tester pound USD H4 works great
And on the demo and on the real only pours something to change it sps maybe he looks in the history

extern double Init_line1 = 1.9620;

extern double Init_line2 = 1.9630;

extern double Init_line3 = 1.9640;

extern double Init_line4 = 1.9650;

extern int Step_line = 40;

extern double Lots = 1;

extern int ColUr = 2;


int i, j;

int a[4][4];//1-buy, 2-sell, 3-buystop, 4-sellstop


double minlot;

datetime LastWork;


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

//| expert initialization function |

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


//********************************************************************

//verify whether there are open positions,

//presses numbers of open positions into array a[4][4].

bool Pred()

{

int NL; //which rows are in the array

for (i=0; i<=4; i++)

for (j=0; j<=4; j++)

a[i][j]=-1;//all in -1

for (i=0; i<OrdersTotal(); i++) //reverse all the orders

{

if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)//select order if not possible

break;

if (OrderSymbol()==Symbol())//there are positions for this symbol

if (OrderComment()=="a1")//is there a mark?

NL=0;

else if (OrderComment()=="a2")//is our label?

NL=1;

else if (OrderComment()=="a3")//is our label?

NL=2;

else if (OrderComment()=="a4")//is our tag?

NL=3;

else

continue;//no? then continue search

//we have our orders, let's deal with them

if (OrderType()==OP_BUY)//if the position is BUY

a[NL][0]=OrderTicket();//remember its number

else if (OrderType()==OP_SELL)//if the position is on sell

a[NL][1]=OrderTicket();//remember its number

else if(OrderType()==OP_BUYSTOP)//if the position is pending buy

a[NL][2]=OrderTicket();//remember its number

else if (OrderType()==OP_SELLSTOP)//if the position is pending sell

a[NL][3]=OrderTicket();//remember its number

}//end of the loop

}



//********************************************************************

//Example:

//control level 1.9420, current price 1.9277 or 1.9537 find near bottom level

//а)|1.9420-1.9277|*10000/40=3.575

//3.575-3=0.575; 0.575*40=23; 1.9277-0.0023=1.9255 closest top level

//б)|1.9420-1.9537|*10000/40=2.925

// 2.925-2=0.925; 0.925*40=37; 1.9537-0.0037=1.9500 Nearest low level

int init()

{

LastWork = -1;

}

//********************************************************************

int deinit()

{

return(0);

}


//********************************************************************

int start()

{

if (CurTime() - LastWork < 5)

return(0); // no more than once every 5 seconds

LastWork = CurTime();

Pred();//all collected

Comment("a[1][1]=",a[0][0]," a[0][2]=",a[0][1]," a[1][3]=",a[0][2]," a[1][4]=",a[0][3],"\n",

"a[2][1]=",a[1][0], "a[2][2]=",a[1][1], "a[2][3]=",a[1][2], "a[2][4]=",a[1][3],"\n"

"a[3][1]=",a[2][0]," a[3][2]=",a[2][1], "a[3][3]=",a[2][2], "a[3][4]=",a[2][3],"\n"

"a[4][1]=",a[3][0]," a[4][2]=",a[3][1]," a[4][3]=",a[3][2]," a[4][4]=",a[3][3],"\n")

string coment;

double Init_line,qw,qw1,uo,w, sl, op;

for(i=0;i<ColUr;i++)//run the array a[4][4]

{

//needed further

coment=";

if (i==0)

{

coment="a1";

Init_line=Init_line1;

}

else if(i==1)

{

coment="a2";

Init_line=Init_line2;

}

else if(i==2)

{

coment="a3";

Init_line=Init_line3;

}

else if(i==3)

{

coment="a4";

Init_line=Init_line4;

}

//seek the nearest level

w=(MathAbs(Bid-Init_line)*1/Point)/Step_line;//coefficient

if (Bid>=Init_line)

qw=Step_line*(w-MathFloor(w));//number of points down to the nearest level

else

qw=Step_line-Step_line*(w-MathFloor(w));//number of points down to the nearest level

qw1=Step_line-qw;//number of points up to the nearest level

// Comment("Line1 ",Init_line," w=",((Bid-Init_line)*1/Point)/Step_line," qw=",qw," NewLine",Bid-(qw)*Point);

if ((a[i][0]==-1)&&(a[i][1]==-1)&&(a[i][2]==-1)&&(a[i][3]==-1))//нету открытых

{

//place orders

if (qw+4>=15)// we can place a wait for sell

OrderSend(Symbol(), OP_SELLSTOP, Lots, Bid-(qw)*Point,0,Bid-Point*(qw-2*Step_line),0,0,CLR_NONE);

else //set the next level down

OrderSend(Symbol(), OP_SELLSTOP, Lots, Bid-Point*(qw+Step_line),0,Bid-Point*(qw+Step_line-2*Step_line),0,coment,0,0,CLR_NONE);

if (qw1>=15)//can put a wait for Buy

OrderSend(Symbol(), OP_BUYSTOP, Lots, Ask+(qw1-4)*Point,0,Ask+Point*(qw1-4-2*Step_line),0,coment,0,0,CLR_NONE);

else// put it to the next level up

OrderSend(Symbol(), OP_BUYSTOP, Lots, Ask+Point*(qw1-4+Step_line),0,Ask+Point*(qw1-4+Step_line-2*Step_line),0,coment,0,0,CLR_NONE);

}

//!!!!!!!!!!!!!

else if (a[i][0]!=-1)// worth buy

{//open buy

OrderSelect(a[i][0],SELECT_BY_TICKET, MODE_TRADES);//select open order

uo=OrderOpenPrice();//its open price - level

op=uo;

if (uo<(Ask-(qw-4)*Point))//open price is lower than the current low

//check SL open, if necessary modify

if (OrderStopLoss()<(Ask-Point*(qw+4+2*Step_line))//SL is lower than 2 levels down from the current price

OrderModify(a[i][0],NULL,Ask-Point*(qw+4+2*Step_line),NULL,NULL,CLR_NONE);

sl=OrderStopLoss();

//decide on the pending

if (a[i][3]!=-1)//stands sellstop

{

OrderSelect(a[i][3],SELECT_BY_TICKET, MODE_TRADES);//position on pending

uo=OrderOpenPrice();//open price - level

if(uo!=sl)//(Bid-Point*(qw+2*Step_line)))//the open level is equal to the BUY stop

OrderModify(a[i][3],sl, sl+Point*(2*Step_line),NULL,NULL,CLR_NONE)

// OrderModify(a[i][3],Bid-Point*(qw-2*Step_line),Bid+qw*Point,NULL,NULL,NULL);

}

else if (a[i][3]==-1)//turn to buy has been opened, sellstop should be set

OrderSend(Symbol(), OP_SELLSTOP, Lots, sl,0,sl+Point*(2*Step_line),NULL,coment,0,0,CLR_NONE);

// OrderSend(Symbol(), OP_SELLSTOP, Lots, Bid-(qw+2*Step_line)*Point,0,Bid-Point*(qw),NULL,coment,0,0,0);

}

//!!!!!!!!!!!!!

else if (a[i][1]!=-1)//stand sell

{

OrderSelect(a[i][1],SELECT_BY_TICKET, MODE_TRADES);//select the open order

uo=OrderOpenPrice();//open price - level

op=uo;

if (uo>(Bid+(qw1)*Point))//open price is higher than the current top level

//check SL open, if necessary modify

if (OrderStopLoss()>(Bid+Point*(qw1+2*Step_line)))//SL is higher than 2 levels up from the current price

OrderModify(a[i][1],NULL,Bid+Point*(qw1+2*Step_line),NULL,NULL,CLR_NONE);

sl=OrderStopLoss();

//take a deferral

if (a[i][2]!=-1)// costs buystop

{

OrderSelect(a[i][2],SELECT_BY_TICKET, MODE_TRADES);//position on pending

uo=OrderOpenPrice();//open price - level

if (uo!=sl)//the open level is equal to the SELL stop

OrderModify(a[i][2],sl,sl-(2*Step_line)*Point,NULL,NULL,CLR_NONE);

// OrderModify(a[i][2],Ask+Point*(qw1-4+2*Step_line), Ask+(qw1-4)*Point,NULL,NULL,NULL);

}

else if (a[i][2]==-1)//turn to sell has been opened, we have to set buystop

OrderSend(Symbol(), OP_BUYSTOP, Lots, sl,0,sl-Point*(2*Step_line),NULL,0,0,CLR_NONE);

//OrderSend(Symbol(), OP_BUYSTOP, Lots, Ask+(qw1-4+2*Step_line)*Point,0,Ask+Point*(qw1-4),NULL,coment,0,0,0);

}

}

return (0);

}

 
Cashin:
Dear gentlemen programmers! I would like to ask for help in writing an EA. I do not speak MQL yet. If my EA is profitable, I am ready to share my profits with the person who has written it, or describe your conditions. I think it should be profitable.

About "share the prize" - that's worthy)

But it's more interesting to "describe the terms".

My terms: I'll write for the money now, I don't pretend to profit.

Contacts in the profile

 
Dear visitors to this site. A very simple Expert Advisor needs to be written. I have a suggestion. I give you a condition, you give me the Expert Advisor. You will also be able to use my simple strategy. I would appreciate if you could explain how to change the order volume in the EA, when this is needed. I will give the terms in private correspondence or ICQ 300333834 or mail forexbmf@yandex.ru Andrew.
 
october:
Dear visitors to this site. A very simple Expert Advisor needs to be written. I have a suggestion. I give you a condition, you give me the Expert Advisor. You will also be able to use my simple strategy. I would appreciate if you could explain how to change the order volume in the EA, when this is needed. I will give the terms during personal correspondence or ICQ 300333834 or mail forexbmf@yandex.ru Andrew.

If you want to trade on it for free (preferably real or demo 1-2 months).

Otherwise, here https://www.mql5.com/ru/job

 
sergeev on the strategy that requires an EA - manual trading is very difficult, almost impossible (takes a lot of time and difficult to make a bet in time). However, after listening to the condition you will realise that such trading does make sense.
 

Однако выслушав условие вы поймёте, что действительно имеет смысл такая торговля.

october, you have no idea how many people before you have said pretty much the same words and bummed themselves out.

 
october:
Dear site visitors. A very simple EA needs to be written.

See the online EA Wizard: http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/

Russian language support available

 
the task here, and justify that it won't work )
Reason: