[Archive!] I'll write an advisor for FREE - page 22

 
nab17:
Hello Dear programmers

I have a question. I need an EA to close two specific orders on their total profit, without affecting other orders.
I have not managed to find anything suitable.
Thank you very much!

I would appreciate it if you would not spam me again. One post in one thread is enough to be heard. I've deleted the others.
 
Vinin:
Please do not spam any more. One post in one thread is enough to be heard. I've deleted the rest.
That's where do such polite and patient moderators come from? I do not understand.
 
Help me fix an error in the EA code. I tried to write an EA based on Laguerre.mq4 indicator. I got an error when compiling it. The error location in the code is in bold. The indicator is located in the body of the Expert Advisor.


//+------------------------------------------------------------------+
//| Laguerre+.mq4 |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+

//---- input parameters
extern int TrailingStop=0;
extern int StopLoss=0;
extern double lots=0.1;
extern double gamma = 0.7;
extern int Price_Type=0;
//---- buffers
double Filter[];
double L0[];
double L1[];;
double L2[];
double L3[];

//+------------------------------------------------------------------+
//| Custom indicator initialisation function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(5);
//---- indicators
SetIndexStyle(0, DRAW_LINE);
SetIndexDrawBegin(0, 1);
SetIndexLabel(0, "LaguerreFilter");
SetIndexBuffer(0, Filter);
SetIndexBuffer(1, L0);
SetIndexBuffer(2, L1);
SetIndexBuffer(3, L2);
SetIndexBuffer(4, L3);
//----
string short_name="LaguerreFilter(" + DoubleToStr(gamma, 2) + ")";
IndicatorShortName(short_name);
return(0);
}

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars = IndicatorCounted();
double CU, CD;
//---- last counted bar will be recounted
if (counted_bars>0)
counted_bars--;
else
counted_bars = 1;
limit = Bars - counted_bars;
//---- computations for RSI
for (int i=limit; i>=0; i--)
{
double Price=iMA(NULL,0,1,0,0,Price_Type,i);

L0[i] = (1.0 - gamma)*Price + gamma*L0[i+1];
L1[i] = -gamma*L0[i] + L0[i+1] + gamma*L1[i+1];
L2[i] = -gamma*L1[i] + L1[i+1] + gamma*L2[i+1];
L3[i] = -gamma*L2[i] + L2[i+1] + gamma*L3[i+1];

CU = 0;
CD = 0;
if (L0[i] >= L1[i])
CU = L0[i] - L1[i];
else
CD = L1[i] - L0[i];
if (L1[i] >= L2[i])
CU = CU + L1[i] - L2[i];
else
CD = CD + L2[i] - L1[i];
if (L2[i] >= L3[i])
CU = CU + L2[i] - L3[i];
else
CD = CD + L3[i] - L2[i];

if (CU + CD != 0)
Filter[i] = (L0[i] + 2 * L1[i] + 2 * L2[i] + L3[i]) / 6.0;
}
return(0);

//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
if (OrdersTotal()>0)
{
CU = 0;
CD = 0;
{
OrderSelect(SELECT_BY_POS);
if (OrderSymbol()==Symbol())
{
if (OrderType()== OP_BUY)
{
if ((L0[i] >= L1[i])CU = L0[i] - L1[i],(L1[i] >= L2[i])CU = CU + L1[i] - L2[i],(L2[i] >= L3[i])
OrderClose(OrderTicket(),OrderLots());
else CU++;
}
if (OrderType()== OP_SELL)
{
if (CD = L1[i] - L0[i],CD = CD + L2[i] - L1[i],CD = CD + L3[i] - L2[i])
OrderClose(OrderTicket(),OrderLots())
else CD++;
}
}
}

if (CU > CD && CU == 0)
{
OrderSend(Symbol(),OP_BUY,lots,Ask,0/*(Ask-StopLoss*Point)*/,0,);
}
if (CU < CD && CD ==0)
{
OrderSend(Symbol(),OP_SELL,lots,Bid,0/*(Bid+StopLoss*Point)*/,0,);
}



//----
return(0);
}
//+------------------------------------------------------------------+
 
Two starts. Reread the textbook, deconstruct the typical EA structure.
 
I need an advisor reading from a trading system with a pattern. When the arrows of one indicator must open an order in the direction of the arrow and if it changes close the previous order and open a new one, setting stop-loss and take-profit.
 
kvg31:

I will write an advisor of any complexity. The main thing is to have a good idea. How you will use it I do not care: will sell - I do not mind (I will not ask for money).

P. S. If you need an indicator, you have to tell me the strategy in which you want to use it.


Hello! need a trading robot on MTD 4 . i can send pics with examples of trades. answer the mail please. money3@inbox.ru All details on mail will forward. together with a photo and the description.
 
Oleg888:

Hello! need a trading robot on MTD 4 . i can send pictures with examples of transactions. reply to the mail please. money3@inbox.ru I will send all the details by mail. along with a photo and a description.
And some pictures of MTD 4.
 
granit77:
Two starts. Reread the textbook, deconstruct the typical EA structure.

Well, can you correct the error so that I can see the mistake?
 
ramses:
Well, can you fix the error so I can see it's not a mistake?
Do you know why no one corrects your code? Because it clearly shows that you haven't read the textbook, in which case it would be a difficult and probably useless conversation.
 
Hello, I need an EA which would place positions in both directions at a given distance from the market (e.g. Bay Stop and Sell Limit, optionally better to place in one direction), taking into account the spread. With possibility to enable trailers while the position is not in the market and move to Breakeven (according to flexible criteria) after it has been opened. And if there is an option to automatically open or close positions after previous positions are closed, it would be great.