[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 234

 
I can't figure out how to implement it in the code. Have you seen the ready-made code anywhere? I would be ok if the code would calculate a lossless loss in three directions: 1. on all open orders 2. only buy orders 3. only sell orders
 
belck:
i cannot figure out how to implement this in the code. have you seen the ready-made code anywhere? I would be OK if the code calculates a breakeven in three directions: 1. for all open orders 2. only buy orders 3. only sell orders
https://www.mql5.com/ru/forum/103719
 

How to calculate margin (necessary funds to open an order with lot N) with different values of AccountFreeMarginMode


 

Hello!

Can you advise if anyone knows:

the EA works both in the tester and on the real at price deviation=2 points, and at market price, i.e. deviation=0, can there be problems or not? Communication is good - fibre is really 60Mbit, if I just open manually - execution is usually 1-2 seconds on real. My Expert Advisor has a replay in it until an order is successfully opened. I am asking because I was trading on the four-digit platform and I want to try the five-digit one. I tried it on a five-digit demo, but the order did not open, the signal just appeared saying, "We are trying to open an order...", and that was it. There are no changes or errors in the log. What do you advise?

From personal experience, how many points of deviation from the market price should be set when opening (closing) an order? Is it necessary to prescribe something in the EA for trading with five decimal places? When opening an order in the tester, the preset SL and TP will decrease by exactly ten times - by exactly one decimal place ?

P.S. I wrote my EA for MQL4 by myself.

Sincerely.

 

I did something with the editable file <indicator.mq4>, either moved it somewhere or copied it under a different name, but after compilation, in the list of indicators of the terminal, the name became gray and inactive.

However, the indicator is available through the side menu in the left window bar in the "list tree" and is dragged on to the chart.

If you have encountered such a situation, please advise how to remedy it?

Sincerely.

 
prorab:

I did something with the editable file <indicator.mq4>, either moved it somewhere or copied it under a different name, but after compilation, in the list of indicators of the terminal, the name became gray and inactive.

However, the indicator is available through the side menu in the left window bar in the "list tree" and is dragged on to the chart.

If you have encountered such a situation, please advise how to correct it?


Right-click on the gray colour of the indent in the terminal, then left-click in the menu "change", then compile in the meta-editor, then reload the terminal and enjoy life...:-)
 
Roman.:

Right-click on the grey colour of the indicator in the terminal, then left-click in the menu "change", then compile in the meta-editor, then reload the terminal and enjoy life...:-)
It will not help. The source code is lost.
 
Zhunko:
It won't. The source is lost.

I did the same procedure with my EA today - its colour turned blue in the terminal, it was grey.
 
Roman.:

I did the same procedure with my EA today - its colour turned blue in the terminal, it was grey.
If there is a source, but it has been changed, it is possible. I.e. change the contents of the source. If the source is lost or renamed, it will not be found.
 

Помогите исправить ошибку в коде советника. Попытался написать советник на основе индикатора Laguerre.mq4. При компиляции выдает ошибку. Место ошибки в коде выделено жирным. Сам индикатор находится в теле советника.

//+------------------------------------------------------------------+
//| 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);
}
//+------------------------------------------------------------------+

Reason: