Proposal to the administration and local residents - page 6

 
Фьючерсные объемы для МТ:

I join the question -- what sucks about the code in the first post?

About OOP. There's not just a lot of material, there's a ton of it. Just not on this site. And even here there is some. Some people are just too lazy to do a proper search and study.

At least, it works only on the power source on which the Expert Advisor is installed....
 
Vladimir Pastushak:
At least, it works only on the symbol on which the Expert Advisor is installed....

No, the code is quite good. It's just that you want something from it that it's not designed for.

And that will be the biggest problem with your proposal in general.

Many things can be written effectively in many ways. Different people evaluate both the task and the solution, and the criteria for its effectiveness, in different ways.

For example, in MT it is more important for me to have simple code than to be able to assemble it from universal bricks.

 
Владимир:

Don't worry. It's not my craft.

If I ask you to show me an example of code writing, say "How much time is left until the end of the timeframe?" You're 100% guaranteed to send meto the fuck off

or to the work department. That's just for setting an example!

That's what fear and reluctance is all about. But the fingers are always outstretched.

You may also say that most of those asking to show the code are just lazy, and they are too lazy to look through the code base to find the code "How much time is left till the end of the timeframe?

It is not interesting to reveal oneself to the lazy)

 

Владимир:

VOLDEMAR is right. Programmers are all different.

Artyom Trishkin 2015.05.31 11:27

//+----------------------------------------------------------------------------+
   datetime GetTimeLeft(string symbol, int timeframe) {return(60*timeframe+(iTime(symbol,timeframe,0)-TimeCurrent()));}
//+----------------------------------------------------------------------------+

I choose Artyom Trishkin.

I agree, it would be amazing if everyone was the same...

And I respect Artyom(artmedia70), but in this case I can't choose him... And code brevity, is not yet a panacea.

Concise code can be insecure and potentially dangerous...

iTime

Returns the value of bar open time (specified by shift parameter) of corresponding chart.

datetime  iTime(
   string           symbol,          // символ
   int              timeframe,       // период
   int              shift            // сдвиг
   );

Parameters

symbol

[Symbol name of symbol. NULL means current symbol.

timeframe

[in] Period. Can be one of values of enumeration ENUM_TIMEFRAMES. 0 means period of current chart.

shift

[in] Index of the timeframe value (shift relative to the current bar by the specified number of bars back).

Returned value

Value of the bar open time (specified by the shift parameter) of the corresponding chart or 0 in case of an error. You need to call GetLastError() to get more information about the error.


 

Forum for trading, automated trading systems and strategy testing

Introductions to administration and locals

Vladimir Pastushak, 2015.05.31 08:20

The question for you is which code do you think is more correct ???

1

void depth_trend()
  {
//--- определение индекса на покупку
   double rsi=iRSI(Symbol(),tf,period,PRICE_CLOSE,0);
   index_rsi = 0;
   if(rsi>90.0) index_rsi=4;
   else if(rsi>80.0)
      index_rsi=3;
   else if(rsi>70.0)
      index_rsi=2;
   else if(rsi>60.0)
      index_rsi=1;
   else if(rsi<10.0)
      index_rsi=-4;
   else if(rsi<20.0)
      index_rsi=-3;
   else if(rsi<30.0)
      index_rsi=-2;
   else if(rsi<40.0)
      index_rsi=-1;
  }

2

int refresh_depth_trend()
  {
   int    index_rsi=0;
   double rsi=iRSI(Symbol(),0,14,PRICE_CLOSE,0),up=60,dw=40;
   for(int i=1; i<=4; i++,up+=10,dw-=10)
      index_rsi=rsi>up ? i : rsi<dw ?(i*-1):index_rsi;
   return index_rsi;
  }

3

int refresh_depth_trend()
  {
   return MathFloor( MathAbs( (rsi-50.0)/10.0 - (rsi-50.0)*0.0001 ) ) * ((rsi>50)-0.5)*2;
  }

-- haven't tested each option for correctness -- but assuming that all three options are identical according to the results -- then any option is correct

-- about code concision -- which option is easiest and fastest to edit? -- which variant, after time, is easier and quicker to deal with logically and without further explanation?

 
Владимир:

I choose

That's why programmers fan their fingers :) You don't really have a lot to choose from and you didn't understand that. In my file you can see an example of implementation with displaying remaining time on graph by second. And this function will update timer only at next tick receipt, when TimeCurrent() is updated + its output has to be somehow realized, i.e. we should overfit it with some brief code. In my example, all stuffing with precision optics is already there, and TimeCurrent() is used purely for synchronization with the server :)
 
By the way, TimeCurrent is a very finicky function
 
And MQL5 hasTimeTradeServer - very interesting, but haven't had a chance to use it yet
Документация по MQL5: Дата и время / TimeTradeServer
Документация по MQL5: Дата и время / TimeTradeServer
  • www.mql5.com
Дата и время / TimeTradeServer - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Alexander Puzanov:
That's why programmers use a fan of their fingers :) You really have nothing to choose from and you haven't understood it. In my file there is an example of implementation with per-second display of remaining time on the chart. And this function will update timer only at next tick receipt, when TimeCurrent() is updated + its output has to be somehow realized, i.e. we should overfit it with some brief code. In my example, all stuffing with precision optics is already there, and TimeCurrent() is used purely for synchronization with the server :)

Why, are you tripping over a 'fan' of my fingers?

I showed you how to know how much time is left before the next candle opens in any timeframe. That's all. The question was exactly the same.

 
Dear programmers, where can I find a method of programming in µl, where the programs laid down in the exel columns are used directly and thus the whole exel program is "driven" into the µl?