Questions from Beginners MQL5 MT5 MetaTrader 5 - page 538

 
Valerius:
I just put in the text and the code, and the code is listed as code. I don't know how the rest of the code works. If it should be highlighted, it's not a question for me but for the site developers.
Do you do this: Doyou insert the code correctly in the forum or do you do it differently?
 
Yes, it is. But maybe my browser is old!
 
Karputov Vladimir:
I have a counter question - how do you manage to insert code??? Look, I inserted code correctly - operators are highlighted. And what about you? There are unnecessary lines, operators are not highlighted. I'm curious, what do you do with the code, before pasting?

The sequence of operations is as follows:

1. Insert code copied from ME

2. Select it

3. Select text type

код

/******************Expert deinitialization function******************/
void OnDeinit(const int reason)
{
     Comment("");
}/*******************************************************************/

And no highlighting...

Or do you select the text type code and then paste there the copied code.

And with the SRC it's highlighted.

/******************Expert deinitialization function******************/
void OnDeinit(const int reason)
{
  if(IsTesting())
   {
    FolderClean("test", FILE_COMMON);
    FolderDelete("test", FILE_COMMON);
   }
   Comment("");
}/*******************************************************************/
 
Alexey Viktorov:

The sequence of operations is as follows:

1. Insert code copied from ME

2. Select it

3. Select text type

код

/******************Expert deinitialization function******************/
void OnDeinit(const int reason)
{
     Comment("");
}/*******************************************************************/

And no highlighting...

Or select text type code and then paste there the copied code.

And with SRC with highlighting.

I hope you've figured out for yourself that the only correct way is the last one - via SRC.
 
Karputov Vladimir:
I hope you realized yourself that the only correct way is the last one - via SRC.

Vladimir, it's not up to me. I happened to try this way of insertion by accident once, saw how it worked and never use it without remarks. And now I've just explained to everyone how it can work.

Maybe the forum admins will think it over and reassign the "code" text type action to call the code insertion window, or change something else.

 
Alexey Viktorov:

Vladimir, it's not up to me. I happened to try this way of insertion by accident once, saw how it worked and never use it without remarks. And now I've just explained to everyone how it can work...

Maybe the forum admins will think about it and reassign the "code" text type action to call the code insertion window, or change something else.

Plus all paws. Cat.
 
ndkmak:
Why is there no Manual confirmation in the Advisors now? Not using them?
I'm certainly not a batsman, but it doesn't matter. So I should trust all EAs now? After all, testing is not a 100% guarantee.
 
ndkmak:
I'm not a batsman, of course, but it doesn't matter. So I should trust all advisers now? After all, testing is not a 100% guarantee.
What is the point of having an Expert Advisor if you have to sit in front of the monitor and confirm trades every time? Working with a fully automated Expert Advisor assumes that a person is not involved, the exception is a semi-automatic one.
 
help me fix the error '}'. - unexpected end of programtma2.mq41245

{' - unbalanced parentheses tma2.mq4 48 1


extern int TakeProfit =100;
extern int StopLoss =50;
extern double Lots = 0.01;
extern int Slippage =5;
extern string comment ="Sell";
extern int Megic = 123;
extern string Indi = "indicator data";
extern string TimeFrame = "current time frame";//current time frame
extern int HalfLength = 56;
extern int Price = PRICE_CLOSE;
extern double ATRMultiplier = 2.0;
extern inttern ATRPeriod = 100;
extern bool Interpolate = true;

double PriceHigh, PriceLow, SL, TP;
int ticket;

int init()
{0
if(Digits==3|| Digits==5)
{


TakeProfit*=10;
StopLoss*=10;
Slippage*=10;


}

return(0);

}

int start()

{0
PriceHigh= iCustom(Symbol(),0, "TMA with Distancer",TimeFrame,HalfLength,Price, ATRMultiplier,ATRPeriod, Interpolate,1,0);
PriceLow= iCustom(Symbol(),0, "TMA with Distancer",TimeFrame,HalfLength,Price, ATRMultiplier,ATRPeriod, Interpolate,2,0);

if(Bid>=(PriceHigh);
{
SL=NormalizeDouble(Bid+StopLoss*Point,Digits);
TP=NormalizeDouble(Bid-TakeProfit*Point,Digits);


ticket=OrderSend(Simbol(),OP_SELL,Lots,Bid,Slippage,0,0,comment,123,0,Maroon);




if(ticket>0);

{
if (OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)==true);

OrderModify(ticket,OrderOpenPrice,ST,TP,0);

}
}


if(Ask<0);
{
ST=NormalizeDouble(Ask-StopLoss*Point,Digits);
TP=NormalizeDouble(Ask+TakeProfit*Point,Digits);

ticket=OrderSend(Simbol(),OP_BUY,Lots,Ask,Slippage,0,0,comment,123,0,clrDarkBlue);



if(ticket>0);

{
if (OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)==true);

OrderModify(ticket,OrderOpenPrice,ST,TP,0);

}
return(0);

}

int CountSell()
{
int count=0;
for(int trede=OrdersTotal()-1;tred>=0;tread--)
{
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==Megic)
{
if(OrderType()==OP_SELL)count==;
}
}
return(count);
}


int CountBuy()
{
int count=0;
for(int trede=OrdersTotal()-1;tred>=0;tread--)
{
OrderSelect(trade,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==Megic)
{
if(OrderType()==OP_BUY)count==;
}
}
return(count);
}0
 

Can you please tell me how to do it so that when the price reaches the SL level, the order starts averaging?

void OnTick()

{

double ma;//declare a variable

double start_lot;//declare a variable

ma=iMA(Symbol(),0,10,0,0,0,1);//assign to the variable a moving average

if(Ask>ma)//if price is higher than the variable

{

if(OrdersTotal()==0)//if(no open orders

{

OrderSend(Symbol(),OP_BUY,lot,Ask,30,Bid-StopLoss*Point,Ask+TakeProfit*Point,"",0,0,clrGreen);

}

}

if(Bid<ma)//

{

if(OrdersTotal()==0)

{

OrderSend(Symbol(),OP_SELL,lot,Bid,30,Ask+StopLoss*Point,Bid-TakeProfit*Point,",0,0,clrRed);

}

//if(Bid)=StopLoss)

{

// lot=NormalizeDouble(start_lot*MathPow(koeficient,sumbay),2)

}

}

}