Questions from Beginners MQL5 MT5 MetaTrader 5 - page 75

 
mario065:

A function has been written to open it:

'=' - l-value required 

It gave out an error.

Did

 if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY)
      {
if(SL = 0 && T_P = 0)
{
  ModifyPosition(_Symbol,NormalizeDouble((Open - 0.003),Digits()),NormalizeDouble((Open + 0.003),Digits()));
}

и

if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY)
    {
    if(!PositionGetDouble(POSITION_SL))
      {
      PositionModify(_Symbol,NormalizeDouble((Open-STR),Digits()),NormalizeDouble((Open+TP),Digits()));
      }

not the same thing?

I guess in both cases the stoploss is set with the start of a new Bar, not Tick.

I can't send stoploss and takeprofit when opening an order - because the server doesn't allow it. You have to open the order first and then modify it afterwards.

 
Lester:

It gave out an error.

Did

и

not the same thing?

I guess in both cases stoploss is put out with the start of a new Bar, not Tick.

I can't send StopLoss and TakeProfit when opening an order - because the server doesn't allow it. I have to open order first and then modify it afterwards.

if(SL == 0 && T_P == 0)

Sorry, I need two equal signs - I didn't check it, I wrote it directly.

 

OnTick

The NewTick event is generatedonly for Expert Advisors when a new tick is received for a symbol, to the chart of which the Expert Advisor is attached. It is useless to define the OnTick() function in a custom indicator or script, because the Tick event is not generated for them.

The Tick event is generated only for Expert Advisors, but it doesn't mean that Expert Advisors must have the OnTick() function, because not only Tick events are generated for Expert Advisors, but also Timer, BookEvent and ChartEvent. Must be declared with voidtype , has no parameters:

voidOnTick

This is of course from the documentation.

Isn't it the same thing?

 

Well, for asc and bid, there are other ways to do it:

MqlTick  tick;
tick.ask-tick.bid
 
mario065:

Well, for asc and bid, there are other ways to do it:

О! That works! Thank you! )) ))
 
FinEngineer: Are there any MQL5 developers in this thread!?? Maybe I'm asking a question in the wrong branch? Then tell me how to ask a question to the developers? The question above is elementary for an experienced programmer...

And you know that your code works fine. Here's a picture of your default values, on a cross pair:

 
Yedelkin:

And you know that your code works fine. Here's a picture of your default values, on cross-pair:

2012.12.21 23:44:46 Pair_delta_RSI (EURGBP,M5) array out of range in 'Pair_delta_RSI.mq5' (96,37)
2012.12.21 23:44:42 Pair_delta_RSI (EURGBP,M5) Not all data of RSI1_Handle is calculated (-1bars ). Error4806

I get these errors as soon as I connect the indicator to a chart (I also took the cross and this same code). What may be wrong? Thanks in advance.


 
FinEngineer 2012.12.21 23:44:46 Pair_delta_RSI (EURGBP,M5) array out of range in 'Pair_delta_RSI.mq5'(96,37)

And show me the code line, to which the terminal refers (I have deleted empty lines myself, so I can't make it out).

FinEngineer : 2012.12.21 23:44:42 Pair_delta_RSI (EURGBP,M5) Not all data of RSI1_Handle is calculated (-1bars ). Error4806

Maybe broker's history is wrong... Try to open an account on MetaQuotes-Demo, open the monthly charts of the desired symbols (to pump enough history into the base of the terminal), and then run the indicator on an arbitrary symbol and the desired timeframe.

 
Yedelkin:

And show me the line of code the compiler refers to (I've deleted the blank lines myself, so I can't figure it out).

Maybe the broker's history is crooked... Try to open an account on MetaQuotes-Demo, open the monthly charts of the desired symbols (to pump enough history into the terminal database), and then run the indicator on an arbitrary symbol and the desired timeframe.

I loaded the history for both symbols, only one error remains 2012.12.22 00:56:44 Pair_delta_RSI (EURGBP,M1) Not all data of RSI1_Handle is calculated (-1bars ). Error4806

This error occurs not at compile time, but when I attach indicator to chart or when I change timeframe.

When compiling, some warning comes out, here it is: no indicator plot defined for indicator, assigned to 1 by default 0 0

Man, I'm racking my brains...help please...



 
FinEngineer: When compiling, some kind of warning comes up, this is it: no indicator plot defined for indicator, assigned to 1 by default 0 0

So did you download the programme despite this warning? Add this line at the top

#property indicator_plots   1
Reason: