Questions from Beginners MQL5 MT5 MetaTrader 5 - page 538
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.
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.
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 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.
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.
Why is there no Manual confirmation in the Advisors now? Not using them?
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.
{' - 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)
}
}
}