Questions from Beginners MQL4 MT4 MetaTrader 4 - page 135

 
Or at least where to read about it. Please.
 
Sergey Voytsekhovsky:

Good evening.

Question:

Could you please tell me how to make a line inthe EA input parameters that would display some text, but not be active. I want to separate the sections. For example, I want to have "Direct quotes" and "Reverse quotes". I have searched in the freely available code to draw, I can't find it. Thanks in advance.

.............

Lines 2 and 5 now look like subheadings in the Inputs tab, that's fine, but these lines are active and available for selection. How can I make them visible but not active (not selectable) ???

Add a letter "s" at the beginning to get something like:

sinput string _____Main_____="_____Main_____";

 
Vladimir M.:

Add an 's' at the beginning, you get a type:

sinput string _____Main_____="_____Main_____";

Thank you for your responsiveness. I've been reading up on the "s". Here's what I found:

"A variable declared with sinput modifier is an input parameter of an MQL4 program. The value of this parameter can be changed when launching the program.

I tried it in the code - the possibility to check the option for optimization disappears, the variable value in Inputs tab can still be changed, i.e. the value can still be selected and changed.

Somewhere I've seen that on this tab there were inactive strings, they even looked paler, they didn't respond to a mouse cursor at all. I can't find how to do it.

 

Sergey Voytsekhovsky:

I tried it in the code - the possibility to tick a box for optimization disappears, the value of variable in Inputs tab can still be changed, i.e. the value can still be selected and changed.

Somewhere I've seen that on this tab there were inactive strings, they even looked paler, they didn't respond to a mouse cursor at all. I can't find how to do it.

I got the gist of the question, I'm curious myself. The only thing I can add is to insert it via enum.

Then there will be just an empty space where nothing can be inserted or changed.

enum enum_Main {};
sinput enum_Main _____Main_____;
 

Hello, could you please tell me where I can find a script that allows MT4 to place pendingorders for buying and selling at once for a certain number of points from the current price set by a trader, i.e. not to count manually and maybe not even to enter in the order window? I have looked for it myself, but I have not found it. Maybe I have not looked in the right place or called it that way, I have not dealt with scripts yet, I just started to trade in forex.

 

Help me sort out the trailing code.

Here is the code:

for(int i=0; i<OrdersTotal()-1; i--)

{

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))

if(OrderSymbol()==Symbol()||OrderMagicNumber()==Magic)

if(OrderType()==OP_BUY)

{

if(tral>0)

{

if(Bid-OrderOpenPrice()>tral*Point)

{

if(NormalizeDouble(OrderStopLoss()<Bid-tral,Digits))

{

OrderModify(OrderTicket(),OrderOpenPrice(),Bid-tral,OrderTakeProfit(),0,Green);

Print(" Trailingmodification error ",GetLastError());

}

}

}

}

if(OrderType()==OP_SELL)

{

if(tral>0)

{

if(OrderOpenPrice()-Ask>tral*Point)

{

if((OrderStopLoss()>(Ask+tral) || (OrderStopLoss()==0))

{

OrderModify(OrderTicket(),OrderOpenPrice(),Ask+tral,OrderTakeProfit(),0,Red);

Print("Trailing modification error",GetLastError());

}

}

}

}

}

}

The problem is that when testing, the trawl doesn't work and doesn't produce any errors.

 

Good day everyone!

I trade on a real account with a broker on MT4

I trade on the platform at work, at home and on the phone. Thus, when I place an indicator or level I have to do the same at work.

Question: Do you have any possibility (progam, robot or some other variant) to apply indicators on one desktop and make them appear somewhere else?

Thank you in advance

 
churkin:

Good day everyone!

I trade on a real account with a broker on MT4

I trade on the platform at work, at home and on the phone. Thus, when I place an indicator or level I have to do the same at work.

Question: Do you have any possibility (progam, robot or some other variant) to apply indicators on one desktop and make them appear somewhere else?

Many thanks in advance.

You have to save the template and copy it to another terminal. Or even a profile, if you want to save the settings not for one chart, but for all open in the terminal.

 

Good afternoon,

How can I reset the static variables when I change the timeframe of the chart or change the input parameters of the EA?

 
Asa saas:

Good afternoon,

How do you reset the static variables when you change the timeframe of the chart or change the input parameters of the EA?

Only enter the appropriate parameter:

bool g_bIsInit;
int OnInit()
{
   g_bIsInit = true;
}

void MyFunction()
{
   static int nMyStatic = 0;
   if (g_bIsInit)
   {
      nMyStatic = 0;
      g_bIsInit = false;
   }
}

So it's worth thinking 100 times before using static variables in an EA. In a script or indicator is another matter.